| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { | 40 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { |
| 41 browser_context_.reset(new content::ShellBrowserContext(false)); | 41 browser_context_.reset(new content::ShellBrowserContext(false)); |
| 42 | 42 |
| 43 #if defined(USE_AURA) | 43 #if defined(USE_AURA) |
| 44 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); | 44 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); |
| 45 stacking_client_.reset(new DesktopStackingClient); | 45 stacking_client_.reset(new DesktopStackingClient); |
| 46 aura::client::SetStackingClient(stacking_client_.get()); | 46 aura::client::SetStackingClient(stacking_client_.get()); |
| 47 gfx::Screen::SetScreenInstance( | 47 gfx::Screen::SetScreenInstance( |
| 48 gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen()); | 48 gfx::SCREEN_TYPE_NATIVE, CreateDesktopScreen()); |
| 49 ui_controls::UIControls::SetUIControlsInstance( |
| 50 ui_controls::UI_CONTROLS_TYPE_NATIVE, CreateDesktopUIControls()); |
| 49 #endif | 51 #endif |
| 50 views_delegate_.reset(new DesktopTestViewsDelegate); | 52 views_delegate_.reset(new DesktopTestViewsDelegate); |
| 51 | 53 |
| 52 ShowExamplesWindowWithContent(QUIT_ON_CLOSE, browser_context_.get()); | 54 ShowExamplesWindowWithContent(QUIT_ON_CLOSE, browser_context_.get()); |
| 53 } | 55 } |
| 54 | 56 |
| 55 void ExamplesBrowserMainParts::PostMainMessageLoopRun() { | 57 void ExamplesBrowserMainParts::PostMainMessageLoopRun() { |
| 56 browser_context_.reset(); | 58 browser_context_.reset(); |
| 57 views_delegate_.reset(); | 59 views_delegate_.reset(); |
| 58 #if defined(USE_AURA) | 60 #if defined(USE_AURA) |
| 59 stacking_client_.reset(); | 61 stacking_client_.reset(); |
| 60 aura::Env::DeleteInstance(); | 62 aura::Env::DeleteInstance(); |
| 61 #endif | 63 #endif |
| 62 } | 64 } |
| 63 | 65 |
| 64 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { | 66 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 65 // xxx: Hax here because this kills event handling. | 67 // xxx: Hax here because this kills event handling. |
| 66 #if !defined(USE_AURA) | 68 #if !defined(USE_AURA) |
| 67 AcceleratorHandler accelerator_handler; | 69 AcceleratorHandler accelerator_handler; |
| 68 base::RunLoop run_loop(&accelerator_handler); | 70 base::RunLoop run_loop(&accelerator_handler); |
| 69 #else | 71 #else |
| 70 base::RunLoop run_loop; | 72 base::RunLoop run_loop; |
| 71 #endif | 73 #endif |
| 72 run_loop.Run(); | 74 run_loop.Run(); |
| 73 return true; | 75 return true; |
| 74 } | 76 } |
| 75 | 77 |
| 76 } // namespace examples | 78 } // namespace examples |
| 77 } // namespace views | 79 } // namespace views |
| OLD | NEW |