OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/touch/touch_observer_hud.h" | 5 #include "ash/touch/touch_observer_hud.h" |
6 | 6 |
7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/root_window_settings.h" | 9 #include "ash/root_window_settings.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 display::Screen::GetScreen()->RemoveObserver(this); | 58 display::Screen::GetScreen()->RemoveObserver(this); |
59 | 59 |
60 widget_->RemoveObserver(this); | 60 widget_->RemoveObserver(this); |
61 } | 61 } |
62 | 62 |
63 void TouchObserverHUD::Clear() {} | 63 void TouchObserverHUD::Clear() {} |
64 | 64 |
65 void TouchObserverHUD::Remove() { | 65 void TouchObserverHUD::Remove() { |
66 root_window_->RemovePreTargetHandler(this); | 66 root_window_->RemovePreTargetHandler(this); |
67 | 67 |
68 RootWindowController* controller = GetRootWindowController(root_window_); | 68 RootWindowController* controller = |
| 69 RootWindowController::ForWindow(root_window_); |
69 UnsetHudForRootWindowController(controller); | 70 UnsetHudForRootWindowController(controller); |
70 | 71 |
71 widget_->CloseNow(); | 72 widget_->CloseNow(); |
72 } | 73 } |
73 | 74 |
74 void TouchObserverHUD::OnTouchEvent(ui::TouchEvent* /*event*/) {} | 75 void TouchObserverHUD::OnTouchEvent(ui::TouchEvent* /*event*/) {} |
75 | 76 |
76 void TouchObserverHUD::OnWidgetDestroying(views::Widget* widget) { | 77 void TouchObserverHUD::OnWidgetDestroying(views::Widget* widget) { |
77 DCHECK_EQ(widget, widget_); | 78 DCHECK_EQ(widget, widget_); |
78 delete this; | 79 delete this; |
(...skipping 25 matching lines...) Expand all Loading... |
104 void TouchObserverHUD::OnDisplaysInitialized() { | 105 void TouchObserverHUD::OnDisplaysInitialized() { |
105 OnDisplayConfigurationChanged(); | 106 OnDisplayConfigurationChanged(); |
106 } | 107 } |
107 | 108 |
108 void TouchObserverHUD::OnDisplayConfigurationChanging() { | 109 void TouchObserverHUD::OnDisplayConfigurationChanging() { |
109 if (!root_window_) | 110 if (!root_window_) |
110 return; | 111 return; |
111 | 112 |
112 root_window_->RemovePreTargetHandler(this); | 113 root_window_->RemovePreTargetHandler(this); |
113 | 114 |
114 RootWindowController* controller = GetRootWindowController(root_window_); | 115 RootWindowController* controller = |
| 116 RootWindowController::ForWindow(root_window_); |
115 UnsetHudForRootWindowController(controller); | 117 UnsetHudForRootWindowController(controller); |
116 | 118 |
117 views::Widget::ReparentNativeView( | 119 views::Widget::ReparentNativeView( |
118 widget_->GetNativeView(), | 120 widget_->GetNativeView(), |
119 Shell::GetContainer(root_window_, | 121 Shell::GetContainer(root_window_, |
120 kShellWindowId_UnparentedControlContainer)); | 122 kShellWindowId_UnparentedControlContainer)); |
121 | 123 |
122 root_window_ = NULL; | 124 root_window_ = NULL; |
123 } | 125 } |
124 | 126 |
125 void TouchObserverHUD::OnDisplayConfigurationChanged() { | 127 void TouchObserverHUD::OnDisplayConfigurationChanged() { |
126 if (root_window_) | 128 if (root_window_) |
127 return; | 129 return; |
128 | 130 |
129 root_window_ = | 131 root_window_ = |
130 Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( | 132 Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( |
131 display_id_); | 133 display_id_); |
132 | 134 |
133 views::Widget::ReparentNativeView( | 135 views::Widget::ReparentNativeView( |
134 widget_->GetNativeView(), | 136 widget_->GetNativeView(), |
135 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer)); | 137 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer)); |
136 | 138 |
137 RootWindowController* controller = GetRootWindowController(root_window_); | 139 RootWindowController* controller = |
| 140 RootWindowController::ForWindow(root_window_); |
138 SetHudForRootWindowController(controller); | 141 SetHudForRootWindowController(controller); |
139 | 142 |
140 root_window_->AddPreTargetHandler(this); | 143 root_window_->AddPreTargetHandler(this); |
141 } | 144 } |
142 | 145 |
143 } // namespace ash | 146 } // namespace ash |
OLD | NEW |