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_delegate_aura.h" | 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
8 #include "ash/aura/wm_shell_aura.h" | 8 #include "ash/aura/wm_shell_aura.h" |
9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
10 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 | 63 |
64 std::unique_ptr<ash::mus::WindowManager> CreateMusShell() { | 64 std::unique_ptr<ash::mus::WindowManager> CreateMusShell() { |
65 service_manager::Connector* connector = | 65 service_manager::Connector* connector = |
66 content::ServiceManagerConnection::GetForProcess()->GetConnector(); | 66 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
67 std::unique_ptr<ash::mus::WindowManager> window_manager = | 67 std::unique_ptr<ash::mus::WindowManager> window_manager = |
68 base::MakeUnique<ash::mus::WindowManager>(connector, ash::Config::MUS); | 68 base::MakeUnique<ash::mus::WindowManager>(connector, ash::Config::MUS); |
69 std::unique_ptr<aura::WindowTreeClient> window_tree_client = | 69 std::unique_ptr<aura::WindowTreeClient> window_tree_client = |
70 base::MakeUnique<aura::WindowTreeClient>(connector, window_manager.get(), | 70 base::MakeUnique<aura::WindowTreeClient>(connector, window_manager.get(), |
71 window_manager.get()); | 71 window_manager.get()); |
72 window_tree_client->ConnectAsWindowManager(); | 72 // In mus mode we want all events to dispatch from the Shell, so that pre |
| 73 // target handlers and all that are correctly called. |
| 74 const bool dispatch_from_host = true; |
| 75 window_tree_client->ConnectAsWindowManager(dispatch_from_host); |
73 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client.get()); | 76 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client.get()); |
74 window_manager->Init(std::move(window_tree_client), | 77 window_manager->Init(std::move(window_tree_client), |
75 content::BrowserThread::GetBlockingPool(), | 78 content::BrowserThread::GetBlockingPool(), |
76 base::MakeUnique<ChromeShellDelegate>()); | 79 base::MakeUnique<ChromeShellDelegate>()); |
77 CHECK(window_manager->WaitForInitialDisplays()); | 80 CHECK(window_manager->WaitForInitialDisplays()); |
78 return window_manager; | 81 return window_manager; |
79 } | 82 } |
80 | 83 |
81 } // namespace | 84 } // namespace |
82 | 85 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 152 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
150 } | 153 } |
151 | 154 |
152 AshInit::~AshInit() { | 155 AshInit::~AshInit() { |
153 // |window_manager_| deletes the Shell. | 156 // |window_manager_| deletes the Shell. |
154 if (!window_manager_ && ash::Shell::HasInstance()) { | 157 if (!window_manager_ && ash::Shell::HasInstance()) { |
155 ash::Shell::DeleteInstance(); | 158 ash::Shell::DeleteInstance(); |
156 ash::ShellContentState::DestroyInstance(); | 159 ash::ShellContentState::DestroyInstance(); |
157 } | 160 } |
158 } | 161 } |
OLD | NEW |