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

Side by Side Diff: ash/common/wm_shell.cc

Issue 2336883002: mash: Port context menu code to WmShell and WmRootWindowController. (Closed)
Patch Set: Fix error. Created 4 years, 3 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/common/wm_shell.h ('k') | ash/mus/bridge/wm_shell_mus.h » ('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/common/wm_shell.h" 5 #include "ash/common/wm_shell.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/accelerators/accelerator_controller.h" 9 #include "ash/common/accelerators/accelerator_controller.h"
10 #include "ash/common/accelerators/ash_focus_manager_factory.h" 10 #include "ash/common/accelerators/ash_focus_manager_factory.h"
(...skipping 13 matching lines...) Expand all
24 #include "ash/common/system/keyboard_brightness_control_delegate.h" 24 #include "ash/common/system/keyboard_brightness_control_delegate.h"
25 #include "ash/common/system/toast/toast_manager.h" 25 #include "ash/common/system/toast/toast_manager.h"
26 #include "ash/common/system/tray/system_tray_delegate.h" 26 #include "ash/common/system/tray/system_tray_delegate.h"
27 #include "ash/common/system/tray/system_tray_notifier.h" 27 #include "ash/common/system/tray/system_tray_notifier.h"
28 #include "ash/common/wallpaper/wallpaper_controller.h" 28 #include "ash/common/wallpaper/wallpaper_controller.h"
29 #include "ash/common/wallpaper/wallpaper_delegate.h" 29 #include "ash/common/wallpaper/wallpaper_delegate.h"
30 #include "ash/common/wm/immersive_context_ash.h" 30 #include "ash/common/wm/immersive_context_ash.h"
31 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 31 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
32 #include "ash/common/wm/mru_window_tracker.h" 32 #include "ash/common/wm/mru_window_tracker.h"
33 #include "ash/common/wm/overview/window_selector_controller.h" 33 #include "ash/common/wm/overview/window_selector_controller.h"
34 #include "ash/common/wm/root_window_finder.h"
34 #include "ash/common/wm/system_modal_container_layout_manager.h" 35 #include "ash/common/wm/system_modal_container_layout_manager.h"
35 #include "ash/common/wm/window_cycle_controller.h" 36 #include "ash/common/wm/window_cycle_controller.h"
36 #include "ash/common/wm_root_window_controller.h" 37 #include "ash/common/wm_root_window_controller.h"
37 #include "ash/common/wm_window.h" 38 #include "ash/common/wm_window.h"
38 #include "base/bind.h" 39 #include "base/bind.h"
39 #include "base/logging.h" 40 #include "base/logging.h"
40 #include "base/memory/ptr_util.h" 41 #include "base/memory/ptr_util.h"
41 #include "ui/app_list/presenter/app_list_presenter.h" 42 #include "ui/app_list/presenter/app_list_presenter.h"
42 #include "ui/display/display.h" 43 #include "ui/display/display.h"
43 #include "ui/views/focus/focus_manager_factory.h" 44 #include "ui/views/focus/focus_manager_factory.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC 96 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC
96 // shelf items in Chrome) so explicitly shutdown early. 97 // shelf items in Chrome) so explicitly shutdown early.
97 shelf_model_->DestroyItemDelegates(); 98 shelf_model_->DestroyItemDelegates();
98 // Must be destroyed before FocusClient. 99 // Must be destroyed before FocusClient.
99 shelf_delegate_.reset(); 100 shelf_delegate_.reset();
100 101
101 // Balances the Install() in Initialize(). 102 // Balances the Install() in Initialize().
102 views::FocusManagerFactory::Install(nullptr); 103 views::FocusManagerFactory::Install(nullptr);
103 } 104 }
104 105
106 void WmShell::ShowContextMenu(const gfx::Point& location_in_screen,
107 ui::MenuSourceType source_type) {
108 // Bail if there is no active user session or if the screen is locked.
109 if (GetSessionStateDelegate()->NumberOfLoggedInUsers() < 1 ||
110 GetSessionStateDelegate()->IsScreenLocked()) {
111 return;
112 }
113
114 WmWindow* root = wm::GetRootWindowAt(location_in_screen);
115 root->GetRootWindowController()->ShowContextMenu(location_in_screen,
116 source_type);
117 }
118
105 void WmShell::CreateShelfDelegate() { 119 void WmShell::CreateShelfDelegate() {
106 // May be called multiple times as shelves are created and destroyed. 120 // May be called multiple times as shelves are created and destroyed.
107 if (shelf_delegate_) 121 if (shelf_delegate_)
108 return; 122 return;
109 // Must occur after SessionStateDelegate creation and user login because 123 // Must occur after SessionStateDelegate creation and user login because
110 // Chrome's implementation of ShelfDelegate assumes it can get information 124 // Chrome's implementation of ShelfDelegate assumes it can get information
111 // about multi-profile login state. 125 // about multi-profile login state.
112 DCHECK(GetSessionStateDelegate()); 126 DCHECK(GetSessionStateDelegate());
113 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); 127 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0);
114 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get())); 128 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get()));
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 void WmShell::DeleteToastManager() { 349 void WmShell::DeleteToastManager() {
336 toast_manager_.reset(); 350 toast_manager_.reset();
337 } 351 }
338 352
339 void WmShell::SetAcceleratorController( 353 void WmShell::SetAcceleratorController(
340 std::unique_ptr<AcceleratorController> accelerator_controller) { 354 std::unique_ptr<AcceleratorController> accelerator_controller) {
341 accelerator_controller_ = std::move(accelerator_controller); 355 accelerator_controller_ = std::move(accelerator_controller);
342 } 356 }
343 357
344 } // namespace ash 358 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_shell.h ('k') | ash/mus/bridge/wm_shell_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698