Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(809)

Side by Side Diff: ash/mus/bridge/wm_shell_mus.cc

Issue 2777223002: Gets chrome --mus some what working (Closed)
Patch Set: fix mac Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.h ('k') | ash/mus/test/wm_test_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/wm_shell_mus.h" 5 #include "ash/mus/bridge/wm_shell_mus.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
9 #include "ash/common/accelerators/accelerator_controller.h" 10 #include "ash/common/accelerators/accelerator_controller.h"
10 #include "ash/common/key_event_watcher.h" 11 #include "ash/common/key_event_watcher.h"
11 #include "ash/common/session/session_state_delegate.h" 12 #include "ash/common/session/session_state_delegate.h"
12 #include "ash/common/shell_delegate.h" 13 #include "ash/common/shell_delegate.h"
13 #include "ash/common/shell_observer.h" 14 #include "ash/common/shell_observer.h"
14 #include "ash/common/system/tray/system_tray_delegate.h" 15 #include "ash/common/system/tray/system_tray_delegate.h"
15 #include "ash/common/wallpaper/wallpaper_delegate.h" 16 #include "ash/common/wallpaper/wallpaper_delegate.h"
16 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h" 17 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h"
17 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard .h" 18 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard .h"
18 #include "ash/common/wm/mru_window_tracker.h" 19 #include "ash/common/wm/mru_window_tracker.h"
19 #include "ash/common/wm/window_cycle_event_filter.h" 20 #include "ash/common/wm/window_cycle_event_filter.h"
20 #include "ash/common/wm/window_resizer.h" 21 #include "ash/common/wm/window_resizer.h"
21 #include "ash/common/wm_window.h" 22 #include "ash/common/wm_window.h"
22 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h" 23 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h"
23 #include "ash/mus/accelerators/accelerator_controller_registrar.h" 24 #include "ash/mus/accelerators/accelerator_controller_registrar.h"
24 #include "ash/mus/bridge/immersive_handler_factory_mus.h" 25 #include "ash/mus/bridge/immersive_handler_factory_mus.h"
25 #include "ash/mus/bridge/workspace_event_handler_mus.h" 26 #include "ash/mus/bridge/workspace_event_handler_mus.h"
26 #include "ash/mus/drag_window_resizer.h" 27 #include "ash/mus/drag_window_resizer.h"
27 #include "ash/mus/keyboard_ui_mus.h" 28 #include "ash/mus/keyboard_ui_mus.h"
28 #include "ash/mus/screen_mus.h" 29 #include "ash/mus/screen_mus.h"
29 #include "ash/mus/window_manager.h" 30 #include "ash/mus/window_manager.h"
31 #include "ash/public/cpp/config.h"
30 #include "ash/root_window_controller.h" 32 #include "ash/root_window_controller.h"
31 #include "ash/root_window_settings.h" 33 #include "ash/root_window_settings.h"
32 #include "ash/shared/immersive_fullscreen_controller.h" 34 #include "ash/shared/immersive_fullscreen_controller.h"
33 #include "ash/shell.h" 35 #include "ash/shell.h"
34 #include "ash/shell_init_params.h" 36 #include "ash/shell_init_params.h"
35 #include "ash/wm/window_util.h" 37 #include "ash/wm/window_util.h"
36 #include "base/memory/ptr_util.h" 38 #include "base/memory/ptr_util.h"
37 #include "components/user_manager/user_info_impl.h" 39 #include "components/user_manager/user_info_impl.h"
38 #include "ui/aura/mus/window_tree_client.h" 40 #include "ui/aura/mus/window_tree_client.h"
39 #include "ui/aura/mus/window_tree_host_mus.h" 41 #include "ui/aura/mus/window_tree_host_mus.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 WindowManager* window_manager, 84 WindowManager* window_manager,
83 views::PointerWatcherEventRouter* pointer_watcher_event_router, 85 views::PointerWatcherEventRouter* pointer_watcher_event_router,
84 bool create_session_state_delegate_stub) 86 bool create_session_state_delegate_stub)
85 : window_manager_(window_manager), 87 : window_manager_(window_manager),
86 primary_root_window_(primary_root_window), 88 primary_root_window_(primary_root_window),
87 pointer_watcher_event_router_(pointer_watcher_event_router) { 89 pointer_watcher_event_router_(pointer_watcher_event_router) {
88 if (create_session_state_delegate_stub) 90 if (create_session_state_delegate_stub)
89 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); 91 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>();
90 DCHECK(primary_root_window_); 92 DCHECK(primary_root_window_);
91 93
92 immersive_handler_factory_.reset(new ImmersiveHandlerFactoryMus); 94 if (GetConfig() == Config::MASH)
95 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryMus>();
93 } 96 }
94 97
95 WmShellMus::~WmShellMus() { 98 WmShellMus::~WmShellMus() {
96 } 99 }
97 100
98 // static 101 // static
99 WmShellMus* WmShellMus::Get() { 102 WmShellMus* WmShellMus::Get() {
103 const ash::Config config = WmShell::Get()->GetConfig();
104 CHECK(config == Config::MUS || config == Config::MASH);
100 return static_cast<WmShellMus*>(WmShell::Get()); 105 return static_cast<WmShellMus*>(WmShell::Get());
101 } 106 }
102 107
103 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId( 108 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId(
104 int64_t id) { 109 int64_t id) {
105 for (RootWindowController* root_window_controller : 110 for (RootWindowController* root_window_controller :
106 RootWindowController::root_window_controllers()) { 111 RootWindowController::root_window_controllers()) {
107 RootWindowSettings* settings = 112 RootWindowSettings* settings =
108 GetRootWindowSettings(root_window_controller->GetRootWindow()); 113 GetRootWindowSettings(root_window_controller->GetRootWindow());
109 DCHECK(settings); 114 DCHECK(settings);
110 if (settings->display_id == id) 115 if (settings->display_id == id)
111 return root_window_controller; 116 return root_window_controller;
112 } 117 }
113 return nullptr; 118 return nullptr;
114 } 119 }
115 120
116 aura::WindowTreeClient* WmShellMus::window_tree_client() { 121 aura::WindowTreeClient* WmShellMus::window_tree_client() {
117 return window_manager_->window_tree_client(); 122 return window_manager_->window_tree_client();
118 } 123 }
119 124
120 void WmShellMus::Shutdown() { 125 void WmShellMus::Shutdown() {
121 WmShell::Shutdown(); 126 WmShell::Shutdown();
122 127
123 window_manager_->DeleteAllRootWindowControllers(); 128 window_manager_->DeleteAllRootWindowControllers();
124 } 129 }
125 130
126 bool WmShellMus::IsRunningInMash() const { 131 bool WmShellMus::IsRunningInMash() const {
127 return true; 132 return GetConfig() == Config::MASH;
133 }
134
135 Config WmShellMus::GetConfig() const {
136 return window_manager_->config();
128 } 137 }
129 138
130 WmWindow* WmShellMus::GetFocusedWindow() { 139 WmWindow* WmShellMus::GetFocusedWindow() {
131 // TODO: remove as both WmShells use same implementation. 140 // TODO: remove as both WmShells use same implementation.
132 return WmWindow::Get( 141 return WmWindow::Get(
133 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) 142 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow())
134 ->GetFocusedWindow()); 143 ->GetFocusedWindow());
135 } 144 }
136 145
137 WmWindow* WmShellMus::GetActiveWindow() { 146 WmWindow* WmShellMus::GetActiveWindow() {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 void WmShellMus::CreatePrimaryHost() {} 355 void WmShellMus::CreatePrimaryHost() {}
347 356
348 void WmShellMus::InitHosts(const ShellInitParams& init_params) { 357 void WmShellMus::InitHosts(const ShellInitParams& init_params) {
349 window_manager_->CreatePrimaryRootWindowController( 358 window_manager_->CreatePrimaryRootWindowController(
350 base::WrapUnique(init_params.primary_window_tree_host)); 359 base::WrapUnique(init_params.primary_window_tree_host));
351 } 360 }
352 361
353 std::unique_ptr<AcceleratorController> 362 std::unique_ptr<AcceleratorController>
354 WmShellMus::CreateAcceleratorController() { 363 WmShellMus::CreateAcceleratorController() {
355 DCHECK(!accelerator_controller_delegate_); 364 DCHECK(!accelerator_controller_delegate_);
365 if (GetConfig() == Config::MUS) {
366 accelerator_controller_delegate_classic_ =
367 base::MakeUnique<AcceleratorControllerDelegateAura>();
368 return base::MakeUnique<AcceleratorController>(
369 accelerator_controller_delegate_classic_.get(), nullptr);
370 }
371
356 uint16_t accelerator_namespace_id = 0u; 372 uint16_t accelerator_namespace_id = 0u;
357 const bool add_result = 373 const bool add_result =
358 window_manager_->GetNextAcceleratorNamespaceId(&accelerator_namespace_id); 374 window_manager_->GetNextAcceleratorNamespaceId(&accelerator_namespace_id);
359 // WmShellMus is created early on, so that GetNextAcceleratorNamespaceId() 375 // WmShellMus is created early on, so that GetNextAcceleratorNamespaceId()
360 // should always succeed. 376 // should always succeed.
361 DCHECK(add_result); 377 DCHECK(add_result);
362 378
363 accelerator_controller_delegate_ = 379 accelerator_controller_delegate_ =
364 base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_); 380 base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_);
365 accelerator_controller_registrar_ = 381 accelerator_controller_registrar_ =
366 base ::MakeUnique<AcceleratorControllerRegistrar>( 382 base ::MakeUnique<AcceleratorControllerRegistrar>(
367 window_manager_, accelerator_namespace_id); 383 window_manager_, accelerator_namespace_id);
368 return base::MakeUnique<AcceleratorController>( 384 return base::MakeUnique<AcceleratorController>(
369 accelerator_controller_delegate_.get(), 385 accelerator_controller_delegate_.get(),
370 accelerator_controller_registrar_.get()); 386 accelerator_controller_registrar_.get());
371 } 387 }
372 388
373 } // namespace mus 389 } // namespace mus
374 } // namespace ash 390 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.h ('k') | ash/mus/test/wm_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698