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/browser/context_factory.h" |
14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
15 #include "content/shell/browser/shell_browser_context.h" | 16 #include "content/shell/browser/shell_browser_context.h" |
16 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
17 #include "ui/base/ime/input_method_initializer.h" | 18 #include "ui/base/ime/input_method_initializer.h" |
18 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
19 #include "ui/views/examples/examples_window_with_content.h" | 20 #include "ui/views/examples/examples_window_with_content.h" |
20 #include "ui/views/test/desktop_test_views_delegate.h" | 21 #include "ui/views/test/desktop_test_views_delegate.h" |
21 #include "ui/views/widget/native_widget_aura.h" | 22 #include "ui/views/widget/native_widget_aura.h" |
22 #include "ui/wm/core/wm_state.h" | 23 #include "ui/wm/core/wm_state.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
(...skipping 23 matching lines...) Expand all Loading... |
47 | 48 |
48 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { | 49 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { |
49 ui::InitializeInputMethodForTesting(); | 50 ui::InitializeInputMethodForTesting(); |
50 browser_context_.reset(new content::ShellBrowserContext(false, NULL)); | 51 browser_context_.reset(new content::ShellBrowserContext(false, NULL)); |
51 | 52 |
52 gfx::NativeView window_context = NULL; | 53 gfx::NativeView window_context = NULL; |
53 #if defined(OS_CHROMEOS) | 54 #if defined(OS_CHROMEOS) |
54 gfx::Screen::SetScreenInstance( | 55 gfx::Screen::SetScreenInstance( |
55 gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create()); | 56 gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create()); |
56 // Set up basic pieces of views::corewm. | 57 // Set up basic pieces of views::corewm. |
57 wm_test_helper_.reset(new wm::WMTestHelper(gfx::Size(800, 600))); | 58 wm_test_helper_.reset(new wm::WMTestHelper(gfx::Size(800, 600), |
| 59 content::GetContextFactory())); |
58 // Ensure the X window gets mapped. | 60 // Ensure the X window gets mapped. |
59 wm_test_helper_->host()->Show(); | 61 wm_test_helper_->host()->Show(); |
60 // Ensure Aura knows where to open new windows. | 62 // Ensure Aura knows where to open new windows. |
61 window_context = wm_test_helper_->host()->window(); | 63 window_context = wm_test_helper_->host()->window(); |
62 #else | 64 #else |
63 aura::Env::CreateInstance(true); | 65 aura::Env::CreateInstance(true); |
64 gfx::Screen::SetScreenInstance( | 66 gfx::Screen::SetScreenInstance( |
65 gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen()); | 67 gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen()); |
66 #endif | 68 #endif |
67 views_delegate_.reset(new DesktopTestViewsDelegate); | 69 views_delegate_.reset(new DesktopTestViewsDelegate); |
(...skipping 12 matching lines...) Expand all Loading... |
80 } | 82 } |
81 | 83 |
82 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { | 84 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { |
83 base::RunLoop run_loop; | 85 base::RunLoop run_loop; |
84 run_loop.Run(); | 86 run_loop.Run(); |
85 return true; | 87 return true; |
86 } | 88 } |
87 | 89 |
88 } // namespace examples | 90 } // namespace examples |
89 } // namespace views | 91 } // namespace views |
OLD | NEW |