Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_root_window_host_win.cc

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

Powered by Google App Engine
This is Rietveld 408576698