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

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

Issue 2108793002: mash: Convert system tray logout button to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ifdefs Created 4 years, 5 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 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 "ash/common/focus_cycler.h" 7 #include "ash/common/focus_cycler.h"
8 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
9 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h"
9 #include "ash/common/system/tray/system_tray_delegate.h" 10 #include "ash/common/system/tray/system_tray_delegate.h"
10 #include "ash/common/system/tray/system_tray_notifier.h" 11 #include "ash/common/system/tray/system_tray_notifier.h"
11 #include "ash/common/wm/overview/window_selector_controller.h" 12 #include "ash/common/wm/overview/window_selector_controller.h"
12 #include "ash/common/wm_window.h" 13 #include "ash/common/wm_window.h"
14 #include "base/bind.h"
13 #include "base/logging.h" 15 #include "base/logging.h"
14 16
15 namespace ash { 17 namespace ash {
16 18
17 // static 19 // static
18 WmShell* WmShell::instance_ = nullptr; 20 WmShell* WmShell::instance_ = nullptr;
19 21
20 // static 22 // static
21 void WmShell::Set(WmShell* instance) { 23 void WmShell::Set(WmShell* instance) {
22 instance_ = instance; 24 instance_ = instance;
23 } 25 }
24 26
25 // static 27 // static
26 WmShell* WmShell::Get() { 28 WmShell* WmShell::Get() {
27 return instance_; 29 return instance_;
28 } 30 }
29 31
30 WmShell::WmShell() 32 WmShell::WmShell()
31 : focus_cycler_(new FocusCycler), 33 : focus_cycler_(new FocusCycler),
32 system_tray_notifier_(new SystemTrayNotifier), 34 system_tray_notifier_(new SystemTrayNotifier),
33 window_selector_controller_(new WindowSelectorController()) {} 35 window_selector_controller_(new WindowSelectorController()) {}
34 36
35 WmShell::~WmShell() {} 37 WmShell::~WmShell() {}
36 38
39 WmRootWindowController* WmShell::GetPrimaryRootWindowController() {
msw 2016/06/28 19:31:03 I have concerns about making this easy for non-tes
James Cook 2016/06/28 20:14:46 Inlined it. There will be a few, but forcing them
msw 2016/06/28 21:09:16 Please actually remove this function; otherwise ni
James Cook 2016/06/28 21:41:02 Doh, forgot to actually remove it! Done.
40 return GetPrimaryRootWindow()->GetRootWindowController();
41 }
42
37 bool WmShell::IsSystemModalWindowOpen() { 43 bool WmShell::IsSystemModalWindowOpen() {
38 if (simulate_modal_window_open_for_testing_) 44 if (simulate_modal_window_open_for_testing_)
39 return true; 45 return true;
40 46
41 // Traverse all system modal containers, and find its direct child window 47 // Traverse all system modal containers, and find its direct child window
42 // with "SystemModal" setting, and visible. 48 // with "SystemModal" setting, and visible.
43 for (WmWindow* root : GetAllRootWindows()) { 49 for (WmWindow* root : GetAllRootWindows()) {
44 WmWindow* system_modal = 50 WmWindow* system_modal =
45 root->GetChildByShellWindowId(kShellWindowId_SystemModalContainer); 51 root->GetChildByShellWindowId(kShellWindowId_SystemModalContainer);
46 if (!system_modal) 52 if (!system_modal)
(...skipping 18 matching lines...) Expand all
65 DCHECK(system_tray_delegate_); 71 DCHECK(system_tray_delegate_);
66 system_tray_delegate_->Shutdown(); 72 system_tray_delegate_->Shutdown();
67 system_tray_delegate_.reset(); 73 system_tray_delegate_.reset();
68 } 74 }
69 } 75 }
70 76
71 void WmShell::DeleteWindowSelectorController() { 77 void WmShell::DeleteWindowSelectorController() {
72 window_selector_controller_.reset(); 78 window_selector_controller_.reset();
73 } 79 }
74 80
81 #if defined(OS_CHROMEOS)
82 void WmShell::CreateLogoutConfirmationController() {
83 DCHECK(system_tray_delegate_);
84 logout_confirmation_controller_.reset(new LogoutConfirmationController(
85 base::Bind(&SystemTrayDelegate::SignOut,
86 base::Unretained(system_tray_delegate_.get()))));
87 }
88
89 void WmShell::DeleteLogoutConfirmationController() {
90 DCHECK(system_tray_delegate_);
91 logout_confirmation_controller_.reset();
92 }
93 #endif // defined(OS_CHROMEOS)
94
75 } // namespace ash 95 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698