| 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/transient_window_stacking_client.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 // SetWindowStackingClient() takes ownership of TransientWindowStackingClient. |
| 50 aura::client::SetWindowStackingClient( |
| 51 new corewm::TransientWindowStackingClient); |
| 52 #endif |
| 53 } |
| 54 |
| 46 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { | 55 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { |
| 47 ui::InitializeInputMethodForTesting(); | 56 ui::InitializeInputMethodForTesting(); |
| 48 browser_context_.reset(new content::ShellBrowserContext(false, NULL)); | 57 browser_context_.reset(new content::ShellBrowserContext(false, NULL)); |
| 49 | 58 |
| 50 gfx::NativeView window_context = NULL; | 59 gfx::NativeView window_context = NULL; |
| 51 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 52 gfx::Screen::SetScreenInstance( | 61 gfx::Screen::SetScreenInstance( |
| 53 gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create()); | 62 gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create()); |
| 54 // Set up basic pieces of views::corewm. | 63 // Set up basic pieces of views::corewm. |
| 55 wm_test_helper_.reset(new wm::WMTestHelper(gfx::Size(800, 600))); | 64 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); | 95 base::RunLoop run_loop(&accelerator_handler); |
| 87 #else | 96 #else |
| 88 base::RunLoop run_loop; | 97 base::RunLoop run_loop; |
| 89 #endif | 98 #endif |
| 90 run_loop.Run(); | 99 run_loop.Run(); |
| 91 return true; | 100 return true; |
| 92 } | 101 } |
| 93 | 102 |
| 94 } // namespace examples | 103 } // namespace examples |
| 95 } // namespace views | 104 } // namespace views |
| OLD | NEW |