| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 shell_init_params.context_factory_private = | 58 shell_init_params.context_factory_private = |
| 59 content::GetContextFactoryPrivate(); | 59 content::GetContextFactoryPrivate(); |
| 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 const bool show_primary_host_on_connect = true; | |
| 69 std::unique_ptr<ash::mus::WindowManager> window_manager = | 68 std::unique_ptr<ash::mus::WindowManager> window_manager = |
| 70 base::MakeUnique<ash::mus::WindowManager>(connector, ash::Config::MUS, | 69 base::MakeUnique<ash::mus::WindowManager>(connector, ash::Config::MUS); |
| 71 show_primary_host_on_connect); | |
| 72 // The WindowManager normally deletes the Shell when it loses its connection | 70 // The WindowManager normally deletes the Shell when it loses its connection |
| 73 // to mus. Disable that by installing an empty callback. Chrome installs | 71 // to mus. Disable that by installing an empty callback. Chrome installs |
| 74 // its own callback to detect when the connection to mus is lost and that is | 72 // its own callback to detect when the connection to mus is lost and that is |
| 75 // what shuts everything down. | 73 // what shuts everything down. |
| 76 window_manager->SetLostConnectionCallback(base::BindOnce(&base::DoNothing)); | 74 window_manager->SetLostConnectionCallback(base::BindOnce(&base::DoNothing)); |
| 77 std::unique_ptr<aura::WindowTreeClient> window_tree_client = | 75 std::unique_ptr<aura::WindowTreeClient> window_tree_client = |
| 78 base::MakeUnique<aura::WindowTreeClient>(connector, window_manager.get(), | 76 base::MakeUnique<aura::WindowTreeClient>(connector, window_manager.get(), |
| 79 window_manager.get()); | 77 window_manager.get()); |
| 80 const bool automatically_create_display_roots = false; | 78 window_tree_client->ConnectAsWindowManager(); |
| 81 window_tree_client->ConnectAsWindowManager( | |
| 82 automatically_create_display_roots); | |
| 83 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client.get()); | 79 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client.get()); |
| 84 window_manager->Init(std::move(window_tree_client), | 80 window_manager->Init(std::move(window_tree_client), |
| 85 content::BrowserThread::GetBlockingPool(), | 81 content::BrowserThread::GetBlockingPool(), |
| 86 base::MakeUnique<ChromeShellDelegate>()); | 82 base::MakeUnique<ChromeShellDelegate>()); |
| 87 CHECK(window_manager->WaitForInitialDisplays()); | 83 CHECK(window_manager->WaitForInitialDisplays()); |
| 88 return window_manager; | 84 return window_manager; |
| 89 } | 85 } |
| 90 | 86 |
| 91 } // namespace | 87 } // namespace |
| 92 | 88 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 157 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
| 162 } | 158 } |
| 163 | 159 |
| 164 AshInit::~AshInit() { | 160 AshInit::~AshInit() { |
| 165 // |window_manager_| deletes the Shell. | 161 // |window_manager_| deletes the Shell. |
| 166 if (!window_manager_ && ash::Shell::HasInstance()) { | 162 if (!window_manager_ && ash::Shell::HasInstance()) { |
| 167 ash::Shell::DeleteInstance(); | 163 ash::Shell::DeleteInstance(); |
| 168 ash::ShellContentState::DestroyInstance(); | 164 ash::ShellContentState::DestroyInstance(); |
| 169 } | 165 } |
| 170 } | 166 } |
| OLD | NEW |