| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "ui/aura/client/capture_client.h" | 8 #include "ui/aura/client/capture_client.h" |
| 9 #include "ui/aura/client/cursor_client.h" | 9 #include "ui/aura/client/cursor_client.h" |
| 10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 //////////////////////////////////////////////////////////////////////////////// | 38 //////////////////////////////////////////////////////////////////////////////// |
| 39 // WindowTreeHost, public: | 39 // WindowTreeHost, public: |
| 40 | 40 |
| 41 WindowTreeHost::~WindowTreeHost() { | 41 WindowTreeHost::~WindowTreeHost() { |
| 42 DCHECK(!compositor_) << "compositor must be destroyed before root window"; | 42 DCHECK(!compositor_) << "compositor must be destroyed before root window"; |
| 43 } | 43 } |
| 44 | 44 |
| 45 #if defined(OS_ANDROID) | 45 #if defined(OS_ANDROID) |
| 46 // static | 46 // static |
| 47 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { | 47 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds, |
| 48 ui::ContextFactory* context_factory) { |
| 48 // This is only hit for tests and ash, right now these aren't an issue so | 49 // This is only hit for tests and ash, right now these aren't an issue so |
| 49 // adding the CHECK. | 50 // adding the CHECK. |
| 50 // TODO(sky): decide if we want a factory. | 51 // TODO(sky): decide if we want a factory. |
| 51 CHECK(false); | 52 CHECK(false); |
| 52 return NULL; | 53 return NULL; |
| 53 } | 54 } |
| 54 #endif | 55 #endif |
| 55 | 56 |
| 56 // static | 57 // static |
| 57 WindowTreeHost* WindowTreeHost::GetForAcceleratedWidget( | 58 WindowTreeHost* WindowTreeHost::GetForAcceleratedWidget( |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // isn't called from WED, and WED isn't a subclass of Window. So it seems | 191 // isn't called from WED, and WED isn't a subclass of Window. So it seems |
| 191 // like we could just rely on ~Window now. | 192 // like we could just rely on ~Window now. |
| 192 // Destroy child windows while we're still valid. This is also done by | 193 // Destroy child windows while we're still valid. This is also done by |
| 193 // ~Window, but by that time any calls to virtual methods overriden here (such | 194 // ~Window, but by that time any calls to virtual methods overriden here (such |
| 194 // as GetRootWindow()) result in Window's implementation. By destroying here | 195 // as GetRootWindow()) result in Window's implementation. By destroying here |
| 195 // we ensure GetRootWindow() still returns this. | 196 // we ensure GetRootWindow() still returns this. |
| 196 //window()->RemoveOrDestroyChildren(); | 197 //window()->RemoveOrDestroyChildren(); |
| 197 } | 198 } |
| 198 | 199 |
| 199 void WindowTreeHost::CreateCompositor( | 200 void WindowTreeHost::CreateCompositor( |
| 200 gfx::AcceleratedWidget accelerated_widget) { | 201 gfx::AcceleratedWidget accelerated_widget, |
| 201 compositor_.reset(new ui::Compositor(GetAcceleratedWidget())); | 202 ui::ContextFactory* context_factory) { |
| 203 compositor_.reset( |
| 204 new ui::Compositor(GetAcceleratedWidget(), context_factory)); |
| 202 DCHECK(compositor_.get()); | 205 DCHECK(compositor_.get()); |
| 203 // TODO(beng): I think this setup should probably all move to a "accelerated | 206 // TODO(beng): I think this setup should probably all move to a "accelerated |
| 204 // widget available" function. | 207 // widget available" function. |
| 205 if (!dispatcher()) { | 208 if (!dispatcher()) { |
| 206 window()->Init(WINDOW_LAYER_NOT_DRAWN); | 209 window()->Init(WINDOW_LAYER_NOT_DRAWN); |
| 207 window()->set_host(this); | 210 window()->set_host(this); |
| 208 window()->SetName("RootWindow"); | 211 window()->SetName("RootWindow"); |
| 209 window()->SetEventTargeter( | 212 window()->SetEventTargeter( |
| 210 scoped_ptr<ui::EventTargeter>(new WindowTargeter())); | 213 scoped_ptr<ui::EventTargeter>(new WindowTargeter())); |
| 211 prop_.reset(new ui::ViewProp(GetAcceleratedWidget(), | 214 prop_.reset(new ui::ViewProp(GetAcceleratedWidget(), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 264 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
| 262 if (cursor_client) { | 265 if (cursor_client) { |
| 263 const gfx::Display& display = | 266 const gfx::Display& display = |
| 264 gfx::Screen::GetScreenFor(window())->GetDisplayNearestWindow(window()); | 267 gfx::Screen::GetScreenFor(window())->GetDisplayNearestWindow(window()); |
| 265 cursor_client->SetDisplay(display); | 268 cursor_client->SetDisplay(display); |
| 266 } | 269 } |
| 267 dispatcher()->OnCursorMovedToRootLocation(root_location); | 270 dispatcher()->OnCursorMovedToRootLocation(root_location); |
| 268 } | 271 } |
| 269 | 272 |
| 270 } // namespace aura | 273 } // namespace aura |
| OLD | NEW |