OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "apps/shell/browser/shell_desktop_controller.h" | 5 #include "apps/shell/browser/shell_desktop_controller.h" |
6 | 6 |
7 #include "apps/shell/browser/shell_app_window.h" | 7 #include "apps/shell/browser/shell_app_window.h" |
| 8 #include "content/public/browser/context_factory.h" |
8 #include "ui/aura/client/cursor_client.h" | 9 #include "ui/aura/client/cursor_client.h" |
9 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
10 #include "ui/aura/layout_manager.h" | 11 #include "ui/aura/layout_manager.h" |
11 #include "ui/aura/test/test_screen.h" | 12 #include "ui/aura/test/test_screen.h" |
12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
13 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
14 #include "ui/aura/window_tree_host.h" | 15 #include "ui/aura/window_tree_host.h" |
15 #include "ui/base/cursor/cursor.h" | 16 #include "ui/base/cursor/cursor.h" |
16 #include "ui/base/cursor/image_cursors.h" | 17 #include "ui/base/cursor/image_cursors.h" |
17 #include "ui/base/ime/input_method_initializer.h" | 18 #include "ui/base/ime/input_method_initializer.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 test_screen_.reset(aura::TestScreen::Create()); | 220 test_screen_.reset(aura::TestScreen::Create()); |
220 // TODO(jamescook): Replace this with a real Screen implementation. | 221 // TODO(jamescook): Replace this with a real Screen implementation. |
221 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 222 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); |
222 // TODO(jamescook): Initialize a real input method. | 223 // TODO(jamescook): Initialize a real input method. |
223 ui::InitializeInputMethodForTesting(); | 224 ui::InitializeInputMethodForTesting(); |
224 | 225 |
225 // Set up basic pieces of ui::wm. | 226 // Set up basic pieces of ui::wm. |
226 gfx::Size size = GetPrimaryDisplaySize(); | 227 gfx::Size size = GetPrimaryDisplaySize(); |
227 if (size.IsEmpty()) | 228 if (size.IsEmpty()) |
228 size = gfx::Size(800, 600); | 229 size = gfx::Size(800, 600); |
229 wm_test_helper_.reset(new wm::WMTestHelper(size)); | 230 wm_test_helper_.reset( |
| 231 new wm::WMTestHelper(size, content::GetContextFactory())); |
230 | 232 |
231 // Ensure new windows fill the display. | 233 // Ensure new windows fill the display. |
232 aura::WindowTreeHost* host = wm_test_helper_->host(); | 234 aura::WindowTreeHost* host = wm_test_helper_->host(); |
233 host->window()->SetLayoutManager(new FillLayout); | 235 host->window()->SetLayoutManager(new FillLayout); |
234 | 236 |
235 // Ensure the X window gets mapped. | 237 // Ensure the X window gets mapped. |
236 host->Show(); | 238 host->Show(); |
237 } | 239 } |
238 | 240 |
239 void ShellDesktopController::DestroyRootWindow() { | 241 void ShellDesktopController::DestroyRootWindow() { |
240 wm_test_helper_.reset(); | 242 wm_test_helper_.reset(); |
241 ui::ShutdownInputMethodForTesting(); | 243 ui::ShutdownInputMethodForTesting(); |
242 } | 244 } |
243 | 245 |
244 gfx::Size ShellDesktopController::GetPrimaryDisplaySize() { | 246 gfx::Size ShellDesktopController::GetPrimaryDisplaySize() { |
245 #if defined(OS_CHROMEOS) | 247 #if defined(OS_CHROMEOS) |
246 const std::vector<ui::DisplayConfigurator::DisplayState>& displays = | 248 const std::vector<ui::DisplayConfigurator::DisplayState>& displays = |
247 display_configurator_->cached_displays(); | 249 display_configurator_->cached_displays(); |
248 if (displays.empty()) | 250 if (displays.empty()) |
249 return gfx::Size(); | 251 return gfx::Size(); |
250 const ui::DisplayMode* mode = displays[0].display->current_mode(); | 252 const ui::DisplayMode* mode = displays[0].display->current_mode(); |
251 return mode ? mode->size() : gfx::Size(); | 253 return mode ? mode->size() : gfx::Size(); |
252 #else | 254 #else |
253 return gfx::Size(); | 255 return gfx::Size(); |
254 #endif | 256 #endif |
255 } | 257 } |
256 | 258 |
257 } // namespace apps | 259 } // namespace apps |
OLD | NEW |