gfx::NativeView is no longer NSView on mac

https://chromium-review.googlesource.com/c/1270343
This commit is contained in:
Jeremy Apthorp 2019-01-09 12:25:19 -08:00
parent 70887ae21a
commit d228bdfb9e
12 changed files with 78 additions and 53 deletions

View file

@ -59,8 +59,9 @@ void BrowserWindow::OverrideNSWindowContentView(InspectableWebContents* iwc) {
// Make NativeWindow use a NSView as content view.
static_cast<NativeWindowMac*>(window())->OverrideNSWindowContentView();
// Add webview to contentView.
NSView* webView = iwc->GetView()->GetNativeView();
NSView* contentView = [window()->GetNativeWindow() contentView];
NSView* webView = iwc->GetView()->GetNativeView().GetNativeNSView();
NSView* contentView =
[window()->GetNativeWindow().GetNativeNSWindow() contentView];
[webView setFrame:[contentView bounds]];
// ensure that buttons view is floated to top of view hierarchy
@ -80,7 +81,7 @@ void BrowserWindow::UpdateDraggableRegions(
// All ControlRegionViews should be added as children of the WebContentsView,
// because WebContentsView will be removed and re-added when entering and
// leaving fullscreen mode.
NSView* webView = web_contents()->GetNativeView();
NSView* webView = web_contents()->GetNativeView().GetNativeNSView();
NSInteger webViewWidth = NSWidth([webView bounds]);
NSInteger webViewHeight = NSHeight([webView bounds]);

View file

@ -56,7 +56,7 @@ void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
base::Closure callback) {
if (!native_window)
return;
NSWindow* nswindow = native_window->GetNativeWindow();
NSWindow* nswindow = native_window->GetNativeWindow().GetNativeNSWindow();
auto close_callback = base::Bind(
&MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback);

View file

@ -17,7 +17,7 @@ bool WebContents::IsFocused() const {
return false;
if (GetType() != BACKGROUND_PAGE) {
auto window = [web_contents()->GetNativeView() window];
auto window = [web_contents()->GetNativeView().GetNativeNSView() window];
// On Mac the render widget host view does not lose focus when the window
// loses focus so check if the top level window is the key window.
if (window && ![window isKeyWindow])