diff options
author | mohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-25 04:44:55 +0000 |
---|---|---|
committer | mohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-25 04:44:55 +0000 |
commit | bff17558a018ea7515be7cf13728000d818637c5 (patch) | |
tree | 6d5138b99a43f50ce3c04002cccb2a45c8f54623 /ash/root_window_controller.cc | |
parent | 20aac3239c16af487e57f442adbf92c03e5a340d (diff) | |
download | chromium_src-bff17558a018ea7515be7cf13728000d818637c5.zip chromium_src-bff17558a018ea7515be7cf13728000d818637c5.tar.gz chromium_src-bff17558a018ea7515be7cf13728000d818637c5.tar.bz2 |
Reland "Swap touch HUD when switching primary display"
When a display is set as the primary display, its root window (and all
its children, including the widget showing the touch HUD) is replaced
with the old one's. But, the touch HUD widget is bound to display and
should not be swapped between the two displays. So, after swapping the
root windows, touch HUDs are swapped back to their own display.
Original Review URL: https://codereview.chromium.org/13460017/
BUG=172237
TBR=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/14079010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196312 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/root_window_controller.cc')
-rw-r--r-- | ash/root_window_controller.cc | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 991f1eb..e4472e0d 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -166,7 +166,8 @@ RootWindowController::RootWindowController(aura::RootWindow* root_window) : root_window_(root_window), root_window_layout_(NULL), shelf_(NULL), - panel_layout_manager_(NULL) { + panel_layout_manager_(NULL), + touch_observer_hud_(NULL) { SetRootWindowController(root_window, this); screen_dimmer_.reset(new ScreenDimmer(root_window)); @@ -199,9 +200,6 @@ RootWindowController* RootWindowController::ForActiveRootWindow() { } void RootWindowController::Shutdown() { - // Remove touch observer HUD. - SetTouchObserverHUD(NULL); - CloseChildWindows(); if (Shell::GetActiveRootWindow() == root_window_) { Shell::GetInstance()->set_active_root_window( @@ -299,12 +297,8 @@ void RootWindowController::CreateContainers() { // Create touch observer HUD if needed. HUD should be created after the // containers have been created, so that its widget can be added to them. CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kAshTouchHud)) { - int64 id = root_window_->GetProperty(kDisplayIdKey); - const gfx::Display& display = Shell::GetInstance()->display_manager()-> - GetDisplayForId(id); - SetTouchObserverHUD(new TouchObserverHUD(display)); - } + if (command_line->HasSwitch(switches::kAshTouchHud)) + touch_observer_hud_ = new TouchObserverHUD(root_window_.get()); } void RootWindowController::CreateSystemBackground( @@ -408,14 +402,6 @@ void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { ReparentAllWindows(root_window_.get(), dst); } -void RootWindowController::SetTouchObserverHUD(TouchObserverHUD* hud) { - if (touch_observer_hud_) - root_window_->RemovePreTargetHandler(touch_observer_hud_.get()); - if (hud) - root_window_->AddPreTargetHandler(hud); - touch_observer_hud_.reset(hud); -} - ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; } |