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

Side by Side Diff: ash/mus/window_manager.cc

Issue 2271373002: mash: Port mojo:ash_sysui's ContextMenuMus to mojo:ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 years, 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/window_manager.h" 5 #include "ash/mus/window_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "ash/common/shell_window_ids.h" 11 #include "ash/common/shell_window_ids.h"
12 #include "ash/mus/accelerators/accelerator_handler.h" 12 #include "ash/mus/accelerators/accelerator_handler.h"
13 #include "ash/mus/accelerators/accelerator_ids.h" 13 #include "ash/mus/accelerators/accelerator_ids.h"
14 #include "ash/mus/bridge/wm_lookup_mus.h" 14 #include "ash/mus/bridge/wm_lookup_mus.h"
15 #include "ash/mus/bridge/wm_shell_mus.h" 15 #include "ash/mus/bridge/wm_shell_mus.h"
16 #include "ash/mus/bridge/wm_window_mus.h" 16 #include "ash/mus/bridge/wm_window_mus.h"
17 #include "ash/mus/move_event_handler.h" 17 #include "ash/mus/move_event_handler.h"
18 #include "ash/mus/native_widget_factory_mus.h"
18 #include "ash/mus/non_client_frame_controller.h" 19 #include "ash/mus/non_client_frame_controller.h"
19 #include "ash/mus/property_util.h" 20 #include "ash/mus/property_util.h"
20 #include "ash/mus/root_window_controller.h" 21 #include "ash/mus/root_window_controller.h"
21 #include "ash/mus/shadow_controller.h" 22 #include "ash/mus/shadow_controller.h"
22 #include "ash/mus/shell_delegate_mus.h" 23 #include "ash/mus/shell_delegate_mus.h"
23 #include "ash/mus/window_manager_observer.h" 24 #include "ash/mus/window_manager_observer.h"
24 #include "ash/public/interfaces/container.mojom.h" 25 #include "ash/public/interfaces/container.mojom.h"
25 #include "services/ui/common/event_matcher_util.h" 26 #include "services/ui/common/event_matcher_util.h"
26 #include "services/ui/common/types.h" 27 #include "services/ui/common/types.h"
27 #include "services/ui/public/cpp/property_type_converters.h" 28 #include "services/ui/public/cpp/property_type_converters.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 NonClientFrameController::GetMaxTitleBarButtonWidth(); 97 NonClientFrameController::GetMaxTitleBarButtonWidth();
97 window_manager_client_->SetFrameDecorationValues( 98 window_manager_client_->SetFrameDecorationValues(
98 std::move(frame_decoration_values)); 99 std::move(frame_decoration_values));
99 100
100 std::unique_ptr<ShellDelegate> shell_delegate(new ShellDelegateMus( 101 std::unique_ptr<ShellDelegate> shell_delegate(new ShellDelegateMus(
101 base::MakeUnique<AppListPresenterStub>(), connector_)); 102 base::MakeUnique<AppListPresenterStub>(), connector_));
102 shell_.reset(new WmShellMus(std::move(shell_delegate), this, 103 shell_.reset(new WmShellMus(std::move(shell_delegate), this,
103 pointer_watcher_event_router_.get())); 104 pointer_watcher_event_router_.get()));
104 shell_->Initialize(); 105 shell_->Initialize();
105 lookup_.reset(new WmLookupMus); 106 lookup_.reset(new WmLookupMus);
107
108 native_widget_factory_mus_.reset(new NativeWidgetFactoryMus(this));
106 } 109 }
107 110
108 void WindowManager::SetScreenLocked(bool is_locked) { 111 void WindowManager::SetScreenLocked(bool is_locked) {
109 // TODO: screen locked state needs to be persisted for newly added displays. 112 // TODO: screen locked state needs to be persisted for newly added displays.
110 for (auto& root_window_controller : root_window_controllers_) { 113 for (auto& root_window_controller : root_window_controllers_) {
111 WmWindowMus* non_lock_screen_containers_container = 114 WmWindowMus* non_lock_screen_containers_container =
112 root_window_controller->GetWindowByShellWindowId( 115 root_window_controller->GetWindowByShellWindowId(
113 kShellWindowId_NonLockScreenContainersContainer); 116 kShellWindowId_NonLockScreenContainersContainer);
114 non_lock_screen_containers_container->mus_window()->SetVisible(!is_locked); 117 non_lock_screen_containers_container->mus_window()->SetVisible(!is_locked);
115 } 118 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void WindowManager::OnDidDestroyClient(ui::WindowTreeClient* client) { 215 void WindowManager::OnDidDestroyClient(ui::WindowTreeClient* client) {
213 // Destroying the roots should result in removal from 216 // Destroying the roots should result in removal from
214 // |root_window_controllers_|. 217 // |root_window_controllers_|.
215 DCHECK(root_window_controllers_.empty()); 218 DCHECK(root_window_controllers_.empty());
216 219
217 // Observers can rely on WmShell from the callback. So notify the observers 220 // Observers can rely on WmShell from the callback. So notify the observers
218 // before destroying it. 221 // before destroying it.
219 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, 222 FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
220 OnWindowTreeClientDestroyed()); 223 OnWindowTreeClientDestroyed());
221 224
225 native_widget_factory_mus_.reset();
226
222 lookup_.reset(); 227 lookup_.reset();
223 shell_->Shutdown(); 228 shell_->Shutdown();
224 shell_.reset(); 229 shell_.reset();
225 shadow_controller_.reset(); 230 shadow_controller_.reset();
226 231
227 pointer_watcher_event_router_.reset(); 232 pointer_watcher_event_router_.reset();
228 233
229 window_tree_client_ = nullptr; 234 window_tree_client_ = nullptr;
230 window_manager_client_ = nullptr; 235 window_manager_client_ = nullptr;
231 } 236 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 const ui::Event& event) { 313 const ui::Event& event) {
309 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); 314 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id));
310 if (iter == accelerator_handlers_.end()) 315 if (iter == accelerator_handlers_.end())
311 return ui::mojom::EventResult::HANDLED; 316 return ui::mojom::EventResult::HANDLED;
312 317
313 return iter->second->OnAccelerator(id, event); 318 return iter->second->OnAccelerator(id, event);
314 } 319 }
315 320
316 } // namespace mus 321 } // namespace mus
317 } // namespace ash 322 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698