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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // like we could just rely on ~Window now. | 191 // like we could just rely on ~Window now. |
192 // Destroy child windows while we're still valid. This is also done by | 192 // 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 | 193 // ~Window, but by that time any calls to virtual methods overriden here (such |
194 // as GetRootWindow()) result in Window's implementation. By destroying here | 194 // as GetRootWindow()) result in Window's implementation. By destroying here |
195 // we ensure GetRootWindow() still returns this. | 195 // we ensure GetRootWindow() still returns this. |
196 //window()->RemoveOrDestroyChildren(); | 196 //window()->RemoveOrDestroyChildren(); |
197 } | 197 } |
198 | 198 |
199 void WindowTreeHost::CreateCompositor( | 199 void WindowTreeHost::CreateCompositor( |
200 gfx::AcceleratedWidget accelerated_widget) { | 200 gfx::AcceleratedWidget accelerated_widget) { |
201 compositor_.reset(new ui::Compositor(GetAcceleratedWidget())); | 201 DCHECK(Env::GetInstance()); |
202 DCHECK(compositor_.get()); | 202 ui::ContextFactory* context_factory = Env::GetInstance()->context_factory(); |
| 203 DCHECK(context_factory); |
| 204 compositor_.reset( |
| 205 new ui::Compositor(GetAcceleratedWidget(), context_factory)); |
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(), |
212 kWindowTreeHostForAcceleratedWidget, | 215 kWindowTreeHostForAcceleratedWidget, |
(...skipping 48 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 |