| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 59       ui::ViewProp::GetValue(widget, kWindowTreeHostForAcceleratedWidget)); | 59       ui::ViewProp::GetValue(widget, kWindowTreeHostForAcceleratedWidget)); | 
| 60 } | 60 } | 
| 61 | 61 | 
| 62 void WindowTreeHost::InitHost() { | 62 void WindowTreeHost::InitHost() { | 
| 63   InitCompositor(); | 63   InitCompositor(); | 
| 64   UpdateRootWindowSizeInPixels(GetBoundsInPixels().size()); | 64   UpdateRootWindowSizeInPixels(GetBoundsInPixels().size()); | 
| 65   Env::GetInstance()->NotifyHostInitialized(this); | 65   Env::GetInstance()->NotifyHostInitialized(this); | 
| 66   window()->Show(); | 66   window()->Show(); | 
| 67 } | 67 } | 
| 68 | 68 | 
| 69 void WindowTreeHost::InitCompositor() { |  | 
| 70   compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), |  | 
| 71                                GetBoundsInPixels().size()); |  | 
| 72   compositor_->SetRootLayer(window()->layer()); |  | 
| 73   compositor_->SetDisplayColorSpace( |  | 
| 74       GetICCProfileForCurrentDisplay().GetColorSpace()); |  | 
| 75 } |  | 
| 76 |  | 
| 77 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { | 69 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { | 
| 78   observers_.AddObserver(observer); | 70   observers_.AddObserver(observer); | 
| 79 } | 71 } | 
| 80 | 72 | 
| 81 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { | 73 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { | 
| 82   observers_.RemoveObserver(observer); | 74   observers_.RemoveObserver(observer); | 
| 83 } | 75 } | 
| 84 | 76 | 
| 85 ui::EventProcessor* WindowTreeHost::event_processor() { | 77 ui::EventProcessor* WindowTreeHost::event_processor() { | 
| 86   return dispatcher(); | 78   return dispatcher(); | 
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 259   if (!dispatcher()) { | 251   if (!dispatcher()) { | 
| 260     window()->Init(ui::LAYER_NOT_DRAWN); | 252     window()->Init(ui::LAYER_NOT_DRAWN); | 
| 261     window()->set_host(this); | 253     window()->set_host(this); | 
| 262     window()->SetName("RootWindow"); | 254     window()->SetName("RootWindow"); | 
| 263     window()->SetEventTargeter( | 255     window()->SetEventTargeter( | 
| 264         std::unique_ptr<ui::EventTargeter>(new WindowTargeter())); | 256         std::unique_ptr<ui::EventTargeter>(new WindowTargeter())); | 
| 265     dispatcher_.reset(new WindowEventDispatcher(this)); | 257     dispatcher_.reset(new WindowEventDispatcher(this)); | 
| 266   } | 258   } | 
| 267 } | 259 } | 
| 268 | 260 | 
|  | 261 void WindowTreeHost::InitCompositor() { | 
|  | 262   compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), | 
|  | 263                                GetBoundsInPixels().size()); | 
|  | 264   compositor_->SetRootLayer(window()->layer()); | 
|  | 265   compositor_->SetDisplayColorSpace( | 
|  | 266       GetICCProfileForCurrentDisplay().GetColorSpace()); | 
|  | 267 } | 
|  | 268 | 
| 269 void WindowTreeHost::OnAcceleratedWidgetAvailable() { | 269 void WindowTreeHost::OnAcceleratedWidgetAvailable() { | 
| 270   compositor_->SetAcceleratedWidget(GetAcceleratedWidget()); | 270   compositor_->SetAcceleratedWidget(GetAcceleratedWidget()); | 
| 271   prop_.reset(new ui::ViewProp(GetAcceleratedWidget(), | 271   prop_.reset(new ui::ViewProp(GetAcceleratedWidget(), | 
| 272                                kWindowTreeHostForAcceleratedWidget, this)); | 272                                kWindowTreeHostForAcceleratedWidget, this)); | 
| 273 } | 273 } | 
| 274 | 274 | 
| 275 void WindowTreeHost::OnHostMovedInPixels( | 275 void WindowTreeHost::OnHostMovedInPixels( | 
| 276     const gfx::Point& new_location_in_pixels) { | 276     const gfx::Point& new_location_in_pixels) { | 
| 277   TRACE_EVENT1("ui", "WindowTreeHost::OnHostMovedInPixels", "origin", | 277   TRACE_EVENT1("ui", "WindowTreeHost::OnHostMovedInPixels", "origin", | 
| 278                new_location_in_pixels.ToString()); | 278                new_location_in_pixels.ToString()); | 
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 339   client::CursorClient* cursor_client = client::GetCursorClient(window()); | 339   client::CursorClient* cursor_client = client::GetCursorClient(window()); | 
| 340   if (cursor_client) { | 340   if (cursor_client) { | 
| 341     const display::Display& display = | 341     const display::Display& display = | 
| 342         display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 342         display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 
| 343     cursor_client->SetDisplay(display); | 343     cursor_client->SetDisplay(display); | 
| 344   } | 344   } | 
| 345   dispatcher()->OnCursorMovedToRootLocation(root_location); | 345   dispatcher()->OnCursorMovedToRootLocation(root_location); | 
| 346 } | 346 } | 
| 347 | 347 | 
| 348 }  // namespace aura | 348 }  // namespace aura | 
| OLD | NEW | 
|---|