| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 WindowTreeHost* WindowTreeHost::GetForAcceleratedWidget( | 56 WindowTreeHost* WindowTreeHost::GetForAcceleratedWidget( |
| 57 gfx::AcceleratedWidget widget) { | 57 gfx::AcceleratedWidget widget) { |
| 58 return reinterpret_cast<WindowTreeHost*>( | 58 return reinterpret_cast<WindowTreeHost*>( |
| 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(); | |
| 67 } | 66 } |
| 68 | 67 |
| 69 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { | 68 void WindowTreeHost::AddObserver(WindowTreeHostObserver* observer) { |
| 70 observers_.AddObserver(observer); | 69 observers_.AddObserver(observer); |
| 71 } | 70 } |
| 72 | 71 |
| 73 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { | 72 void WindowTreeHost::RemoveObserver(WindowTreeHostObserver* observer) { |
| 74 observers_.RemoveObserver(observer); | 73 observers_.RemoveObserver(observer); |
| 75 } | 74 } |
| 76 | 75 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return SendEventToProcessor(event); | 199 return SendEventToProcessor(event); |
| 201 } | 200 } |
| 202 | 201 |
| 203 void WindowTreeHost::Show() { | 202 void WindowTreeHost::Show() { |
| 204 // Ensure that compositor has been properly initialized, see InitCompositor() | 203 // Ensure that compositor has been properly initialized, see InitCompositor() |
| 205 // and InitHost(). | 204 // and InitHost(). |
| 206 DCHECK(compositor()); | 205 DCHECK(compositor()); |
| 207 DCHECK_EQ(compositor()->root_layer(), window()->layer()); | 206 DCHECK_EQ(compositor()->root_layer(), window()->layer()); |
| 208 compositor()->SetVisible(true); | 207 compositor()->SetVisible(true); |
| 209 ShowImpl(); | 208 ShowImpl(); |
| 209 window()->Show(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void WindowTreeHost::Hide() { | 212 void WindowTreeHost::Hide() { |
| 213 HideImpl(); | 213 HideImpl(); |
| 214 if (compositor()) | 214 if (compositor()) |
| 215 compositor()->SetVisible(false); | 215 compositor()->SetVisible(false); |
| 216 } | 216 } |
| 217 | 217 |
| 218 //////////////////////////////////////////////////////////////////////////////// | 218 //////////////////////////////////////////////////////////////////////////////// |
| 219 // WindowTreeHost, protected: | 219 // WindowTreeHost, protected: |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 342 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
| 343 if (cursor_client) { | 343 if (cursor_client) { |
| 344 const display::Display& display = | 344 const display::Display& display = |
| 345 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 345 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); |
| 346 cursor_client->SetDisplay(display); | 346 cursor_client->SetDisplay(display); |
| 347 } | 347 } |
| 348 dispatcher()->OnCursorMovedToRootLocation(root_location); | 348 dispatcher()->OnCursorMovedToRootLocation(root_location); |
| 349 } | 349 } |
| 350 | 350 |
| 351 } // namespace aura | 351 } // namespace aura |
| OLD | NEW |