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 "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" |
6 | 6 |
7 #include "base/win/metro.h" | 7 #include "base/win/metro.h" |
8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 void InsetBottomRight(gfx::Rect* rect, gfx::Vector2d vector) { | 58 void InsetBottomRight(gfx::Rect* rect, gfx::Vector2d vector) { |
59 rect->Inset(0, 0, vector.x(), vector.y()); | 59 rect->Inset(0, 0, vector.x(), vector.y()); |
60 } | 60 } |
61 | 61 |
62 } // namespace | 62 } // namespace |
63 | 63 |
64 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); | 64 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); |
65 | 65 |
66 // Identifies the DesktopRootWindowHostWin associated with the RootWindow. | 66 // Identifies the DesktopWindowTreeHostWin associated with the RootWindow. |
67 DEFINE_WINDOW_PROPERTY_KEY(DesktopRootWindowHostWin*, kDesktopRootWindowHostKey, | 67 DEFINE_WINDOW_PROPERTY_KEY(DesktopWindowTreeHostWin*, kDesktopWindowTreeHostKey, |
68 NULL); | 68 NULL); |
69 | 69 |
70 //////////////////////////////////////////////////////////////////////////////// | 70 //////////////////////////////////////////////////////////////////////////////// |
71 // DesktopRootWindowHostWin, public: | 71 // DesktopWindowTreeHostWin, public: |
72 | 72 |
73 DesktopRootWindowHostWin::DesktopRootWindowHostWin( | 73 DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( |
74 internal::NativeWidgetDelegate* native_widget_delegate, | 74 internal::NativeWidgetDelegate* native_widget_delegate, |
75 DesktopNativeWidgetAura* desktop_native_widget_aura) | 75 DesktopNativeWidgetAura* desktop_native_widget_aura) |
76 : root_window_(NULL), | 76 : root_window_(NULL), |
77 message_handler_(new HWNDMessageHandler(this)), | 77 message_handler_(new HWNDMessageHandler(this)), |
78 native_widget_delegate_(native_widget_delegate), | 78 native_widget_delegate_(native_widget_delegate), |
79 desktop_native_widget_aura_(desktop_native_widget_aura), | 79 desktop_native_widget_aura_(desktop_native_widget_aura), |
80 content_window_(NULL), | 80 content_window_(NULL), |
81 drag_drop_client_(NULL), | 81 drag_drop_client_(NULL), |
82 should_animate_window_close_(false), | 82 should_animate_window_close_(false), |
83 pending_close_(false), | 83 pending_close_(false), |
84 has_non_client_view_(false), | 84 has_non_client_view_(false), |
85 tooltip_(NULL), | 85 tooltip_(NULL), |
86 is_cursor_visible_(true) { | 86 is_cursor_visible_(true) { |
87 } | 87 } |
88 | 88 |
89 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { | 89 DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { |
90 // WARNING: |content_window_| has been destroyed by the time we get here. | 90 // WARNING: |content_window_| has been destroyed by the time we get here. |
91 desktop_native_widget_aura_->OnDesktopRootWindowHostDestroyed( | 91 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed( |
92 root_window_); | 92 root_window_); |
93 } | 93 } |
94 | 94 |
95 // static | 95 // static |
96 aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { | 96 aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) { |
97 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); | 97 aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd); |
98 return root ? root->window()->GetProperty(kContentWindowForRootWindow) : NULL; | 98 return root ? root->window()->GetProperty(kContentWindowForRootWindow) : NULL; |
99 } | 99 } |
100 | 100 |
101 // static | 101 // static |
102 ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { | 102 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { |
103 // Use NativeThemeWin for windows shown on the desktop, those not on the | 103 // Use NativeThemeWin for windows shown on the desktop, those not on the |
104 // desktop come from Ash and get NativeThemeAura. | 104 // desktop come from Ash and get NativeThemeAura. |
105 aura::WindowEventDispatcher* dispatcher = | 105 aura::WindowEventDispatcher* dispatcher = |
106 window ? window->GetDispatcher() : NULL; | 106 window ? window->GetDispatcher() : NULL; |
107 if (dispatcher) { | 107 if (dispatcher) { |
108 HWND host_hwnd = dispatcher->host()->GetAcceleratedWidget(); | 108 HWND host_hwnd = dispatcher->host()->GetAcceleratedWidget(); |
109 if (host_hwnd && | 109 if (host_hwnd && |
110 DesktopRootWindowHostWin::GetContentWindowForHWND(host_hwnd)) { | 110 DesktopWindowTreeHostWin::GetContentWindowForHWND(host_hwnd)) { |
111 return ui::NativeThemeWin::instance(); | 111 return ui::NativeThemeWin::instance(); |
112 } | 112 } |
113 } | 113 } |
114 return ui::NativeThemeAura::instance(); | 114 return ui::NativeThemeAura::instance(); |
115 } | 115 } |
116 | 116 |
117 //////////////////////////////////////////////////////////////////////////////// | 117 //////////////////////////////////////////////////////////////////////////////// |
118 // DesktopRootWindowHostWin, DesktopRootWindowHost implementation: | 118 // DesktopWindowTreeHostWin, DesktopWindowTreeHost implementation: |
119 | 119 |
120 void DesktopRootWindowHostWin::Init( | 120 void DesktopWindowTreeHostWin::Init( |
121 aura::Window* content_window, | 121 aura::Window* content_window, |
122 const Widget::InitParams& params, | 122 const Widget::InitParams& params, |
123 aura::RootWindow::CreateParams* rw_create_params) { | 123 aura::RootWindow::CreateParams* rw_create_params) { |
124 // TODO(beng): SetInitParams(). | 124 // TODO(beng): SetInitParams(). |
125 content_window_ = content_window; | 125 content_window_ = content_window; |
126 | 126 |
127 aura::client::SetAnimationHost(content_window_, this); | 127 aura::client::SetAnimationHost(content_window_, this); |
128 | 128 |
129 ConfigureWindowStyles(message_handler_.get(), params, | 129 ConfigureWindowStyles(message_handler_.get(), params, |
130 GetWidget()->widget_delegate(), | 130 GetWidget()->widget_delegate(), |
131 native_widget_delegate_); | 131 native_widget_delegate_); |
132 | 132 |
133 HWND parent_hwnd = NULL; | 133 HWND parent_hwnd = NULL; |
134 if (params.parent && params.parent->GetDispatcher()) { | 134 if (params.parent && params.parent->GetDispatcher()) { |
135 parent_hwnd = | 135 parent_hwnd = |
136 params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); | 136 params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); |
137 } | 137 } |
138 | 138 |
139 message_handler_->set_remove_standard_frame(params.remove_standard_frame); | 139 message_handler_->set_remove_standard_frame(params.remove_standard_frame); |
140 | 140 |
141 has_non_client_view_ = Widget::RequiresNonClientView(params.type); | 141 has_non_client_view_ = Widget::RequiresNonClientView(params.type); |
142 | 142 |
143 gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(params.bounds); | 143 gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(params.bounds); |
144 message_handler_->Init(parent_hwnd, pixel_bounds); | 144 message_handler_->Init(parent_hwnd, pixel_bounds); |
145 CreateCompositor(GetAcceleratedWidget()); | 145 CreateCompositor(GetAcceleratedWidget()); |
146 | 146 |
147 rw_create_params->host = this; | 147 rw_create_params->host = this; |
148 } | 148 } |
149 | 149 |
150 void DesktopRootWindowHostWin::OnRootWindowCreated( | 150 void DesktopWindowTreeHostWin::OnRootWindowCreated( |
151 aura::RootWindow* root, | 151 aura::RootWindow* root, |
152 const Widget::InitParams& params) { | 152 const Widget::InitParams& params) { |
153 root_window_ = root; | 153 root_window_ = root; |
154 | 154 |
155 // The cursor is not necessarily visible when the root window is created. | 155 // The cursor is not necessarily visible when the root window is created. |
156 aura::client::CursorClient* cursor_client = | 156 aura::client::CursorClient* cursor_client = |
157 aura::client::GetCursorClient(root_window_->window()); | 157 aura::client::GetCursorClient(root_window_->window()); |
158 if (cursor_client) | 158 if (cursor_client) |
159 is_cursor_visible_ = cursor_client->IsCursorVisible(); | 159 is_cursor_visible_ = cursor_client->IsCursorVisible(); |
160 | 160 |
161 root_window_->window()->SetProperty(kContentWindowForRootWindow, | 161 root_window_->window()->SetProperty(kContentWindowForRootWindow, |
162 content_window_); | 162 content_window_); |
163 root_window_->window()->SetProperty(kDesktopRootWindowHostKey, this); | 163 root_window_->window()->SetProperty(kDesktopWindowTreeHostKey, this); |
164 | 164 |
165 should_animate_window_close_ = | 165 should_animate_window_close_ = |
166 content_window_->type() != ui::wm::WINDOW_TYPE_NORMAL && | 166 content_window_->type() != ui::wm::WINDOW_TYPE_NORMAL && |
167 !views::corewm::WindowAnimationsDisabled(content_window_); | 167 !views::corewm::WindowAnimationsDisabled(content_window_); |
168 | 168 |
169 // TODO this is not invoked *after* Init(), but should be ok. | 169 // TODO this is not invoked *after* Init(), but should be ok. |
170 SetWindowTransparency(); | 170 SetWindowTransparency(); |
171 } | 171 } |
172 | 172 |
173 scoped_ptr<corewm::Tooltip> DesktopRootWindowHostWin::CreateTooltip() { | 173 scoped_ptr<corewm::Tooltip> DesktopWindowTreeHostWin::CreateTooltip() { |
174 DCHECK(!tooltip_); | 174 DCHECK(!tooltip_); |
175 tooltip_ = new corewm::TooltipWin(GetAcceleratedWidget()); | 175 tooltip_ = new corewm::TooltipWin(GetAcceleratedWidget()); |
176 return scoped_ptr<corewm::Tooltip>(tooltip_); | 176 return scoped_ptr<corewm::Tooltip>(tooltip_); |
177 } | 177 } |
178 | 178 |
179 scoped_ptr<aura::client::DragDropClient> | 179 scoped_ptr<aura::client::DragDropClient> |
180 DesktopRootWindowHostWin::CreateDragDropClient( | 180 DesktopWindowTreeHostWin::CreateDragDropClient( |
181 DesktopNativeCursorManager* cursor_manager) { | 181 DesktopNativeCursorManager* cursor_manager) { |
182 drag_drop_client_ = new DesktopDragDropClientWin(root_window_->window(), | 182 drag_drop_client_ = new DesktopDragDropClientWin(root_window_->window(), |
183 GetHWND()); | 183 GetHWND()); |
184 return scoped_ptr<aura::client::DragDropClient>(drag_drop_client_).Pass(); | 184 return scoped_ptr<aura::client::DragDropClient>(drag_drop_client_).Pass(); |
185 } | 185 } |
186 | 186 |
187 void DesktopRootWindowHostWin::Close() { | 187 void DesktopWindowTreeHostWin::Close() { |
188 // TODO(beng): Move this entire branch to DNWA so it can be shared with X11. | 188 // TODO(beng): Move this entire branch to DNWA so it can be shared with X11. |
189 if (should_animate_window_close_) { | 189 if (should_animate_window_close_) { |
190 pending_close_ = true; | 190 pending_close_ = true; |
191 const bool is_animating = | 191 const bool is_animating = |
192 content_window_->layer()->GetAnimator()->IsAnimatingProperty( | 192 content_window_->layer()->GetAnimator()->IsAnimatingProperty( |
193 ui::LayerAnimationElement::VISIBILITY); | 193 ui::LayerAnimationElement::VISIBILITY); |
194 // Animation may not start for a number of reasons. | 194 // Animation may not start for a number of reasons. |
195 if (!is_animating) | 195 if (!is_animating) |
196 message_handler_->Close(); | 196 message_handler_->Close(); |
197 // else case, OnWindowHidingAnimationCompleted does the actual Close. | 197 // else case, OnWindowHidingAnimationCompleted does the actual Close. |
198 } else { | 198 } else { |
199 message_handler_->Close(); | 199 message_handler_->Close(); |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 void DesktopRootWindowHostWin::CloseNow() { | 203 void DesktopWindowTreeHostWin::CloseNow() { |
204 message_handler_->CloseNow(); | 204 message_handler_->CloseNow(); |
205 } | 205 } |
206 | 206 |
207 aura::RootWindowHost* DesktopRootWindowHostWin::AsRootWindowHost() { | 207 aura::WindowTreeHost* DesktopWindowTreeHostWin::AsWindowTreeHost() { |
208 return this; | 208 return this; |
209 } | 209 } |
210 | 210 |
211 void DesktopRootWindowHostWin::ShowWindowWithState( | 211 void DesktopWindowTreeHostWin::ShowWindowWithState( |
212 ui::WindowShowState show_state) { | 212 ui::WindowShowState show_state) { |
213 message_handler_->ShowWindowWithState(show_state); | 213 message_handler_->ShowWindowWithState(show_state); |
214 } | 214 } |
215 | 215 |
216 void DesktopRootWindowHostWin::ShowMaximizedWithBounds( | 216 void DesktopWindowTreeHostWin::ShowMaximizedWithBounds( |
217 const gfx::Rect& restored_bounds) { | 217 const gfx::Rect& restored_bounds) { |
218 gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(restored_bounds); | 218 gfx::Rect pixel_bounds = gfx::win::DIPToScreenRect(restored_bounds); |
219 message_handler_->ShowMaximizedWithBounds(pixel_bounds); | 219 message_handler_->ShowMaximizedWithBounds(pixel_bounds); |
220 } | 220 } |
221 | 221 |
222 bool DesktopRootWindowHostWin::IsVisible() const { | 222 bool DesktopWindowTreeHostWin::IsVisible() const { |
223 return message_handler_->IsVisible(); | 223 return message_handler_->IsVisible(); |
224 } | 224 } |
225 | 225 |
226 void DesktopRootWindowHostWin::SetSize(const gfx::Size& size) { | 226 void DesktopWindowTreeHostWin::SetSize(const gfx::Size& size) { |
227 gfx::Size size_in_pixels = gfx::win::DIPToScreenSize(size); | 227 gfx::Size size_in_pixels = gfx::win::DIPToScreenSize(size); |
228 gfx::Size expanded = GetExpandedWindowSize( | 228 gfx::Size expanded = GetExpandedWindowSize( |
229 message_handler_->window_ex_style(), size_in_pixels); | 229 message_handler_->window_ex_style(), size_in_pixels); |
230 window_enlargement_ = | 230 window_enlargement_ = |
231 gfx::Vector2d(expanded.width() - size_in_pixels.width(), | 231 gfx::Vector2d(expanded.width() - size_in_pixels.width(), |
232 expanded.height() - size_in_pixels.height()); | 232 expanded.height() - size_in_pixels.height()); |
233 message_handler_->SetSize(expanded); | 233 message_handler_->SetSize(expanded); |
234 } | 234 } |
235 | 235 |
236 void DesktopRootWindowHostWin::StackAtTop() { | 236 void DesktopWindowTreeHostWin::StackAtTop() { |
237 message_handler_->StackAtTop(); | 237 message_handler_->StackAtTop(); |
238 } | 238 } |
239 | 239 |
240 void DesktopRootWindowHostWin::CenterWindow(const gfx::Size& size) { | 240 void DesktopWindowTreeHostWin::CenterWindow(const gfx::Size& size) { |
241 gfx::Size expanded_size; | 241 gfx::Size expanded_size; |
242 expanded_size = GetExpandedWindowSize( | 242 expanded_size = GetExpandedWindowSize( |
243 message_handler_->window_ex_style(), size); | 243 message_handler_->window_ex_style(), size); |
244 gfx::Size size_in_pixels = gfx::win::DIPToScreenSize(expanded_size); | 244 gfx::Size size_in_pixels = gfx::win::DIPToScreenSize(expanded_size); |
245 message_handler_->CenterWindow(size_in_pixels); | 245 message_handler_->CenterWindow(size_in_pixels); |
246 } | 246 } |
247 | 247 |
248 void DesktopRootWindowHostWin::GetWindowPlacement( | 248 void DesktopWindowTreeHostWin::GetWindowPlacement( |
249 gfx::Rect* bounds, | 249 gfx::Rect* bounds, |
250 ui::WindowShowState* show_state) const { | 250 ui::WindowShowState* show_state) const { |
251 message_handler_->GetWindowPlacement(bounds, show_state); | 251 message_handler_->GetWindowPlacement(bounds, show_state); |
252 InsetBottomRight(bounds, window_enlargement_); | 252 InsetBottomRight(bounds, window_enlargement_); |
253 *bounds = gfx::win::ScreenToDIPRect(*bounds); | 253 *bounds = gfx::win::ScreenToDIPRect(*bounds); |
254 } | 254 } |
255 | 255 |
256 gfx::Rect DesktopRootWindowHostWin::GetWindowBoundsInScreen() const { | 256 gfx::Rect DesktopWindowTreeHostWin::GetWindowBoundsInScreen() const { |
257 gfx::Rect pixel_bounds = message_handler_->GetWindowBoundsInScreen(); | 257 gfx::Rect pixel_bounds = message_handler_->GetWindowBoundsInScreen(); |
258 InsetBottomRight(&pixel_bounds, window_enlargement_); | 258 InsetBottomRight(&pixel_bounds, window_enlargement_); |
259 return gfx::win::ScreenToDIPRect(pixel_bounds); | 259 return gfx::win::ScreenToDIPRect(pixel_bounds); |
260 } | 260 } |
261 | 261 |
262 gfx::Rect DesktopRootWindowHostWin::GetClientAreaBoundsInScreen() const { | 262 gfx::Rect DesktopWindowTreeHostWin::GetClientAreaBoundsInScreen() const { |
263 gfx::Rect pixel_bounds = message_handler_->GetClientAreaBoundsInScreen(); | 263 gfx::Rect pixel_bounds = message_handler_->GetClientAreaBoundsInScreen(); |
264 InsetBottomRight(&pixel_bounds, window_enlargement_); | 264 InsetBottomRight(&pixel_bounds, window_enlargement_); |
265 return gfx::win::ScreenToDIPRect(pixel_bounds); | 265 return gfx::win::ScreenToDIPRect(pixel_bounds); |
266 } | 266 } |
267 | 267 |
268 gfx::Rect DesktopRootWindowHostWin::GetRestoredBounds() const { | 268 gfx::Rect DesktopWindowTreeHostWin::GetRestoredBounds() const { |
269 gfx::Rect pixel_bounds = message_handler_->GetRestoredBounds(); | 269 gfx::Rect pixel_bounds = message_handler_->GetRestoredBounds(); |
270 InsetBottomRight(&pixel_bounds, window_enlargement_); | 270 InsetBottomRight(&pixel_bounds, window_enlargement_); |
271 return gfx::win::ScreenToDIPRect(pixel_bounds); | 271 return gfx::win::ScreenToDIPRect(pixel_bounds); |
272 } | 272 } |
273 | 273 |
274 gfx::Rect DesktopRootWindowHostWin::GetWorkAreaBoundsInScreen() const { | 274 gfx::Rect DesktopWindowTreeHostWin::GetWorkAreaBoundsInScreen() const { |
275 MONITORINFO monitor_info; | 275 MONITORINFO monitor_info; |
276 monitor_info.cbSize = sizeof(monitor_info); | 276 monitor_info.cbSize = sizeof(monitor_info); |
277 GetMonitorInfo(MonitorFromWindow(message_handler_->hwnd(), | 277 GetMonitorInfo(MonitorFromWindow(message_handler_->hwnd(), |
278 MONITOR_DEFAULTTONEAREST), | 278 MONITOR_DEFAULTTONEAREST), |
279 &monitor_info); | 279 &monitor_info); |
280 gfx::Rect pixel_bounds = gfx::Rect(monitor_info.rcWork); | 280 gfx::Rect pixel_bounds = gfx::Rect(monitor_info.rcWork); |
281 return gfx::win::ScreenToDIPRect(pixel_bounds); | 281 return gfx::win::ScreenToDIPRect(pixel_bounds); |
282 } | 282 } |
283 | 283 |
284 void DesktopRootWindowHostWin::SetShape(gfx::NativeRegion native_region) { | 284 void DesktopWindowTreeHostWin::SetShape(gfx::NativeRegion native_region) { |
285 if (native_region) { | 285 if (native_region) { |
286 message_handler_->SetRegion(gfx::CreateHRGNFromSkRegion(*native_region)); | 286 message_handler_->SetRegion(gfx::CreateHRGNFromSkRegion(*native_region)); |
287 } else { | 287 } else { |
288 message_handler_->SetRegion(NULL); | 288 message_handler_->SetRegion(NULL); |
289 } | 289 } |
290 | 290 |
291 delete native_region; | 291 delete native_region; |
292 } | 292 } |
293 | 293 |
294 void DesktopRootWindowHostWin::Activate() { | 294 void DesktopWindowTreeHostWin::Activate() { |
295 message_handler_->Activate(); | 295 message_handler_->Activate(); |
296 } | 296 } |
297 | 297 |
298 void DesktopRootWindowHostWin::Deactivate() { | 298 void DesktopWindowTreeHostWin::Deactivate() { |
299 message_handler_->Deactivate(); | 299 message_handler_->Deactivate(); |
300 } | 300 } |
301 | 301 |
302 bool DesktopRootWindowHostWin::IsActive() const { | 302 bool DesktopWindowTreeHostWin::IsActive() const { |
303 return message_handler_->IsActive(); | 303 return message_handler_->IsActive(); |
304 } | 304 } |
305 | 305 |
306 void DesktopRootWindowHostWin::Maximize() { | 306 void DesktopWindowTreeHostWin::Maximize() { |
307 message_handler_->Maximize(); | 307 message_handler_->Maximize(); |
308 } | 308 } |
309 | 309 |
310 void DesktopRootWindowHostWin::Minimize() { | 310 void DesktopWindowTreeHostWin::Minimize() { |
311 message_handler_->Minimize(); | 311 message_handler_->Minimize(); |
312 } | 312 } |
313 | 313 |
314 void DesktopRootWindowHostWin::Restore() { | 314 void DesktopWindowTreeHostWin::Restore() { |
315 message_handler_->Restore(); | 315 message_handler_->Restore(); |
316 } | 316 } |
317 | 317 |
318 bool DesktopRootWindowHostWin::IsMaximized() const { | 318 bool DesktopWindowTreeHostWin::IsMaximized() const { |
319 return message_handler_->IsMaximized(); | 319 return message_handler_->IsMaximized(); |
320 } | 320 } |
321 | 321 |
322 bool DesktopRootWindowHostWin::IsMinimized() const { | 322 bool DesktopWindowTreeHostWin::IsMinimized() const { |
323 return message_handler_->IsMinimized(); | 323 return message_handler_->IsMinimized(); |
324 } | 324 } |
325 | 325 |
326 bool DesktopRootWindowHostWin::HasCapture() const { | 326 bool DesktopWindowTreeHostWin::HasCapture() const { |
327 return message_handler_->HasCapture(); | 327 return message_handler_->HasCapture(); |
328 } | 328 } |
329 | 329 |
330 void DesktopRootWindowHostWin::SetAlwaysOnTop(bool always_on_top) { | 330 void DesktopWindowTreeHostWin::SetAlwaysOnTop(bool always_on_top) { |
331 message_handler_->SetAlwaysOnTop(always_on_top); | 331 message_handler_->SetAlwaysOnTop(always_on_top); |
332 } | 332 } |
333 | 333 |
334 bool DesktopRootWindowHostWin::IsAlwaysOnTop() const { | 334 bool DesktopWindowTreeHostWin::IsAlwaysOnTop() const { |
335 return message_handler_->IsAlwaysOnTop(); | 335 return message_handler_->IsAlwaysOnTop(); |
336 } | 336 } |
337 | 337 |
338 bool DesktopRootWindowHostWin::SetWindowTitle(const base::string16& title) { | 338 bool DesktopWindowTreeHostWin::SetWindowTitle(const base::string16& title) { |
339 return message_handler_->SetTitle(title); | 339 return message_handler_->SetTitle(title); |
340 } | 340 } |
341 | 341 |
342 void DesktopRootWindowHostWin::ClearNativeFocus() { | 342 void DesktopWindowTreeHostWin::ClearNativeFocus() { |
343 message_handler_->ClearNativeFocus(); | 343 message_handler_->ClearNativeFocus(); |
344 } | 344 } |
345 | 345 |
346 Widget::MoveLoopResult DesktopRootWindowHostWin::RunMoveLoop( | 346 Widget::MoveLoopResult DesktopWindowTreeHostWin::RunMoveLoop( |
347 const gfx::Vector2d& drag_offset, | 347 const gfx::Vector2d& drag_offset, |
348 Widget::MoveLoopSource source, | 348 Widget::MoveLoopSource source, |
349 Widget::MoveLoopEscapeBehavior escape_behavior) { | 349 Widget::MoveLoopEscapeBehavior escape_behavior) { |
350 const bool hide_on_escape = | 350 const bool hide_on_escape = |
351 escape_behavior == Widget::MOVE_LOOP_ESCAPE_BEHAVIOR_HIDE; | 351 escape_behavior == Widget::MOVE_LOOP_ESCAPE_BEHAVIOR_HIDE; |
352 return message_handler_->RunMoveLoop(drag_offset, hide_on_escape) ? | 352 return message_handler_->RunMoveLoop(drag_offset, hide_on_escape) ? |
353 Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED; | 353 Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED; |
354 } | 354 } |
355 | 355 |
356 void DesktopRootWindowHostWin::EndMoveLoop() { | 356 void DesktopWindowTreeHostWin::EndMoveLoop() { |
357 message_handler_->EndMoveLoop(); | 357 message_handler_->EndMoveLoop(); |
358 } | 358 } |
359 | 359 |
360 void DesktopRootWindowHostWin::SetVisibilityChangedAnimationsEnabled( | 360 void DesktopWindowTreeHostWin::SetVisibilityChangedAnimationsEnabled( |
361 bool value) { | 361 bool value) { |
362 message_handler_->SetVisibilityChangedAnimationsEnabled(value); | 362 message_handler_->SetVisibilityChangedAnimationsEnabled(value); |
363 content_window_->SetProperty(aura::client::kAnimationsDisabledKey, !value); | 363 content_window_->SetProperty(aura::client::kAnimationsDisabledKey, !value); |
364 } | 364 } |
365 | 365 |
366 bool DesktopRootWindowHostWin::ShouldUseNativeFrame() { | 366 bool DesktopWindowTreeHostWin::ShouldUseNativeFrame() { |
367 return ui::win::IsAeroGlassEnabled(); | 367 return ui::win::IsAeroGlassEnabled(); |
368 } | 368 } |
369 | 369 |
370 void DesktopRootWindowHostWin::FrameTypeChanged() { | 370 void DesktopWindowTreeHostWin::FrameTypeChanged() { |
371 message_handler_->FrameTypeChanged(); | 371 message_handler_->FrameTypeChanged(); |
372 SetWindowTransparency(); | 372 SetWindowTransparency(); |
373 } | 373 } |
374 | 374 |
375 NonClientFrameView* DesktopRootWindowHostWin::CreateNonClientFrameView() { | 375 NonClientFrameView* DesktopWindowTreeHostWin::CreateNonClientFrameView() { |
376 return GetWidget()->ShouldUseNativeFrame() ? | 376 return GetWidget()->ShouldUseNativeFrame() ? |
377 new NativeFrameView(GetWidget()) : NULL; | 377 new NativeFrameView(GetWidget()) : NULL; |
378 } | 378 } |
379 | 379 |
380 void DesktopRootWindowHostWin::SetFullscreen(bool fullscreen) { | 380 void DesktopWindowTreeHostWin::SetFullscreen(bool fullscreen) { |
381 message_handler_->fullscreen_handler()->SetFullscreen(fullscreen); | 381 message_handler_->fullscreen_handler()->SetFullscreen(fullscreen); |
382 // TODO(sky): workaround for ScopedFullscreenVisibility showing window | 382 // TODO(sky): workaround for ScopedFullscreenVisibility showing window |
383 // directly. Instead of this should listen for visibility changes and then | 383 // directly. Instead of this should listen for visibility changes and then |
384 // update window. | 384 // update window. |
385 if (message_handler_->IsVisible() && !content_window_->TargetVisibility()) | 385 if (message_handler_->IsVisible() && !content_window_->TargetVisibility()) |
386 content_window_->Show(); | 386 content_window_->Show(); |
387 SetWindowTransparency(); | 387 SetWindowTransparency(); |
388 } | 388 } |
389 | 389 |
390 bool DesktopRootWindowHostWin::IsFullscreen() const { | 390 bool DesktopWindowTreeHostWin::IsFullscreen() const { |
391 return message_handler_->fullscreen_handler()->fullscreen(); | 391 return message_handler_->fullscreen_handler()->fullscreen(); |
392 } | 392 } |
393 | 393 |
394 void DesktopRootWindowHostWin::SetOpacity(unsigned char opacity) { | 394 void DesktopWindowTreeHostWin::SetOpacity(unsigned char opacity) { |
395 message_handler_->SetOpacity(static_cast<BYTE>(opacity)); | 395 message_handler_->SetOpacity(static_cast<BYTE>(opacity)); |
396 content_window_->layer()->SetOpacity(opacity / 255.0); | 396 content_window_->layer()->SetOpacity(opacity / 255.0); |
397 } | 397 } |
398 | 398 |
399 void DesktopRootWindowHostWin::SetWindowIcons( | 399 void DesktopWindowTreeHostWin::SetWindowIcons( |
400 const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) { | 400 const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) { |
401 message_handler_->SetWindowIcons(window_icon, app_icon); | 401 message_handler_->SetWindowIcons(window_icon, app_icon); |
402 } | 402 } |
403 | 403 |
404 void DesktopRootWindowHostWin::InitModalType(ui::ModalType modal_type) { | 404 void DesktopWindowTreeHostWin::InitModalType(ui::ModalType modal_type) { |
405 message_handler_->InitModalType(modal_type); | 405 message_handler_->InitModalType(modal_type); |
406 } | 406 } |
407 | 407 |
408 void DesktopRootWindowHostWin::FlashFrame(bool flash_frame) { | 408 void DesktopWindowTreeHostWin::FlashFrame(bool flash_frame) { |
409 message_handler_->FlashFrame(flash_frame); | 409 message_handler_->FlashFrame(flash_frame); |
410 } | 410 } |
411 | 411 |
412 void DesktopRootWindowHostWin::OnRootViewLayout() const { | 412 void DesktopWindowTreeHostWin::OnRootViewLayout() const { |
413 } | 413 } |
414 | 414 |
415 void DesktopRootWindowHostWin::OnNativeWidgetFocus() { | 415 void DesktopWindowTreeHostWin::OnNativeWidgetFocus() { |
416 // HWNDMessageHandler will perform the proper updating on its own. | 416 // HWNDMessageHandler will perform the proper updating on its own. |
417 } | 417 } |
418 | 418 |
419 void DesktopRootWindowHostWin::OnNativeWidgetBlur() { | 419 void DesktopWindowTreeHostWin::OnNativeWidgetBlur() { |
420 } | 420 } |
421 | 421 |
422 bool DesktopRootWindowHostWin::IsAnimatingClosed() const { | 422 bool DesktopWindowTreeHostWin::IsAnimatingClosed() const { |
423 return pending_close_; | 423 return pending_close_; |
424 } | 424 } |
425 | 425 |
426 //////////////////////////////////////////////////////////////////////////////// | 426 //////////////////////////////////////////////////////////////////////////////// |
427 // DesktopRootWindowHostWin, RootWindowHost implementation: | 427 // DesktopWindowTreeHostWin, WindowTreeHost implementation: |
428 | 428 |
429 aura::RootWindow* DesktopRootWindowHostWin::GetRootWindow() { | 429 aura::RootWindow* DesktopWindowTreeHostWin::GetRootWindow() { |
430 return root_window_; | 430 return root_window_; |
431 } | 431 } |
432 | 432 |
433 gfx::AcceleratedWidget DesktopRootWindowHostWin::GetAcceleratedWidget() { | 433 gfx::AcceleratedWidget DesktopWindowTreeHostWin::GetAcceleratedWidget() { |
434 return message_handler_->hwnd(); | 434 return message_handler_->hwnd(); |
435 } | 435 } |
436 | 436 |
437 void DesktopRootWindowHostWin::Show() { | 437 void DesktopWindowTreeHostWin::Show() { |
438 message_handler_->Show(); | 438 message_handler_->Show(); |
439 } | 439 } |
440 | 440 |
441 void DesktopRootWindowHostWin::Hide() { | 441 void DesktopWindowTreeHostWin::Hide() { |
442 if (!pending_close_) | 442 if (!pending_close_) |
443 message_handler_->Hide(); | 443 message_handler_->Hide(); |
444 } | 444 } |
445 | 445 |
446 void DesktopRootWindowHostWin::ToggleFullScreen() { | 446 void DesktopWindowTreeHostWin::ToggleFullScreen() { |
447 SetWindowTransparency(); | 447 SetWindowTransparency(); |
448 } | 448 } |
449 | 449 |
450 // GetBounds and SetBounds work in pixel coordinates, whereas other get/set | 450 // GetBounds and SetBounds work in pixel coordinates, whereas other get/set |
451 // methods work in DIP. | 451 // methods work in DIP. |
452 | 452 |
453 gfx::Rect DesktopRootWindowHostWin::GetBounds() const { | 453 gfx::Rect DesktopWindowTreeHostWin::GetBounds() const { |
454 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged(). | 454 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged(). |
455 if (IsMinimized()) | 455 if (IsMinimized()) |
456 return gfx::Rect(); | 456 return gfx::Rect(); |
457 gfx::Rect bounds(WidgetSizeIsClientSize() ? | 457 gfx::Rect bounds(WidgetSizeIsClientSize() ? |
458 message_handler_->GetClientAreaBoundsInScreen() : | 458 message_handler_->GetClientAreaBoundsInScreen() : |
459 message_handler_->GetWindowBoundsInScreen()); | 459 message_handler_->GetWindowBoundsInScreen()); |
460 | 460 |
461 // If the window bounds were expanded we need to return the original bounds | 461 // If the window bounds were expanded we need to return the original bounds |
462 // To achieve this we do the reverse of the expansion, i.e. add the | 462 // To achieve this we do the reverse of the expansion, i.e. add the |
463 // window_expansion_top_left_delta_ to the origin and subtract the | 463 // window_expansion_top_left_delta_ to the origin and subtract the |
464 // window_expansion_bottom_right_delta_ from the width and height. | 464 // window_expansion_bottom_right_delta_ from the width and height. |
465 gfx::Rect without_expansion( | 465 gfx::Rect without_expansion( |
466 bounds.x() + window_expansion_top_left_delta_.x(), | 466 bounds.x() + window_expansion_top_left_delta_.x(), |
467 bounds.y() + window_expansion_top_left_delta_.y(), | 467 bounds.y() + window_expansion_top_left_delta_.y(), |
468 bounds.width() - window_expansion_bottom_right_delta_.x() - | 468 bounds.width() - window_expansion_bottom_right_delta_.x() - |
469 window_enlargement_.x(), | 469 window_enlargement_.x(), |
470 bounds.height() - window_expansion_bottom_right_delta_.y() - | 470 bounds.height() - window_expansion_bottom_right_delta_.y() - |
471 window_enlargement_.y()); | 471 window_enlargement_.y()); |
472 return without_expansion; | 472 return without_expansion; |
473 } | 473 } |
474 | 474 |
475 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) { | 475 void DesktopWindowTreeHostWin::SetBounds(const gfx::Rect& bounds) { |
476 // If the window bounds have to be expanded we need to subtract the | 476 // If the window bounds have to be expanded we need to subtract the |
477 // window_expansion_top_left_delta_ from the origin and add the | 477 // window_expansion_top_left_delta_ from the origin and add the |
478 // window_expansion_bottom_right_delta_ to the width and height | 478 // window_expansion_bottom_right_delta_ to the width and height |
479 gfx::Rect expanded( | 479 gfx::Rect expanded( |
480 bounds.x() - window_expansion_top_left_delta_.x(), | 480 bounds.x() - window_expansion_top_left_delta_.x(), |
481 bounds.y() - window_expansion_top_left_delta_.y(), | 481 bounds.y() - window_expansion_top_left_delta_.y(), |
482 bounds.width() + window_expansion_bottom_right_delta_.x(), | 482 bounds.width() + window_expansion_bottom_right_delta_.x(), |
483 bounds.height() + window_expansion_bottom_right_delta_.y()); | 483 bounds.height() + window_expansion_bottom_right_delta_.y()); |
484 | 484 |
485 gfx::Rect new_expanded( | 485 gfx::Rect new_expanded( |
486 expanded.origin(), | 486 expanded.origin(), |
487 GetExpandedWindowSize(message_handler_->window_ex_style(), | 487 GetExpandedWindowSize(message_handler_->window_ex_style(), |
488 expanded.size())); | 488 expanded.size())); |
489 window_enlargement_ = | 489 window_enlargement_ = |
490 gfx::Vector2d(new_expanded.width() - expanded.width(), | 490 gfx::Vector2d(new_expanded.width() - expanded.width(), |
491 new_expanded.height() - expanded.height()); | 491 new_expanded.height() - expanded.height()); |
492 message_handler_->SetBounds(new_expanded); | 492 message_handler_->SetBounds(new_expanded); |
493 } | 493 } |
494 | 494 |
495 gfx::Insets DesktopRootWindowHostWin::GetInsets() const { | 495 gfx::Insets DesktopWindowTreeHostWin::GetInsets() const { |
496 return gfx::Insets(); | 496 return gfx::Insets(); |
497 } | 497 } |
498 | 498 |
499 void DesktopRootWindowHostWin::SetInsets(const gfx::Insets& insets) { | 499 void DesktopWindowTreeHostWin::SetInsets(const gfx::Insets& insets) { |
500 } | 500 } |
501 | 501 |
502 gfx::Point DesktopRootWindowHostWin::GetLocationOnNativeScreen() const { | 502 gfx::Point DesktopWindowTreeHostWin::GetLocationOnNativeScreen() const { |
503 return GetBounds().origin(); | 503 return GetBounds().origin(); |
504 } | 504 } |
505 | 505 |
506 void DesktopRootWindowHostWin::SetCapture() { | 506 void DesktopWindowTreeHostWin::SetCapture() { |
507 message_handler_->SetCapture(); | 507 message_handler_->SetCapture(); |
508 } | 508 } |
509 | 509 |
510 void DesktopRootWindowHostWin::ReleaseCapture() { | 510 void DesktopWindowTreeHostWin::ReleaseCapture() { |
511 message_handler_->ReleaseCapture(); | 511 message_handler_->ReleaseCapture(); |
512 } | 512 } |
513 | 513 |
514 void DesktopRootWindowHostWin::SetCursor(gfx::NativeCursor cursor) { | 514 void DesktopWindowTreeHostWin::SetCursor(gfx::NativeCursor cursor) { |
515 ui::CursorLoaderWin cursor_loader; | 515 ui::CursorLoaderWin cursor_loader; |
516 cursor_loader.SetPlatformCursor(&cursor); | 516 cursor_loader.SetPlatformCursor(&cursor); |
517 | 517 |
518 message_handler_->SetCursor(cursor.platform()); | 518 message_handler_->SetCursor(cursor.platform()); |
519 } | 519 } |
520 | 520 |
521 bool DesktopRootWindowHostWin::QueryMouseLocation(gfx::Point* location_return) { | 521 bool DesktopWindowTreeHostWin::QueryMouseLocation(gfx::Point* location_return) { |
522 aura::client::CursorClient* cursor_client = | 522 aura::client::CursorClient* cursor_client = |
523 aura::client::GetCursorClient(root_window_->window()); | 523 aura::client::GetCursorClient(root_window_->window()); |
524 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { | 524 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { |
525 *location_return = gfx::Point(0, 0); | 525 *location_return = gfx::Point(0, 0); |
526 return false; | 526 return false; |
527 } | 527 } |
528 POINT pt = {0}; | 528 POINT pt = {0}; |
529 ::GetCursorPos(&pt); | 529 ::GetCursorPos(&pt); |
530 *location_return = | 530 *location_return = |
531 gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y)); | 531 gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y)); |
532 return true; | 532 return true; |
533 } | 533 } |
534 | 534 |
535 bool DesktopRootWindowHostWin::ConfineCursorToRootWindow() { | 535 bool DesktopWindowTreeHostWin::ConfineCursorToRootWindow() { |
536 RECT window_rect = root_window_->window()->GetBoundsInScreen().ToRECT(); | 536 RECT window_rect = root_window_->window()->GetBoundsInScreen().ToRECT(); |
537 ::ClipCursor(&window_rect); | 537 ::ClipCursor(&window_rect); |
538 return true; | 538 return true; |
539 } | 539 } |
540 | 540 |
541 void DesktopRootWindowHostWin::UnConfineCursor() { | 541 void DesktopWindowTreeHostWin::UnConfineCursor() { |
542 ::ClipCursor(NULL); | 542 ::ClipCursor(NULL); |
543 } | 543 } |
544 | 544 |
545 void DesktopRootWindowHostWin::OnCursorVisibilityChanged(bool show) { | 545 void DesktopWindowTreeHostWin::OnCursorVisibilityChanged(bool show) { |
546 if (is_cursor_visible_ == show) | 546 if (is_cursor_visible_ == show) |
547 return; | 547 return; |
548 is_cursor_visible_ = show; | 548 is_cursor_visible_ = show; |
549 ::ShowCursor(!!show); | 549 ::ShowCursor(!!show); |
550 } | 550 } |
551 | 551 |
552 void DesktopRootWindowHostWin::MoveCursorTo(const gfx::Point& location) { | 552 void DesktopWindowTreeHostWin::MoveCursorTo(const gfx::Point& location) { |
553 POINT cursor_location = location.ToPOINT(); | 553 POINT cursor_location = location.ToPOINT(); |
554 ::ClientToScreen(GetHWND(), &cursor_location); | 554 ::ClientToScreen(GetHWND(), &cursor_location); |
555 ::SetCursorPos(cursor_location.x, cursor_location.y); | 555 ::SetCursorPos(cursor_location.x, cursor_location.y); |
556 } | 556 } |
557 | 557 |
558 void DesktopRootWindowHostWin::PostNativeEvent( | 558 void DesktopWindowTreeHostWin::PostNativeEvent( |
559 const base::NativeEvent& native_event) { | 559 const base::NativeEvent& native_event) { |
560 } | 560 } |
561 | 561 |
562 void DesktopRootWindowHostWin::OnDeviceScaleFactorChanged( | 562 void DesktopWindowTreeHostWin::OnDeviceScaleFactorChanged( |
563 float device_scale_factor) { | 563 float device_scale_factor) { |
564 } | 564 } |
565 | 565 |
566 void DesktopRootWindowHostWin::PrepareForShutdown() { | 566 void DesktopWindowTreeHostWin::PrepareForShutdown() { |
567 } | 567 } |
568 | 568 |
569 //////////////////////////////////////////////////////////////////////////////// | 569 //////////////////////////////////////////////////////////////////////////////// |
570 // DesktopRootWindowHostWin, aura::AnimationHost implementation: | 570 // DesktopWindowTreeHostWin, aura::AnimationHost implementation: |
571 | 571 |
572 void DesktopRootWindowHostWin::SetHostTransitionOffsets( | 572 void DesktopWindowTreeHostWin::SetHostTransitionOffsets( |
573 const gfx::Vector2d& top_left_delta, | 573 const gfx::Vector2d& top_left_delta, |
574 const gfx::Vector2d& bottom_right_delta) { | 574 const gfx::Vector2d& bottom_right_delta) { |
575 gfx::Rect bounds_without_expansion = GetBounds(); | 575 gfx::Rect bounds_without_expansion = GetBounds(); |
576 window_expansion_top_left_delta_ = top_left_delta; | 576 window_expansion_top_left_delta_ = top_left_delta; |
577 window_expansion_bottom_right_delta_ = bottom_right_delta; | 577 window_expansion_bottom_right_delta_ = bottom_right_delta; |
578 SetBounds(bounds_without_expansion); | 578 SetBounds(bounds_without_expansion); |
579 } | 579 } |
580 | 580 |
581 void DesktopRootWindowHostWin::OnWindowHidingAnimationCompleted() { | 581 void DesktopWindowTreeHostWin::OnWindowHidingAnimationCompleted() { |
582 if (pending_close_) | 582 if (pending_close_) |
583 message_handler_->Close(); | 583 message_handler_->Close(); |
584 } | 584 } |
585 | 585 |
586 //////////////////////////////////////////////////////////////////////////////// | 586 //////////////////////////////////////////////////////////////////////////////// |
587 // DesktopRootWindowHostWin, HWNDMessageHandlerDelegate implementation: | 587 // DesktopWindowTreeHostWin, HWNDMessageHandlerDelegate implementation: |
588 | 588 |
589 bool DesktopRootWindowHostWin::IsWidgetWindow() const { | 589 bool DesktopWindowTreeHostWin::IsWidgetWindow() const { |
590 return has_non_client_view_; | 590 return has_non_client_view_; |
591 } | 591 } |
592 | 592 |
593 bool DesktopRootWindowHostWin::IsUsingCustomFrame() const { | 593 bool DesktopWindowTreeHostWin::IsUsingCustomFrame() const { |
594 return !GetWidget()->ShouldUseNativeFrame(); | 594 return !GetWidget()->ShouldUseNativeFrame(); |
595 } | 595 } |
596 | 596 |
597 void DesktopRootWindowHostWin::SchedulePaint() { | 597 void DesktopWindowTreeHostWin::SchedulePaint() { |
598 GetWidget()->GetRootView()->SchedulePaint(); | 598 GetWidget()->GetRootView()->SchedulePaint(); |
599 } | 599 } |
600 | 600 |
601 void DesktopRootWindowHostWin::EnableInactiveRendering() { | 601 void DesktopWindowTreeHostWin::EnableInactiveRendering() { |
602 native_widget_delegate_->EnableInactiveRendering(); | 602 native_widget_delegate_->EnableInactiveRendering(); |
603 } | 603 } |
604 | 604 |
605 bool DesktopRootWindowHostWin::IsInactiveRenderingDisabled() { | 605 bool DesktopWindowTreeHostWin::IsInactiveRenderingDisabled() { |
606 return native_widget_delegate_->IsInactiveRenderingDisabled(); | 606 return native_widget_delegate_->IsInactiveRenderingDisabled(); |
607 } | 607 } |
608 | 608 |
609 bool DesktopRootWindowHostWin::CanResize() const { | 609 bool DesktopWindowTreeHostWin::CanResize() const { |
610 return GetWidget()->widget_delegate()->CanResize(); | 610 return GetWidget()->widget_delegate()->CanResize(); |
611 } | 611 } |
612 | 612 |
613 bool DesktopRootWindowHostWin::CanMaximize() const { | 613 bool DesktopWindowTreeHostWin::CanMaximize() const { |
614 return GetWidget()->widget_delegate()->CanMaximize(); | 614 return GetWidget()->widget_delegate()->CanMaximize(); |
615 } | 615 } |
616 | 616 |
617 bool DesktopRootWindowHostWin::CanActivate() const { | 617 bool DesktopWindowTreeHostWin::CanActivate() const { |
618 if (IsModalWindowActive()) | 618 if (IsModalWindowActive()) |
619 return true; | 619 return true; |
620 return native_widget_delegate_->CanActivate(); | 620 return native_widget_delegate_->CanActivate(); |
621 } | 621 } |
622 | 622 |
623 bool DesktopRootWindowHostWin::WidgetSizeIsClientSize() const { | 623 bool DesktopWindowTreeHostWin::WidgetSizeIsClientSize() const { |
624 const Widget* widget = GetWidget()->GetTopLevelWidget(); | 624 const Widget* widget = GetWidget()->GetTopLevelWidget(); |
625 return IsMaximized() || (widget && widget->ShouldUseNativeFrame()); | 625 return IsMaximized() || (widget && widget->ShouldUseNativeFrame()); |
626 } | 626 } |
627 | 627 |
628 bool DesktopRootWindowHostWin::CanSaveFocus() const { | 628 bool DesktopWindowTreeHostWin::CanSaveFocus() const { |
629 return GetWidget()->is_top_level(); | 629 return GetWidget()->is_top_level(); |
630 } | 630 } |
631 | 631 |
632 void DesktopRootWindowHostWin::SaveFocusOnDeactivate() { | 632 void DesktopWindowTreeHostWin::SaveFocusOnDeactivate() { |
633 GetWidget()->GetFocusManager()->StoreFocusedView(true); | 633 GetWidget()->GetFocusManager()->StoreFocusedView(true); |
634 } | 634 } |
635 | 635 |
636 void DesktopRootWindowHostWin::RestoreFocusOnActivate() { | 636 void DesktopWindowTreeHostWin::RestoreFocusOnActivate() { |
637 RestoreFocusOnEnable(); | 637 RestoreFocusOnEnable(); |
638 } | 638 } |
639 | 639 |
640 void DesktopRootWindowHostWin::RestoreFocusOnEnable() { | 640 void DesktopWindowTreeHostWin::RestoreFocusOnEnable() { |
641 GetWidget()->GetFocusManager()->RestoreFocusedView(); | 641 GetWidget()->GetFocusManager()->RestoreFocusedView(); |
642 } | 642 } |
643 | 643 |
644 bool DesktopRootWindowHostWin::IsModal() const { | 644 bool DesktopWindowTreeHostWin::IsModal() const { |
645 return native_widget_delegate_->IsModal(); | 645 return native_widget_delegate_->IsModal(); |
646 } | 646 } |
647 | 647 |
648 int DesktopRootWindowHostWin::GetInitialShowState() const { | 648 int DesktopWindowTreeHostWin::GetInitialShowState() const { |
649 return SW_SHOWNORMAL; | 649 return SW_SHOWNORMAL; |
650 } | 650 } |
651 | 651 |
652 bool DesktopRootWindowHostWin::WillProcessWorkAreaChange() const { | 652 bool DesktopWindowTreeHostWin::WillProcessWorkAreaChange() const { |
653 return GetWidget()->widget_delegate()->WillProcessWorkAreaChange(); | 653 return GetWidget()->widget_delegate()->WillProcessWorkAreaChange(); |
654 } | 654 } |
655 | 655 |
656 int DesktopRootWindowHostWin::GetNonClientComponent( | 656 int DesktopWindowTreeHostWin::GetNonClientComponent( |
657 const gfx::Point& point) const { | 657 const gfx::Point& point) const { |
658 gfx::Point dip_position = gfx::win::ScreenToDIPPoint(point); | 658 gfx::Point dip_position = gfx::win::ScreenToDIPPoint(point); |
659 return native_widget_delegate_->GetNonClientComponent(dip_position); | 659 return native_widget_delegate_->GetNonClientComponent(dip_position); |
660 } | 660 } |
661 | 661 |
662 void DesktopRootWindowHostWin::GetWindowMask(const gfx::Size& size, | 662 void DesktopWindowTreeHostWin::GetWindowMask(const gfx::Size& size, |
663 gfx::Path* path) { | 663 gfx::Path* path) { |
664 if (GetWidget()->non_client_view()) { | 664 if (GetWidget()->non_client_view()) { |
665 GetWidget()->non_client_view()->GetWindowMask(size, path); | 665 GetWidget()->non_client_view()->GetWindowMask(size, path); |
666 } else if (!window_enlargement_.IsZero()) { | 666 } else if (!window_enlargement_.IsZero()) { |
667 gfx::Rect bounds(WidgetSizeIsClientSize() | 667 gfx::Rect bounds(WidgetSizeIsClientSize() |
668 ? message_handler_->GetClientAreaBoundsInScreen() | 668 ? message_handler_->GetClientAreaBoundsInScreen() |
669 : message_handler_->GetWindowBoundsInScreen()); | 669 : message_handler_->GetWindowBoundsInScreen()); |
670 InsetBottomRight(&bounds, window_enlargement_); | 670 InsetBottomRight(&bounds, window_enlargement_); |
671 path->addRect(SkRect::MakeXYWH(0, 0, bounds.width(), bounds.height())); | 671 path->addRect(SkRect::MakeXYWH(0, 0, bounds.width(), bounds.height())); |
672 } | 672 } |
673 } | 673 } |
674 | 674 |
675 bool DesktopRootWindowHostWin::GetClientAreaInsets(gfx::Insets* insets) const { | 675 bool DesktopWindowTreeHostWin::GetClientAreaInsets(gfx::Insets* insets) const { |
676 return false; | 676 return false; |
677 } | 677 } |
678 | 678 |
679 void DesktopRootWindowHostWin::GetMinMaxSize(gfx::Size* min_size, | 679 void DesktopWindowTreeHostWin::GetMinMaxSize(gfx::Size* min_size, |
680 gfx::Size* max_size) const { | 680 gfx::Size* max_size) const { |
681 *min_size = native_widget_delegate_->GetMinimumSize(); | 681 *min_size = native_widget_delegate_->GetMinimumSize(); |
682 *max_size = native_widget_delegate_->GetMaximumSize(); | 682 *max_size = native_widget_delegate_->GetMaximumSize(); |
683 } | 683 } |
684 | 684 |
685 gfx::Size DesktopRootWindowHostWin::GetRootViewSize() const { | 685 gfx::Size DesktopWindowTreeHostWin::GetRootViewSize() const { |
686 return GetWidget()->GetRootView()->size(); | 686 return GetWidget()->GetRootView()->size(); |
687 } | 687 } |
688 | 688 |
689 void DesktopRootWindowHostWin::ResetWindowControls() { | 689 void DesktopWindowTreeHostWin::ResetWindowControls() { |
690 GetWidget()->non_client_view()->ResetWindowControls(); | 690 GetWidget()->non_client_view()->ResetWindowControls(); |
691 } | 691 } |
692 | 692 |
693 void DesktopRootWindowHostWin::PaintLayeredWindow(gfx::Canvas* canvas) { | 693 void DesktopWindowTreeHostWin::PaintLayeredWindow(gfx::Canvas* canvas) { |
694 GetWidget()->GetRootView()->Paint(canvas); | 694 GetWidget()->GetRootView()->Paint(canvas); |
695 } | 695 } |
696 | 696 |
697 gfx::NativeViewAccessible DesktopRootWindowHostWin::GetNativeViewAccessible() { | 697 gfx::NativeViewAccessible DesktopWindowTreeHostWin::GetNativeViewAccessible() { |
698 return GetWidget()->GetRootView()->GetNativeViewAccessible(); | 698 return GetWidget()->GetRootView()->GetNativeViewAccessible(); |
699 } | 699 } |
700 | 700 |
701 InputMethod* DesktopRootWindowHostWin::GetInputMethod() { | 701 InputMethod* DesktopWindowTreeHostWin::GetInputMethod() { |
702 return GetWidget()->GetInputMethodDirect(); | 702 return GetWidget()->GetInputMethodDirect(); |
703 } | 703 } |
704 | 704 |
705 bool DesktopRootWindowHostWin::ShouldHandleSystemCommands() const { | 705 bool DesktopWindowTreeHostWin::ShouldHandleSystemCommands() const { |
706 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); | 706 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); |
707 } | 707 } |
708 | 708 |
709 void DesktopRootWindowHostWin::HandleAppDeactivated() { | 709 void DesktopWindowTreeHostWin::HandleAppDeactivated() { |
710 native_widget_delegate_->EnableInactiveRendering(); | 710 native_widget_delegate_->EnableInactiveRendering(); |
711 } | 711 } |
712 | 712 |
713 void DesktopRootWindowHostWin::HandleActivationChanged(bool active) { | 713 void DesktopWindowTreeHostWin::HandleActivationChanged(bool active) { |
714 // This can be invoked from HWNDMessageHandler::Init(), at which point we're | 714 // This can be invoked from HWNDMessageHandler::Init(), at which point we're |
715 // not in a good state and need to ignore it. | 715 // not in a good state and need to ignore it. |
716 if (!delegate_) | 716 if (!delegate_) |
717 return; | 717 return; |
718 | 718 |
719 if (active) | 719 if (active) |
720 delegate_->OnHostActivated(); | 720 delegate_->OnHostActivated(); |
721 desktop_native_widget_aura_->HandleActivationChanged(active); | 721 desktop_native_widget_aura_->HandleActivationChanged(active); |
722 } | 722 } |
723 | 723 |
724 bool DesktopRootWindowHostWin::HandleAppCommand(short command) { | 724 bool DesktopWindowTreeHostWin::HandleAppCommand(short command) { |
725 // We treat APPCOMMAND ids as an extension of our command namespace, and just | 725 // We treat APPCOMMAND ids as an extension of our command namespace, and just |
726 // let the delegate figure out what to do... | 726 // let the delegate figure out what to do... |
727 return GetWidget()->widget_delegate() && | 727 return GetWidget()->widget_delegate() && |
728 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); | 728 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); |
729 } | 729 } |
730 | 730 |
731 void DesktopRootWindowHostWin::HandleCancelMode() { | 731 void DesktopWindowTreeHostWin::HandleCancelMode() { |
732 delegate_->OnHostCancelMode(); | 732 delegate_->OnHostCancelMode(); |
733 } | 733 } |
734 | 734 |
735 void DesktopRootWindowHostWin::HandleCaptureLost() { | 735 void DesktopWindowTreeHostWin::HandleCaptureLost() { |
736 delegate_->OnHostLostWindowCapture(); | 736 delegate_->OnHostLostWindowCapture(); |
737 native_widget_delegate_->OnMouseCaptureLost(); | 737 native_widget_delegate_->OnMouseCaptureLost(); |
738 } | 738 } |
739 | 739 |
740 void DesktopRootWindowHostWin::HandleClose() { | 740 void DesktopWindowTreeHostWin::HandleClose() { |
741 GetWidget()->Close(); | 741 GetWidget()->Close(); |
742 } | 742 } |
743 | 743 |
744 bool DesktopRootWindowHostWin::HandleCommand(int command) { | 744 bool DesktopWindowTreeHostWin::HandleCommand(int command) { |
745 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); | 745 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); |
746 } | 746 } |
747 | 747 |
748 void DesktopRootWindowHostWin::HandleAccelerator( | 748 void DesktopWindowTreeHostWin::HandleAccelerator( |
749 const ui::Accelerator& accelerator) { | 749 const ui::Accelerator& accelerator) { |
750 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator); | 750 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator); |
751 } | 751 } |
752 | 752 |
753 void DesktopRootWindowHostWin::HandleCreate() { | 753 void DesktopWindowTreeHostWin::HandleCreate() { |
754 // TODO(beng): moar | 754 // TODO(beng): moar |
755 NOTIMPLEMENTED(); | 755 NOTIMPLEMENTED(); |
756 | 756 |
757 native_widget_delegate_->OnNativeWidgetCreated(true); | 757 native_widget_delegate_->OnNativeWidgetCreated(true); |
758 | 758 |
759 // 1. Window property association | 759 // 1. Window property association |
760 // 2. MouseWheel. | 760 // 2. MouseWheel. |
761 } | 761 } |
762 | 762 |
763 void DesktopRootWindowHostWin::HandleDestroying() { | 763 void DesktopWindowTreeHostWin::HandleDestroying() { |
764 drag_drop_client_->OnNativeWidgetDestroying(GetHWND()); | 764 drag_drop_client_->OnNativeWidgetDestroying(GetHWND()); |
765 native_widget_delegate_->OnNativeWidgetDestroying(); | 765 native_widget_delegate_->OnNativeWidgetDestroying(); |
766 } | 766 } |
767 | 767 |
768 void DesktopRootWindowHostWin::HandleDestroyed() { | 768 void DesktopWindowTreeHostWin::HandleDestroyed() { |
769 desktop_native_widget_aura_->OnHostClosed(); | 769 desktop_native_widget_aura_->OnHostClosed(); |
770 } | 770 } |
771 | 771 |
772 bool DesktopRootWindowHostWin::HandleInitialFocus() { | 772 bool DesktopWindowTreeHostWin::HandleInitialFocus() { |
773 return GetWidget()->SetInitialFocus(); | 773 return GetWidget()->SetInitialFocus(); |
774 } | 774 } |
775 | 775 |
776 void DesktopRootWindowHostWin::HandleDisplayChange() { | 776 void DesktopWindowTreeHostWin::HandleDisplayChange() { |
777 GetWidget()->widget_delegate()->OnDisplayChanged(); | 777 GetWidget()->widget_delegate()->OnDisplayChanged(); |
778 } | 778 } |
779 | 779 |
780 void DesktopRootWindowHostWin::HandleBeginWMSizeMove() { | 780 void DesktopWindowTreeHostWin::HandleBeginWMSizeMove() { |
781 native_widget_delegate_->OnNativeWidgetBeginUserBoundsChange(); | 781 native_widget_delegate_->OnNativeWidgetBeginUserBoundsChange(); |
782 } | 782 } |
783 | 783 |
784 void DesktopRootWindowHostWin::HandleEndWMSizeMove() { | 784 void DesktopWindowTreeHostWin::HandleEndWMSizeMove() { |
785 native_widget_delegate_->OnNativeWidgetEndUserBoundsChange(); | 785 native_widget_delegate_->OnNativeWidgetEndUserBoundsChange(); |
786 } | 786 } |
787 | 787 |
788 void DesktopRootWindowHostWin::HandleMove() { | 788 void DesktopWindowTreeHostWin::HandleMove() { |
789 native_widget_delegate_->OnNativeWidgetMove(); | 789 native_widget_delegate_->OnNativeWidgetMove(); |
790 if (delegate_) | 790 if (delegate_) |
791 delegate_->OnHostMoved(GetBounds().origin()); | 791 delegate_->OnHostMoved(GetBounds().origin()); |
792 } | 792 } |
793 | 793 |
794 void DesktopRootWindowHostWin::HandleWorkAreaChanged() { | 794 void DesktopWindowTreeHostWin::HandleWorkAreaChanged() { |
795 GetWidget()->widget_delegate()->OnWorkAreaChanged(); | 795 GetWidget()->widget_delegate()->OnWorkAreaChanged(); |
796 } | 796 } |
797 | 797 |
798 void DesktopRootWindowHostWin::HandleVisibilityChanging(bool visible) { | 798 void DesktopWindowTreeHostWin::HandleVisibilityChanging(bool visible) { |
799 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); | 799 native_widget_delegate_->OnNativeWidgetVisibilityChanging(visible); |
800 } | 800 } |
801 | 801 |
802 void DesktopRootWindowHostWin::HandleVisibilityChanged(bool visible) { | 802 void DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) { |
803 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); | 803 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); |
804 } | 804 } |
805 | 805 |
806 void DesktopRootWindowHostWin::HandleClientSizeChanged( | 806 void DesktopWindowTreeHostWin::HandleClientSizeChanged( |
807 const gfx::Size& new_size) { | 807 const gfx::Size& new_size) { |
808 if (delegate_) | 808 if (delegate_) |
809 NotifyHostResized(new_size); | 809 NotifyHostResized(new_size); |
810 } | 810 } |
811 | 811 |
812 void DesktopRootWindowHostWin::HandleFrameChanged() { | 812 void DesktopWindowTreeHostWin::HandleFrameChanged() { |
813 SetWindowTransparency(); | 813 SetWindowTransparency(); |
814 // Replace the frame and layout the contents. | 814 // Replace the frame and layout the contents. |
815 GetWidget()->non_client_view()->UpdateFrame(); | 815 GetWidget()->non_client_view()->UpdateFrame(); |
816 } | 816 } |
817 | 817 |
818 void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { | 818 void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { |
819 // TODO(beng): inform the native_widget_delegate_. | 819 // TODO(beng): inform the native_widget_delegate_. |
820 InputMethod* input_method = GetInputMethod(); | 820 InputMethod* input_method = GetInputMethod(); |
821 if (input_method) | 821 if (input_method) |
822 input_method->OnFocus(); | 822 input_method->OnFocus(); |
823 } | 823 } |
824 | 824 |
825 void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { | 825 void DesktopWindowTreeHostWin::HandleNativeBlur(HWND focused_window) { |
826 // TODO(beng): inform the native_widget_delegate_. | 826 // TODO(beng): inform the native_widget_delegate_. |
827 InputMethod* input_method = GetInputMethod(); | 827 InputMethod* input_method = GetInputMethod(); |
828 if (input_method) | 828 if (input_method) |
829 input_method->OnBlur(); | 829 input_method->OnBlur(); |
830 } | 830 } |
831 | 831 |
832 bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) { | 832 bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) { |
833 if (base::win::IsTSFAwareRequired() && event.IsAnyButton()) | 833 if (base::win::IsTSFAwareRequired() && event.IsAnyButton()) |
834 ui::TSFBridge::GetInstance()->CancelComposition(); | 834 ui::TSFBridge::GetInstance()->CancelComposition(); |
835 return delegate_->OnHostMouseEvent(const_cast<ui::MouseEvent*>(&event)); | 835 return delegate_->OnHostMouseEvent(const_cast<ui::MouseEvent*>(&event)); |
836 } | 836 } |
837 | 837 |
838 bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) { | 838 bool DesktopWindowTreeHostWin::HandleKeyEvent(const ui::KeyEvent& event) { |
839 return false; | 839 return false; |
840 } | 840 } |
841 | 841 |
842 bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent( | 842 bool DesktopWindowTreeHostWin::HandleUntranslatedKeyEvent( |
843 const ui::KeyEvent& event) { | 843 const ui::KeyEvent& event) { |
844 ui::KeyEvent duplicate_event(event); | 844 ui::KeyEvent duplicate_event(event); |
845 return delegate_->OnHostKeyEvent(&duplicate_event); | 845 return delegate_->OnHostKeyEvent(&duplicate_event); |
846 } | 846 } |
847 | 847 |
848 void DesktopRootWindowHostWin::HandleTouchEvent( | 848 void DesktopWindowTreeHostWin::HandleTouchEvent( |
849 const ui::TouchEvent& event) { | 849 const ui::TouchEvent& event) { |
850 // HWNDMessageHandler asynchronously processes touch events. Because of this | 850 // HWNDMessageHandler asynchronously processes touch events. Because of this |
851 // it's possible for the aura::RootWindow to have been destroyed by the time | 851 // it's possible for the aura::RootWindow to have been destroyed by the time |
852 // we attempt to process them. | 852 // we attempt to process them. |
853 if (!GetWidget()->GetNativeView()) | 853 if (!GetWidget()->GetNativeView()) |
854 return; | 854 return; |
855 | 855 |
856 // Currently we assume the window that has capture gets touch events too. | 856 // Currently we assume the window that has capture gets touch events too. |
857 aura::RootWindow* root = | 857 aura::RootWindow* root = |
858 aura::RootWindow::GetForAcceleratedWidget(GetCapture()); | 858 aura::RootWindow::GetForAcceleratedWidget(GetCapture()); |
859 if (root) { | 859 if (root) { |
860 DesktopRootWindowHostWin* target = | 860 DesktopWindowTreeHostWin* target = |
861 root->window()->GetProperty(kDesktopRootWindowHostKey); | 861 root->window()->GetProperty(kDesktopWindowTreeHostKey); |
862 if (target && target->HasCapture() && target != this) { | 862 if (target && target->HasCapture() && target != this) { |
863 POINT target_location(event.location().ToPOINT()); | 863 POINT target_location(event.location().ToPOINT()); |
864 ClientToScreen(GetHWND(), &target_location); | 864 ClientToScreen(GetHWND(), &target_location); |
865 ScreenToClient(target->GetHWND(), &target_location); | 865 ScreenToClient(target->GetHWND(), &target_location); |
866 ui::TouchEvent target_event(event, static_cast<View*>(NULL), | 866 ui::TouchEvent target_event(event, static_cast<View*>(NULL), |
867 static_cast<View*>(NULL)); | 867 static_cast<View*>(NULL)); |
868 target_event.set_location(gfx::Point(target_location)); | 868 target_event.set_location(gfx::Point(target_location)); |
869 target_event.set_root_location(target_event.location()); | 869 target_event.set_root_location(target_event.location()); |
870 target->delegate_->OnHostTouchEvent(&target_event); | 870 target->delegate_->OnHostTouchEvent(&target_event); |
871 return; | 871 return; |
872 } | 872 } |
873 } | 873 } |
874 delegate_->OnHostTouchEvent( | 874 delegate_->OnHostTouchEvent( |
875 const_cast<ui::TouchEvent*>(&event)); | 875 const_cast<ui::TouchEvent*>(&event)); |
876 } | 876 } |
877 | 877 |
878 bool DesktopRootWindowHostWin::HandleIMEMessage(UINT message, | 878 bool DesktopWindowTreeHostWin::HandleIMEMessage(UINT message, |
879 WPARAM w_param, | 879 WPARAM w_param, |
880 LPARAM l_param, | 880 LPARAM l_param, |
881 LRESULT* result) { | 881 LRESULT* result) { |
882 MSG msg = {}; | 882 MSG msg = {}; |
883 msg.hwnd = GetHWND(); | 883 msg.hwnd = GetHWND(); |
884 msg.message = message; | 884 msg.message = message; |
885 msg.wParam = w_param; | 885 msg.wParam = w_param; |
886 msg.lParam = l_param; | 886 msg.lParam = l_param; |
887 return desktop_native_widget_aura_->input_method_event_filter()-> | 887 return desktop_native_widget_aura_->input_method_event_filter()-> |
888 input_method()->OnUntranslatedIMEMessage(msg, result); | 888 input_method()->OnUntranslatedIMEMessage(msg, result); |
889 } | 889 } |
890 | 890 |
891 void DesktopRootWindowHostWin::HandleInputLanguageChange( | 891 void DesktopWindowTreeHostWin::HandleInputLanguageChange( |
892 DWORD character_set, | 892 DWORD character_set, |
893 HKL input_language_id) { | 893 HKL input_language_id) { |
894 desktop_native_widget_aura_->input_method_event_filter()-> | 894 desktop_native_widget_aura_->input_method_event_filter()-> |
895 input_method()->OnInputLocaleChanged(); | 895 input_method()->OnInputLocaleChanged(); |
896 } | 896 } |
897 | 897 |
898 bool DesktopRootWindowHostWin::HandlePaintAccelerated( | 898 bool DesktopWindowTreeHostWin::HandlePaintAccelerated( |
899 const gfx::Rect& invalid_rect) { | 899 const gfx::Rect& invalid_rect) { |
900 return native_widget_delegate_->OnNativeWidgetPaintAccelerated(invalid_rect); | 900 return native_widget_delegate_->OnNativeWidgetPaintAccelerated(invalid_rect); |
901 } | 901 } |
902 | 902 |
903 void DesktopRootWindowHostWin::HandlePaint(gfx::Canvas* canvas) { | 903 void DesktopWindowTreeHostWin::HandlePaint(gfx::Canvas* canvas) { |
904 compositor()->ScheduleRedrawRect(gfx::Rect()); | 904 compositor()->ScheduleRedrawRect(gfx::Rect()); |
905 } | 905 } |
906 | 906 |
907 bool DesktopRootWindowHostWin::HandleTooltipNotify(int w_param, | 907 bool DesktopWindowTreeHostWin::HandleTooltipNotify(int w_param, |
908 NMHDR* l_param, | 908 NMHDR* l_param, |
909 LRESULT* l_result) { | 909 LRESULT* l_result) { |
910 return tooltip_ && tooltip_->HandleNotify(w_param, l_param, l_result); | 910 return tooltip_ && tooltip_->HandleNotify(w_param, l_param, l_result); |
911 } | 911 } |
912 | 912 |
913 void DesktopRootWindowHostWin::HandleTooltipMouseMove(UINT message, | 913 void DesktopWindowTreeHostWin::HandleTooltipMouseMove(UINT message, |
914 WPARAM w_param, | 914 WPARAM w_param, |
915 LPARAM l_param) { | 915 LPARAM l_param) { |
916 // TooltipWin implementation doesn't need this. | 916 // TooltipWin implementation doesn't need this. |
917 // TODO(sky): remove from HWNDMessageHandler once non-aura path nuked. | 917 // TODO(sky): remove from HWNDMessageHandler once non-aura path nuked. |
918 } | 918 } |
919 | 919 |
920 bool DesktopRootWindowHostWin::PreHandleMSG(UINT message, | 920 bool DesktopWindowTreeHostWin::PreHandleMSG(UINT message, |
921 WPARAM w_param, | 921 WPARAM w_param, |
922 LPARAM l_param, | 922 LPARAM l_param, |
923 LRESULT* result) { | 923 LRESULT* result) { |
924 return false; | 924 return false; |
925 } | 925 } |
926 | 926 |
927 void DesktopRootWindowHostWin::PostHandleMSG(UINT message, | 927 void DesktopWindowTreeHostWin::PostHandleMSG(UINT message, |
928 WPARAM w_param, | 928 WPARAM w_param, |
929 LPARAM l_param) { | 929 LPARAM l_param) { |
930 } | 930 } |
931 | 931 |
932 //////////////////////////////////////////////////////////////////////////////// | 932 //////////////////////////////////////////////////////////////////////////////// |
933 // DesktopRootWindowHostWin, private: | 933 // DesktopWindowTreeHostWin, private: |
934 | 934 |
935 Widget* DesktopRootWindowHostWin::GetWidget() { | 935 Widget* DesktopWindowTreeHostWin::GetWidget() { |
936 return native_widget_delegate_->AsWidget(); | 936 return native_widget_delegate_->AsWidget(); |
937 } | 937 } |
938 | 938 |
939 const Widget* DesktopRootWindowHostWin::GetWidget() const { | 939 const Widget* DesktopWindowTreeHostWin::GetWidget() const { |
940 return native_widget_delegate_->AsWidget(); | 940 return native_widget_delegate_->AsWidget(); |
941 } | 941 } |
942 | 942 |
943 HWND DesktopRootWindowHostWin::GetHWND() const { | 943 HWND DesktopWindowTreeHostWin::GetHWND() const { |
944 return message_handler_->hwnd(); | 944 return message_handler_->hwnd(); |
945 } | 945 } |
946 | 946 |
947 void DesktopRootWindowHostWin::SetWindowTransparency() { | 947 void DesktopWindowTreeHostWin::SetWindowTransparency() { |
948 bool transparent = ShouldUseNativeFrame() && !IsFullscreen(); | 948 bool transparent = ShouldUseNativeFrame() && !IsFullscreen(); |
949 root_window_->host()->compositor()->SetHostHasTransparentBackground( | 949 root_window_->host()->compositor()->SetHostHasTransparentBackground( |
950 transparent); | 950 transparent); |
951 root_window_->window()->SetTransparent(transparent); | 951 root_window_->window()->SetTransparent(transparent); |
952 content_window_->SetTransparent(transparent); | 952 content_window_->SetTransparent(transparent); |
953 } | 953 } |
954 | 954 |
955 bool DesktopRootWindowHostWin::IsModalWindowActive() const { | 955 bool DesktopWindowTreeHostWin::IsModalWindowActive() const { |
956 // This function can get called during window creation which occurs before | 956 // This function can get called during window creation which occurs before |
957 // root_window_ has been created. | 957 // root_window_ has been created. |
958 if (!root_window_) | 958 if (!root_window_) |
959 return false; | 959 return false; |
960 | 960 |
961 aura::Window::Windows::const_iterator index; | 961 aura::Window::Windows::const_iterator index; |
962 for (index = root_window_->window()->children().begin(); | 962 for (index = root_window_->window()->children().begin(); |
963 index != root_window_->window()->children().end(); | 963 index != root_window_->window()->children().end(); |
964 ++index) { | 964 ++index) { |
965 if ((*index)->GetProperty(aura::client::kModalKey) != | 965 if ((*index)->GetProperty(aura::client::kModalKey) != |
966 ui:: MODAL_TYPE_NONE && (*index)->TargetVisibility()) | 966 ui:: MODAL_TYPE_NONE && (*index)->TargetVisibility()) |
967 return true; | 967 return true; |
968 } | 968 } |
969 return false; | 969 return false; |
970 } | 970 } |
971 | 971 |
972 //////////////////////////////////////////////////////////////////////////////// | 972 //////////////////////////////////////////////////////////////////////////////// |
973 // DesktopRootWindowHost, public: | 973 // DesktopWindowTreeHost, public: |
974 | 974 |
975 // static | 975 // static |
976 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 976 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
977 internal::NativeWidgetDelegate* native_widget_delegate, | 977 internal::NativeWidgetDelegate* native_widget_delegate, |
978 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 978 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
979 return new DesktopRootWindowHostWin(native_widget_delegate, | 979 return new DesktopWindowTreeHostWin(native_widget_delegate, |
980 desktop_native_widget_aura); | 980 desktop_native_widget_aura); |
981 } | 981 } |
982 | 982 |
983 } // namespace views | 983 } // namespace views |
OLD | NEW |