| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 ExamplesBrowserMainParts::~ExamplesBrowserMainParts() { | 52 ExamplesBrowserMainParts::~ExamplesBrowserMainParts() { |
| 53 } | 53 } |
| 54 | 54 |
| 55 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { | 55 void ExamplesBrowserMainParts::PreMainMessageLoopRun() { |
| 56 browser_context_.reset(new content::ShellBrowserContext(false)); | 56 browser_context_.reset(new content::ShellBrowserContext(false)); |
| 57 | 57 |
| 58 #if defined(USE_AURA) | 58 #if defined(USE_AURA) |
| 59 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); | 59 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); |
| 60 stacking_client_.reset(new aura::DesktopStackingClient); | 60 stacking_client_.reset(new aura::DesktopStackingClient); |
| 61 gfx::Screen::SetInstance(aura::CreateDesktopScreen()); | 61 gfx::Screen::SetScreenInstance( |
| 62 gfx::SCREEN_TYPE_NATIVE, aura::CreateDesktopScreen()); |
| 62 #endif | 63 #endif |
| 63 views_delegate_.reset(new ExamplesViewsDelegate); | 64 views_delegate_.reset(new ExamplesViewsDelegate); |
| 64 | 65 |
| 65 ShowExamplesWindowWithContent(QUIT_ON_CLOSE, browser_context_.get()); | 66 ShowExamplesWindowWithContent(QUIT_ON_CLOSE, browser_context_.get()); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void ExamplesBrowserMainParts::PostMainMessageLoopRun() { | 69 void ExamplesBrowserMainParts::PostMainMessageLoopRun() { |
| 69 browser_context_.reset(); | 70 browser_context_.reset(); |
| 70 views_delegate_.reset(); | 71 views_delegate_.reset(); |
| 71 #if defined(USE_AURA) | 72 #if defined(USE_AURA) |
| 72 stacking_client_.reset(); | 73 stacking_client_.reset(); |
| 73 aura::Env::DeleteInstance(); | 74 aura::Env::DeleteInstance(); |
| 74 #endif | 75 #endif |
| 75 } | 76 } |
| 76 | 77 |
| 77 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { | 78 bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 78 // xxx: Hax here because this kills event handling. | 79 // xxx: Hax here because this kills event handling. |
| 79 #if !defined(USE_AURA) | 80 #if !defined(USE_AURA) |
| 80 AcceleratorHandler accelerator_handler; | 81 AcceleratorHandler accelerator_handler; |
| 81 base::RunLoop run_loop(&accelerator_handler); | 82 base::RunLoop run_loop(&accelerator_handler); |
| 82 #else | 83 #else |
| 83 base::RunLoop run_loop; | 84 base::RunLoop run_loop; |
| 84 #endif | 85 #endif |
| 85 run_loop.Run(); | 86 run_loop.Run(); |
| 86 return true; | 87 return true; |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace examples | 90 } // namespace examples |
| 90 } // namespace views | 91 } // namespace views |
| OLD | NEW |