Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/power_monitor/power_monitor.h" | 14 #include "base/power_monitor/power_monitor.h" |
| 15 #include "base/power_monitor/power_monitor_device_source.h" | 15 #include "base/power_monitor/power_monitor_device_source.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "ui/base/ime/input_method_initializer.h" | 18 #include "ui/base/ime/input_method_initializer.h" |
| 19 #include "ui/base/material_design/material_design_controller.h" | |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/base/ui_base_paths.h" | 21 #include "ui/base/ui_base_paths.h" |
| 21 #include "ui/compositor/test/in_process_context_factory.h" | 22 #include "ui/compositor/test/in_process_context_factory.h" |
| 22 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
| 23 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
| 24 #include "ui/views/examples/example_base.h" | 25 #include "ui/views/examples/example_base.h" |
| 25 #include "ui/views/examples/examples_window.h" | 26 #include "ui/views/examples/examples_window.h" |
| 26 #include "ui/views/test/desktop_test_views_delegate.h" | 27 #include "ui/views/test/desktop_test_views_delegate.h" |
| 27 | 28 |
| 28 #if defined(USE_AURA) | 29 #if defined(USE_AURA) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 | 82 |
| 82 #if defined(OS_WIN) | 83 #if defined(OS_WIN) |
| 83 gfx::win::MaybeInitializeDirectWrite(); | 84 gfx::win::MaybeInitializeDirectWrite(); |
| 84 #endif | 85 #endif |
| 85 | 86 |
| 86 #if defined(USE_AURA) | 87 #if defined(USE_AURA) |
| 87 std::unique_ptr<aura::Env> env = aura::Env::CreateInstance(); | 88 std::unique_ptr<aura::Env> env = aura::Env::CreateInstance(); |
| 88 aura::Env::GetInstance()->set_context_factory(context_factory.get()); | 89 aura::Env::GetInstance()->set_context_factory(context_factory.get()); |
| 89 #endif | 90 #endif |
| 90 ui::InitializeInputMethodForTesting(); | 91 ui::InitializeInputMethodForTesting(); |
| 92 ui::MaterialDesignController::Initialize(); | |
|
msw
2016/04/19 18:14:55
Why is this needed in this CL?
Evan Stade
2016/04/19 21:51:31
without it, views_examples_exe crashes. This is du
| |
| 91 | 93 |
| 92 { | 94 { |
| 93 views::DesktopTestViewsDelegate views_delegate; | 95 views::DesktopTestViewsDelegate views_delegate; |
| 94 #if defined(USE_AURA) | 96 #if defined(USE_AURA) |
| 95 wm::WMState wm_state; | 97 wm::WMState wm_state; |
| 96 #endif | 98 #endif |
| 97 #if !defined(OS_CHROMEOS) && defined(USE_AURA) | 99 #if !defined(OS_CHROMEOS) && defined(USE_AURA) |
| 98 std::unique_ptr<gfx::Screen> desktop_screen(views::CreateDesktopScreen()); | 100 std::unique_ptr<gfx::Screen> desktop_screen(views::CreateDesktopScreen()); |
| 99 gfx::Screen::SetScreenInstance(desktop_screen.get()); | 101 gfx::Screen::SetScreenInstance(desktop_screen.get()); |
| 100 #endif | 102 #endif |
| 101 | 103 |
| 102 views::examples::ShowExamplesWindow( | 104 views::examples::ShowExamplesWindow( |
| 103 views::examples::QUIT_ON_CLOSE, nullptr, | 105 views::examples::QUIT_ON_CLOSE, nullptr, |
| 104 std::unique_ptr<ScopedVector<views::examples::ExampleBase>>()); | 106 std::unique_ptr<ScopedVector<views::examples::ExampleBase>>()); |
| 105 | 107 |
| 106 base::RunLoop().Run(); | 108 base::RunLoop().Run(); |
| 107 | 109 |
| 108 ui::ResourceBundle::CleanupSharedInstance(); | 110 ui::ResourceBundle::CleanupSharedInstance(); |
| 109 } | 111 } |
| 110 | 112 |
| 111 ui::ShutdownInputMethod(); | 113 ui::ShutdownInputMethod(); |
| 112 | 114 |
| 113 #if defined(USE_AURA) | 115 #if defined(USE_AURA) |
| 114 env.reset(); | 116 env.reset(); |
| 115 #endif | 117 #endif |
| 116 | 118 |
| 117 return 0; | 119 return 0; |
| 118 } | 120 } |
| OLD | NEW |