| 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 "ash/shell/content_client/shell_browser_main_parts.h" | 5 #include "ash/shell/content_client/shell_browser_main_parts.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell/shell_delegate_impl.h" | 10 #include "ash/shell/shell_delegate_impl.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "net/base/net_module.h" | 22 #include "net/base/net_module.h" |
| 23 #include "ui/aura/client/stacking_client.h" | 23 #include "ui/aura/client/stacking_client.h" |
| 24 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
| 25 #include "ui/aura/root_window.h" | 25 #include "ui/aura/root_window.h" |
| 26 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/base/ui_base_paths.h" | 28 #include "ui/base/ui_base_paths.h" |
| 29 #include "ui/compositor/compositor.h" | 29 #include "ui/compositor/compositor.h" |
| 30 #include "ui/compositor/test/compositor_test_support.h" | 30 #include "ui/compositor/test/compositor_test_support.h" |
| 31 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
| 32 #include "ui/message_center/message_center.h" |
| 32 #include "ui/views/focus/accelerator_handler.h" | 33 #include "ui/views/focus/accelerator_handler.h" |
| 33 #include "ui/views/test/test_views_delegate.h" | 34 #include "ui/views/test/test_views_delegate.h" |
| 34 | 35 |
| 35 #if defined(ENABLE_MESSAGE_CENTER) | |
| 36 #include "ui/message_center/message_center.h" | |
| 37 #endif | |
| 38 | |
| 39 #if defined(USE_X11) | 36 #if defined(USE_X11) |
| 40 #include "ui/base/touch/touch_factory_x11.h" | 37 #include "ui/base/touch/touch_factory_x11.h" |
| 41 #endif | 38 #endif |
| 42 | 39 |
| 43 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
| 44 #include "chromeos/audio/cras_audio_handler.h" | 41 #include "chromeos/audio/cras_audio_handler.h" |
| 45 #include "chromeos/dbus/dbus_thread_manager.h" | 42 #include "chromeos/dbus/dbus_thread_manager.h" |
| 46 #endif | 43 #endif |
| 47 | 44 |
| 48 namespace ash { | 45 namespace ash { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 102 } |
| 106 | 103 |
| 107 void ShellBrowserMainParts::PreMainMessageLoopRun() { | 104 void ShellBrowserMainParts::PreMainMessageLoopRun() { |
| 108 browser_context_.reset(new content::ShellBrowserContext(false)); | 105 browser_context_.reset(new content::ShellBrowserContext(false)); |
| 109 | 106 |
| 110 // A ViewsDelegate is required. | 107 // A ViewsDelegate is required. |
| 111 if (!views::ViewsDelegate::views_delegate) | 108 if (!views::ViewsDelegate::views_delegate) |
| 112 views::ViewsDelegate::views_delegate = new ShellViewsDelegate; | 109 views::ViewsDelegate::views_delegate = new ShellViewsDelegate; |
| 113 | 110 |
| 114 delegate_ = new ash::shell::ShellDelegateImpl; | 111 delegate_ = new ash::shell::ShellDelegateImpl; |
| 115 #if defined(ENABLE_MESSAGE_CENTER) | |
| 116 // The global message center state must be initialized absent | 112 // The global message center state must be initialized absent |
| 117 // g_browser_process. | 113 // g_browser_process. |
| 118 message_center::MessageCenter::Initialize(); | 114 message_center::MessageCenter::Initialize(); |
| 119 #endif | |
| 120 | 115 |
| 121 #if defined(OS_CHROMEOS) | 116 #if defined(OS_CHROMEOS) |
| 122 if (ash::switches::UseNewAudioHandler()) { | 117 if (ash::switches::UseNewAudioHandler()) { |
| 123 // Create CrasAudioHandler for testing since g_browser_process | 118 // Create CrasAudioHandler for testing since g_browser_process |
| 124 // is absent. | 119 // is absent. |
| 125 chromeos::CrasAudioHandler::InitializeForTesting(); | 120 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 126 } | 121 } |
| 127 #endif | 122 #endif |
| 128 | 123 |
| 129 ash::Shell::CreateInstance(delegate_); | 124 ash::Shell::CreateInstance(delegate_); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 147 } | 142 } |
| 148 | 143 |
| 149 void ShellBrowserMainParts::PostMainMessageLoopRun() { | 144 void ShellBrowserMainParts::PostMainMessageLoopRun() { |
| 150 gfx::Screen* screen = Shell::GetInstance()->GetScreen(); | 145 gfx::Screen* screen = Shell::GetInstance()->GetScreen(); |
| 151 screen->RemoveObserver(window_watcher_.get()); | 146 screen->RemoveObserver(window_watcher_.get()); |
| 152 | 147 |
| 153 window_watcher_.reset(); | 148 window_watcher_.reset(); |
| 154 delegate_->SetWatcher(NULL); | 149 delegate_->SetWatcher(NULL); |
| 155 delegate_ = NULL; | 150 delegate_ = NULL; |
| 156 ash::Shell::DeleteInstance(); | 151 ash::Shell::DeleteInstance(); |
| 157 #if defined(ENABLE_MESSAGE_CENTER) | |
| 158 // The global message center state must be shutdown absent | 152 // The global message center state must be shutdown absent |
| 159 // g_browser_process. | 153 // g_browser_process. |
| 160 message_center::MessageCenter::Shutdown(); | 154 message_center::MessageCenter::Shutdown(); |
| 161 #endif | |
| 162 | 155 |
| 163 #if defined(OS_CHROMEOS) | 156 #if defined(OS_CHROMEOS) |
| 164 if (ash::switches::UseNewAudioHandler()) | 157 if (ash::switches::UseNewAudioHandler()) |
| 165 chromeos::CrasAudioHandler::Shutdown(); | 158 chromeos::CrasAudioHandler::Shutdown(); |
| 166 #endif | 159 #endif |
| 167 | 160 |
| 168 aura::Env::DeleteInstance(); | 161 aura::Env::DeleteInstance(); |
| 169 | 162 |
| 170 // The keyboard may have created a WebContents. The WebContents is destroyed | 163 // The keyboard may have created a WebContents. The WebContents is destroyed |
| 171 // with the UI, and it needs the BrowserContext to be alive during its | 164 // with the UI, and it needs the BrowserContext to be alive during its |
| 172 // destruction. So destroy all of the UI elements before destroying the | 165 // destruction. So destroy all of the UI elements before destroying the |
| 173 // browser context. | 166 // browser context. |
| 174 browser_context_.reset(); | 167 browser_context_.reset(); |
| 175 } | 168 } |
| 176 | 169 |
| 177 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { | 170 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 178 base::MessageLoopForUI::current()->Run(); | 171 base::MessageLoopForUI::current()->Run(); |
| 179 return true; | 172 return true; |
| 180 } | 173 } |
| 181 | 174 |
| 182 } // namespace shell | 175 } // namespace shell |
| 183 } // namespace ash | 176 } // namespace ash |
| OLD | NEW |