| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void ShellBrowserMainParts::ToolkitInitialized() { | 101 void ShellBrowserMainParts::ToolkitInitialized() { |
| 102 wm_state_.reset(new wm::WMState); | 102 wm_state_.reset(new wm::WMState); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void ShellBrowserMainParts::PreMainMessageLoopRun() { | 105 void ShellBrowserMainParts::PreMainMessageLoopRun() { |
| 106 net_log_.reset(new content::ShellNetLog("ash_shell")); | 106 net_log_.reset(new content::ShellNetLog("ash_shell")); |
| 107 browser_context_.reset(new content::ShellBrowserContext( | 107 browser_context_.reset(new content::ShellBrowserContext( |
| 108 false, net_log_.get())); | 108 false, net_log_.get())); |
| 109 | 109 |
| 110 // A ViewsDelegate is required. | 110 // A ViewsDelegate is required. |
| 111 if (!views::ViewsDelegate::views_delegate) | 111 if (!views::ViewsDelegate::GetInstance()) |
| 112 views::ViewsDelegate::views_delegate = new ShellViewsDelegate; | 112 views_delegate_.reset(new ShellViewsDelegate); |
| 113 | 113 |
| 114 delegate_ = new ash::shell::ShellDelegateImpl; | 114 delegate_ = new ash::shell::ShellDelegateImpl; |
| 115 // The global message center state must be initialized absent | 115 // The global message center state must be initialized absent |
| 116 // g_browser_process. | 116 // g_browser_process. |
| 117 message_center::MessageCenter::Initialize(); | 117 message_center::MessageCenter::Initialize(); |
| 118 | 118 |
| 119 #if defined(OS_CHROMEOS) | 119 #if defined(OS_CHROMEOS) |
| 120 // Create CrasAudioHandler for testing since g_browser_process | 120 // Create CrasAudioHandler for testing since g_browser_process |
| 121 // is absent. | 121 // is absent. |
| 122 chromeos::CrasAudioHandler::InitializeForTesting(); | 122 chromeos::CrasAudioHandler::InitializeForTesting(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 152 // The global message center state must be shutdown absent | 152 // The global message center state must be shutdown absent |
| 153 // g_browser_process. | 153 // g_browser_process. |
| 154 message_center::MessageCenter::Shutdown(); | 154 message_center::MessageCenter::Shutdown(); |
| 155 | 155 |
| 156 #if defined(OS_CHROMEOS) | 156 #if defined(OS_CHROMEOS) |
| 157 chromeos::CrasAudioHandler::Shutdown(); | 157 chromeos::CrasAudioHandler::Shutdown(); |
| 158 #endif | 158 #endif |
| 159 | 159 |
| 160 aura::Env::DeleteInstance(); | 160 aura::Env::DeleteInstance(); |
| 161 | 161 |
| 162 views_delegate_.reset(); |
| 163 |
| 162 // The keyboard may have created a WebContents. The WebContents is destroyed | 164 // The keyboard may have created a WebContents. The WebContents is destroyed |
| 163 // with the UI, and it needs the BrowserContext to be alive during its | 165 // with the UI, and it needs the BrowserContext to be alive during its |
| 164 // destruction. So destroy all of the UI elements before destroying the | 166 // destruction. So destroy all of the UI elements before destroying the |
| 165 // browser context. | 167 // browser context. |
| 166 browser_context_.reset(); | 168 browser_context_.reset(); |
| 167 } | 169 } |
| 168 | 170 |
| 169 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { | 171 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 170 base::MessageLoopForUI::current()->Run(); | 172 base::MessageLoopForUI::current()->Run(); |
| 171 return true; | 173 return true; |
| 172 } | 174 } |
| 173 | 175 |
| 174 } // namespace shell | 176 } // namespace shell |
| 175 } // namespace ash | 177 } // namespace ash |
| OLD | NEW |