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 "chrome/browser/ui/ash/ash_init.h" | 5 #include "chrome/browser/ui/ash/ash_init.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 8 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
9 #include "ash/accessibility_types.h" | 9 #include "ash/accessibility_types.h" |
10 #include "ash/aura/shell_port_classic.h" | 10 #include "ash/aura/shell_port_classic.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 shell_init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 60 shell_init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
61 | 61 |
62 ash::Shell::CreateInstance(shell_init_params); | 62 ash::Shell::CreateInstance(shell_init_params); |
63 } | 63 } |
64 | 64 |
65 std::unique_ptr<ash::mus::WindowManager> CreateMusShell() { | 65 std::unique_ptr<ash::mus::WindowManager> CreateMusShell() { |
66 service_manager::Connector* connector = | 66 service_manager::Connector* connector = |
67 content::ServiceManagerConnection::GetForProcess()->GetConnector(); | 67 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
68 std::unique_ptr<ash::mus::WindowManager> window_manager = | 68 std::unique_ptr<ash::mus::WindowManager> window_manager = |
69 base::MakeUnique<ash::mus::WindowManager>(connector, ash::Config::MUS); | 69 base::MakeUnique<ash::mus::WindowManager>(connector, ash::Config::MUS); |
| 70 // The WindowManager normally deletes the Shell when it loses its connection |
| 71 // to mus. Disable that by installing an empty callback. Chrome installs |
| 72 // its own callback to detect when the connection to mus is lost and that is |
| 73 // what shuts everything down. |
| 74 window_manager->SetLostConnectionCallback(base::BindOnce(&base::DoNothing)); |
70 std::unique_ptr<aura::WindowTreeClient> window_tree_client = | 75 std::unique_ptr<aura::WindowTreeClient> window_tree_client = |
71 base::MakeUnique<aura::WindowTreeClient>(connector, window_manager.get(), | 76 base::MakeUnique<aura::WindowTreeClient>(connector, window_manager.get(), |
72 window_manager.get()); | 77 window_manager.get()); |
73 window_tree_client->ConnectAsWindowManager(); | 78 window_tree_client->ConnectAsWindowManager(); |
74 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client.get()); | 79 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client.get()); |
75 window_manager->Init(std::move(window_tree_client), | 80 window_manager->Init(std::move(window_tree_client), |
76 content::BrowserThread::GetBlockingPool(), | 81 content::BrowserThread::GetBlockingPool(), |
77 base::MakeUnique<ChromeShellDelegate>()); | 82 base::MakeUnique<ChromeShellDelegate>()); |
78 CHECK(window_manager->WaitForInitialDisplays()); | 83 CHECK(window_manager->WaitForInitialDisplays()); |
79 return window_manager; | 84 return window_manager; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 157 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
153 } | 158 } |
154 | 159 |
155 AshInit::~AshInit() { | 160 AshInit::~AshInit() { |
156 // |window_manager_| deletes the Shell. | 161 // |window_manager_| deletes the Shell. |
157 if (!window_manager_ && ash::Shell::HasInstance()) { | 162 if (!window_manager_ && ash::Shell::HasInstance()) { |
158 ash::Shell::DeleteInstance(); | 163 ash::Shell::DeleteInstance(); |
159 ash::ShellContentState::DestroyInstance(); | 164 ash::ShellContentState::DestroyInstance(); |
160 } | 165 } |
161 } | 166 } |
OLD | NEW |