| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mus/bridge/shell_port_mash.h" | 5 #include "ash/mus/bridge/shell_port_mash.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
| 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 ShellPortMash::MashSpecificState::MashSpecificState() = default; | 107 ShellPortMash::MashSpecificState::MashSpecificState() = default; |
| 108 | 108 |
| 109 ShellPortMash::MashSpecificState::~MashSpecificState() = default; | 109 ShellPortMash::MashSpecificState::~MashSpecificState() = default; |
| 110 | 110 |
| 111 ShellPortMash::MusSpecificState::MusSpecificState() = default; | 111 ShellPortMash::MusSpecificState::MusSpecificState() = default; |
| 112 | 112 |
| 113 ShellPortMash::MusSpecificState::~MusSpecificState() = default; | 113 ShellPortMash::MusSpecificState::~MusSpecificState() = default; |
| 114 | 114 |
| 115 ShellPortMash::ShellPortMash( | 115 ShellPortMash::ShellPortMash( |
| 116 WmWindow* primary_root_window, | 116 aura::Window* primary_root_window, |
| 117 WindowManager* window_manager, | 117 WindowManager* window_manager, |
| 118 views::PointerWatcherEventRouter* pointer_watcher_event_router, | 118 views::PointerWatcherEventRouter* pointer_watcher_event_router, |
| 119 bool create_session_state_delegate_stub) | 119 bool create_session_state_delegate_stub) |
| 120 : window_manager_(window_manager), | 120 : window_manager_(window_manager), |
| 121 primary_root_window_(primary_root_window) { | 121 primary_root_window_(primary_root_window) { |
| 122 if (create_session_state_delegate_stub) | 122 if (create_session_state_delegate_stub) |
| 123 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); | 123 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); |
| 124 | 124 |
| 125 if (GetAshConfig() == Config::MASH) { | 125 if (GetAshConfig() == Config::MASH) { |
| 126 mash_state_ = base::MakeUnique<MashSpecificState>(); | 126 mash_state_ = base::MakeUnique<MashSpecificState>(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if (GetAshConfig() == Config::MUS) | 172 if (GetAshConfig() == Config::MUS) |
| 173 Shell::Get()->window_tree_host_manager()->Shutdown(); | 173 Shell::Get()->window_tree_host_manager()->Shutdown(); |
| 174 else | 174 else |
| 175 window_manager_->DeleteAllRootWindowControllers(); | 175 window_manager_->DeleteAllRootWindowControllers(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 Config ShellPortMash::GetAshConfig() const { | 178 Config ShellPortMash::GetAshConfig() const { |
| 179 return window_manager_->config(); | 179 return window_manager_->config(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 WmWindow* ShellPortMash::GetPrimaryRootWindow() { | 182 aura::Window* ShellPortMash::GetPrimaryRootWindow() { |
| 183 if (GetAshConfig() == Config::MUS) { | 183 if (GetAshConfig() == Config::MUS) |
| 184 return WmWindow::Get( | 184 return Shell::Get()->window_tree_host_manager()->GetPrimaryRootWindow(); |
| 185 Shell::Get()->window_tree_host_manager()->GetPrimaryRootWindow()); | |
| 186 } | |
| 187 // NOTE: This is called before the RootWindowController has been created, so | 185 // NOTE: This is called before the RootWindowController has been created, so |
| 188 // it can't call through to RootWindowController to get all windows. | 186 // it can't call through to RootWindowController to get all windows. |
| 189 return primary_root_window_; | 187 return primary_root_window_; |
| 190 } | 188 } |
| 191 | 189 |
| 192 WmWindow* ShellPortMash::GetRootWindowForDisplayId(int64_t display_id) { | 190 aura::Window* ShellPortMash::GetRootWindowForDisplayId(int64_t display_id) { |
| 193 if (GetAshConfig() == Config::MUS) { | 191 if (GetAshConfig() == Config::MUS) { |
| 194 return WmWindow::Get( | 192 return Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( |
| 195 Shell::Get()->window_tree_host_manager()->GetRootWindowForDisplayId( | 193 display_id); |
| 196 display_id)); | |
| 197 } | 194 } |
| 198 RootWindowController* root_window_controller = | 195 RootWindowController* root_window_controller = |
| 199 GetRootWindowControllerWithDisplayId(display_id); | 196 GetRootWindowControllerWithDisplayId(display_id); |
| 200 return root_window_controller | 197 return root_window_controller ? root_window_controller->GetRootWindow() |
| 201 ? WmWindow::Get(root_window_controller->GetRootWindow()) | 198 : nullptr; |
| 202 : nullptr; | |
| 203 } | 199 } |
| 204 | 200 |
| 205 const display::ManagedDisplayInfo& ShellPortMash::GetDisplayInfo( | 201 const display::ManagedDisplayInfo& ShellPortMash::GetDisplayInfo( |
| 206 int64_t display_id) const { | 202 int64_t display_id) const { |
| 207 // TODO(sky): mash should use this too http://crbug.com/718860. | 203 // TODO(sky): mash should use this too http://crbug.com/718860. |
| 208 if (GetAshConfig() == Config::MUS) | 204 if (GetAshConfig() == Config::MUS) |
| 209 return Shell::Get()->display_manager()->GetDisplayInfo(display_id); | 205 return Shell::Get()->display_manager()->GetDisplayInfo(display_id); |
| 210 | 206 |
| 211 // TODO(mash): implement http://crbug.com/622480. | 207 // TODO(mash): implement http://crbug.com/622480. |
| 212 NOTIMPLEMENTED(); | 208 NOTIMPLEMENTED(); |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 observer.OnDisplayConfigurationChanging(); | 628 observer.OnDisplayConfigurationChanging(); |
| 633 } | 629 } |
| 634 | 630 |
| 635 void ShellPortMash::OnDisplayConfigurationChanged() { | 631 void ShellPortMash::OnDisplayConfigurationChanged() { |
| 636 for (auto& observer : display_observers_) | 632 for (auto& observer : display_observers_) |
| 637 observer.OnDisplayConfigurationChanged(); | 633 observer.OnDisplayConfigurationChanged(); |
| 638 } | 634 } |
| 639 | 635 |
| 640 } // namespace mus | 636 } // namespace mus |
| 641 } // namespace ash | 637 } // namespace ash |
| OLD | NEW |