Commit 4c88e567 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

views: don't call PreTargetHandler functions on NSView

This code only works when USE_AURA, which is when gfx::NativeView is an
aura::Window.

BUG=None

Change-Id: I6fd619acb4bcf854a111d43295ed20186d47f872
Reviewed-on: https://chromium-review.googlesource.com/565300
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486776}
parent 2a3b7362
...@@ -1973,9 +1973,14 @@ void BrowserView::ViewHierarchyChanged( ...@@ -1973,9 +1973,14 @@ void BrowserView::ViewHierarchyChanged(
if (!widget) if (!widget)
return; return;
if (!initialized_ && details.is_add) { bool init = !initialized_ && details.is_add;
if (init) {
InitViews(); InitViews();
initialized_ = true; initialized_ = true;
}
#if defined(USE_AURA)
if (init) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalFullscreenExitUI)) { switches::kEnableExperimentalFullscreenExitUI)) {
widget->GetNativeView()->AddPreTargetHandler(GetFullscreenControlHost()); widget->GetNativeView()->AddPreTargetHandler(GetFullscreenControlHost());
...@@ -1985,6 +1990,7 @@ void BrowserView::ViewHierarchyChanged( ...@@ -1985,6 +1990,7 @@ void BrowserView::ViewHierarchyChanged(
if (native_view) if (native_view)
native_view->RemovePreTargetHandler(fullscreen_control_host_.get()); native_view->RemovePreTargetHandler(fullscreen_control_host_.get());
} }
#endif
} }
void BrowserView::PaintChildren(const ui::PaintContext& context) { void BrowserView::PaintChildren(const ui::PaintContext& context) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment