| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/aura/window_tree_host.h" | 5 #include "ui/aura/window_tree_host.h" |
| 6 | 6 |
| 7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/thread_task_runner_handle.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "ui/aura/client/capture_client.h" | 9 #include "ui/aura/client/capture_client.h" |
| 10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 void WindowTreeHost::OnAcceleratedWidgetAvailable() { | 263 void WindowTreeHost::OnAcceleratedWidgetAvailable() { |
| 264 compositor_->SetAcceleratedWidget(GetAcceleratedWidget()); | 264 compositor_->SetAcceleratedWidget(GetAcceleratedWidget()); |
| 265 prop_.reset(new ui::ViewProp(GetAcceleratedWidget(), | 265 prop_.reset(new ui::ViewProp(GetAcceleratedWidget(), |
| 266 kWindowTreeHostForAcceleratedWidget, this)); | 266 kWindowTreeHostForAcceleratedWidget, this)); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void WindowTreeHost::OnHostMoved(const gfx::Point& new_location) { | 269 void WindowTreeHost::OnHostMoved(const gfx::Point& new_location) { |
| 270 TRACE_EVENT1("ui", "WindowTreeHost::OnHostMoved", | 270 TRACE_EVENT1("ui", "WindowTreeHost::OnHostMoved", |
| 271 "origin", new_location.ToString()); | 271 "origin", new_location.ToString()); |
| 272 | 272 |
| 273 FOR_EACH_OBSERVER(WindowTreeHostObserver, observers_, | 273 for (WindowTreeHostObserver& observer : observers_) |
| 274 OnHostMoved(this, new_location)); | 274 observer.OnHostMoved(this, new_location); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void WindowTreeHost::OnHostResized(const gfx::Size& new_size) { | 277 void WindowTreeHost::OnHostResized(const gfx::Size& new_size) { |
| 278 gfx::Size adjusted_size(new_size); | 278 gfx::Size adjusted_size(new_size); |
| 279 adjusted_size.Enlarge(output_surface_padding_.width(), | 279 adjusted_size.Enlarge(output_surface_padding_.width(), |
| 280 output_surface_padding_.height()); | 280 output_surface_padding_.height()); |
| 281 // The compositor should have the same size as the native root window host. | 281 // The compositor should have the same size as the native root window host. |
| 282 // Get the latest scale from display because it might have been changed. | 282 // Get the latest scale from display because it might have been changed. |
| 283 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), | 283 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), |
| 284 adjusted_size); | 284 adjusted_size); |
| 285 | 285 |
| 286 gfx::Size layer_size = GetBounds().size(); | 286 gfx::Size layer_size = GetBounds().size(); |
| 287 // The layer, and the observers should be notified of the | 287 // The layer, and the observers should be notified of the |
| 288 // transformed size of the root window. | 288 // transformed size of the root window. |
| 289 UpdateRootWindowSize(layer_size); | 289 UpdateRootWindowSize(layer_size); |
| 290 FOR_EACH_OBSERVER(WindowTreeHostObserver, observers_, OnHostResized(this)); | 290 for (WindowTreeHostObserver& observer : observers_) |
| 291 observer.OnHostResized(this); |
| 291 } | 292 } |
| 292 | 293 |
| 293 void WindowTreeHost::OnHostWorkspaceChanged() { | 294 void WindowTreeHost::OnHostWorkspaceChanged() { |
| 294 FOR_EACH_OBSERVER(WindowTreeHostObserver, observers_, | 295 for (WindowTreeHostObserver& observer : observers_) |
| 295 OnHostWorkspaceChanged(this)); | 296 observer.OnHostWorkspaceChanged(this); |
| 296 } | 297 } |
| 297 | 298 |
| 298 void WindowTreeHost::OnHostCloseRequested() { | 299 void WindowTreeHost::OnHostCloseRequested() { |
| 299 FOR_EACH_OBSERVER(WindowTreeHostObserver, observers_, | 300 for (WindowTreeHostObserver& observer : observers_) |
| 300 OnHostCloseRequested(this)); | 301 observer.OnHostCloseRequested(this); |
| 301 } | 302 } |
| 302 | 303 |
| 303 void WindowTreeHost::OnHostActivated() { | 304 void WindowTreeHost::OnHostActivated() { |
| 304 Env::GetInstance()->NotifyHostActivated(this); | 305 Env::GetInstance()->NotifyHostActivated(this); |
| 305 } | 306 } |
| 306 | 307 |
| 307 void WindowTreeHost::OnHostLostWindowCapture() { | 308 void WindowTreeHost::OnHostLostWindowCapture() { |
| 308 Window* capture_window = client::GetCaptureWindow(window()); | 309 Window* capture_window = client::GetCaptureWindow(window()); |
| 309 if (capture_window && capture_window->GetRootWindow() == window()) | 310 if (capture_window && capture_window->GetRootWindow() == window()) |
| 310 capture_window->ReleaseCapture(); | 311 capture_window->ReleaseCapture(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 330 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 331 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
| 331 if (cursor_client) { | 332 if (cursor_client) { |
| 332 const display::Display& display = | 333 const display::Display& display = |
| 333 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 334 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); |
| 334 cursor_client->SetDisplay(display); | 335 cursor_client->SetDisplay(display); |
| 335 } | 336 } |
| 336 dispatcher()->OnCursorMovedToRootLocation(root_location); | 337 dispatcher()->OnCursorMovedToRootLocation(root_location); |
| 337 } | 338 } |
| 338 | 339 |
| 339 } // namespace aura | 340 } // namespace aura |
| OLD | NEW |