OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/examples/content_client/examples_browser_main_parts.h" | 5 #include "ui/views/examples/content_client/examples_browser_main_parts.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "content/shell/browser/shell_browser_context.h" | 15 #include "content/shell/browser/shell_browser_context.h" |
16 #include "ui/base/ime/input_method_initializer.h" | 16 #include "ui/base/ime/input_method_initializer.h" |
17 #include "ui/views/examples/examples_window_with_content.h" | 17 #include "ui/views/examples/examples_window_with_content.h" |
18 #include "ui/views/focus/accelerator_handler.h" | 18 #include "ui/views/focus/accelerator_handler.h" |
19 #include "ui/views/test/desktop_test_views_delegate.h" | 19 #include "ui/views/test/desktop_test_views_delegate.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 #if defined(USE_AURA) | 22 #if defined(USE_AURA) |
23 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
24 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
| 25 #include "ui/views/corewm/wm_state.h" |
25 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 26 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
26 #include "ui/views/widget/native_widget_aura.h" | 27 #include "ui/views/widget/native_widget_aura.h" |
27 #endif | 28 #endif |
28 | 29 |
29 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
30 #include "ui/aura/root_window.h" | 31 #include "ui/aura/root_window.h" |
31 #include "ui/aura/test/test_screen.h" | 32 #include "ui/aura/test/test_screen.h" |
32 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
33 #include "ui/wm/test/wm_test_helper.h" | 34 #include "ui/wm/test/wm_test_helper.h" |
34 #endif | 35 #endif |
35 | 36 |
36 namespace views { | 37 namespace views { |
37 namespace examples { | 38 namespace examples { |
38 | 39 |
39 ExamplesBrowserMainParts::ExamplesBrowserMainParts( | 40 ExamplesBrowserMainParts::ExamplesBrowserMainParts( |
40 const content::MainFunctionParams& parameters) { | 41 const content::MainFunctionParams& parameters) { |
41 } | 42 } |
42 | 43 |
43 ExamplesBrowserMainParts::~ExamplesBrowserMainParts() { | 44 ExamplesBrowserMainParts::~ExamplesBrowserMainParts() { |
44 } | 45 } |
45 | 46 |
| 47 void ExamplesBrowserMainParts::ToolkitInitialized() { |
| 48 #if defined(USE_AURA) |
| 49 wm_state_.reset(new views::corewm::WMState); |
| 50 #endif |
| 51 } |
| 52 |
46 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { | 53 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { |
47 ui::InitializeInputMethodForTesting(); | 54 ui::InitializeInputMethodForTesting(); |
48 browser_context_.reset(new content::ShellBrowserContext(false, NULL)); | 55 browser_context_.reset(new content::ShellBrowserContext(false, NULL)); |
49 | 56 |
50 gfx::NativeView window_context = NULL; | 57 gfx::NativeView window_context = NULL; |
51 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
52 gfx::Screen::SetScreenInstance( | 59 gfx::Screen::SetScreenInstance( |
53 gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create()); | 60 gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create()); |
54 // Set up basic pieces of views::corewm. | 61 // Set up basic pieces of views::corewm. |
55 wm_test_helper_.reset(new wm::WMTestHelper(gfx::Size(800, 600))); | 62 wm_test_helper_.reset(new wm::WMTestHelper(gfx::Size(800, 600))); |
(...skipping 30 matching lines...) Expand all Loading... |
86 base::RunLoop run_loop(&accelerator_handler); | 93 base::RunLoop run_loop(&accelerator_handler); |
87 #else | 94 #else |
88 base::RunLoop run_loop; | 95 base::RunLoop run_loop; |
89 #endif | 96 #endif |
90 run_loop.Run(); | 97 run_loop.Run(); |
91 return true; | 98 return true; |
92 } | 99 } |
93 | 100 |
94 } // namespace examples | 101 } // namespace examples |
95 } // namespace views | 102 } // namespace views |
OLD | NEW |