| 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/content/shell_content_state.h" | 8 #include "ash/content/shell_content_state.h" |
| 9 #include "ash/desktop_background/desktop_background_controller.h" | 9 #include "ash/desktop_background/desktop_background_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 #include "content/shell/browser/shell_browser_context.h" | 26 #include "content/shell/browser/shell_browser_context.h" |
| 27 #include "content/shell/browser/shell_net_log.h" | 27 #include "content/shell/browser/shell_net_log.h" |
| 28 #include "net/base/net_module.h" | 28 #include "net/base/net_module.h" |
| 29 #include "ui/aura/env.h" | 29 #include "ui/aura/env.h" |
| 30 #include "ui/aura/window.h" | 30 #include "ui/aura/window.h" |
| 31 #include "ui/aura/window_tree_host.h" | 31 #include "ui/aura/window_tree_host.h" |
| 32 #include "ui/base/material_design/material_design_controller.h" | 32 #include "ui/base/material_design/material_design_controller.h" |
| 33 #include "ui/base/ui_base_paths.h" | 33 #include "ui/base/ui_base_paths.h" |
| 34 #include "ui/compositor/compositor.h" | 34 #include "ui/compositor/compositor.h" |
| 35 #include "ui/gfx/screen.h" | 35 #include "ui/display/screen.h" |
| 36 #include "ui/message_center/message_center.h" | 36 #include "ui/message_center/message_center.h" |
| 37 #include "ui/views/test/test_views_delegate.h" | 37 #include "ui/views/test/test_views_delegate.h" |
| 38 #include "ui/wm/core/wm_state.h" | 38 #include "ui/wm/core/wm_state.h" |
| 39 | 39 |
| 40 #if defined(USE_X11) | 40 #if defined(USE_X11) |
| 41 #include "ui/events/devices/x11/touch_factory_x11.h" // nogncheck | 41 #include "ui/events/devices/x11/touch_factory_x11.h" // nogncheck |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
| 45 #include "chromeos/audio/cras_audio_handler.h" | 45 #include "chromeos/audio/cras_audio_handler.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ui::MaterialDesignController::Initialize(); | 131 ui::MaterialDesignController::Initialize(); |
| 132 ash::ShellInitParams init_params; | 132 ash::ShellInitParams init_params; |
| 133 init_params.delegate = delegate_; | 133 init_params.delegate = delegate_; |
| 134 init_params.context_factory = content::GetContextFactory(); | 134 init_params.context_factory = content::GetContextFactory(); |
| 135 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 135 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
| 136 ash::Shell::CreateInstance(init_params); | 136 ash::Shell::CreateInstance(init_params); |
| 137 ash::Shell::GetInstance()->CreateShelf(); | 137 ash::Shell::GetInstance()->CreateShelf(); |
| 138 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER); | 138 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER); |
| 139 | 139 |
| 140 window_watcher_.reset(new ash::shell::WindowWatcher); | 140 window_watcher_.reset(new ash::shell::WindowWatcher); |
| 141 gfx::Screen::GetScreen()->AddObserver(window_watcher_.get()); | 141 display::Screen::GetScreen()->AddObserver(window_watcher_.get()); |
| 142 | 142 |
| 143 ash::shell::InitWindowTypeLauncher(); | 143 ash::shell::InitWindowTypeLauncher(); |
| 144 | 144 |
| 145 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 145 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void ShellBrowserMainParts::PostMainMessageLoopRun() { | 148 void ShellBrowserMainParts::PostMainMessageLoopRun() { |
| 149 gfx::Screen::GetScreen()->RemoveObserver(window_watcher_.get()); | 149 display::Screen::GetScreen()->RemoveObserver(window_watcher_.get()); |
| 150 | 150 |
| 151 window_watcher_.reset(); | 151 window_watcher_.reset(); |
| 152 delegate_ = nullptr; | 152 delegate_ = nullptr; |
| 153 ash::Shell::DeleteInstance(); | 153 ash::Shell::DeleteInstance(); |
| 154 ShellContentState::DestroyInstance(); | 154 ShellContentState::DestroyInstance(); |
| 155 // The global message center state must be shutdown absent | 155 // The global message center state must be shutdown absent |
| 156 // g_browser_process. | 156 // g_browser_process. |
| 157 message_center::MessageCenter::Shutdown(); | 157 message_center::MessageCenter::Shutdown(); |
| 158 | 158 |
| 159 #if defined(OS_CHROMEOS) | 159 #if defined(OS_CHROMEOS) |
| 160 chromeos::CrasAudioHandler::Shutdown(); | 160 chromeos::CrasAudioHandler::Shutdown(); |
| 161 #endif | 161 #endif |
| 162 | 162 |
| 163 views_delegate_.reset(); | 163 views_delegate_.reset(); |
| 164 | 164 |
| 165 // The keyboard may have created a WebContents. The WebContents is destroyed | 165 // The keyboard may have created a WebContents. The WebContents is destroyed |
| 166 // with the UI, and it needs the BrowserContext to be alive during its | 166 // with the UI, and it needs the BrowserContext to be alive during its |
| 167 // destruction. So destroy all of the UI elements before destroying the | 167 // destruction. So destroy all of the UI elements before destroying the |
| 168 // browser context. | 168 // browser context. |
| 169 browser_context_.reset(); | 169 browser_context_.reset(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { | 172 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 173 base::MessageLoop::current()->Run(); | 173 base::MessageLoop::current()->Run(); |
| 174 return true; | 174 return true; |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace shell | 177 } // namespace shell |
| 178 } // namespace ash | 178 } // namespace ash |
| OLD | NEW |