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/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; |
(...skipping 26 matching lines...) Expand all Loading... |
49 if (child->IsSystemModal() && child->GetTargetVisibility()) { | 51 if (child->IsSystemModal() && child->GetTargetVisibility()) { |
50 return true; | 52 return true; |
51 } | 53 } |
52 } | 54 } |
53 } | 55 } |
54 return false; | 56 return false; |
55 } | 57 } |
56 | 58 |
57 void WmShell::SetSystemTrayDelegate( | 59 void WmShell::SetSystemTrayDelegate( |
58 std::unique_ptr<SystemTrayDelegate> delegate) { | 60 std::unique_ptr<SystemTrayDelegate> delegate) { |
59 if (delegate) { | 61 DCHECK(delegate); |
60 DCHECK(!system_tray_delegate_); | 62 DCHECK(!system_tray_delegate_); |
61 // TODO(jamescook): Create via ShellDelegate once it moves to //ash/common. | 63 // TODO(jamescook): Create via ShellDelegate once it moves to //ash/common. |
62 system_tray_delegate_ = std::move(delegate); | 64 system_tray_delegate_ = std::move(delegate); |
63 system_tray_delegate_->Initialize(); | 65 system_tray_delegate_->Initialize(); |
64 } else { | 66 #if defined(OS_CHROMEOS) |
65 DCHECK(system_tray_delegate_); | 67 logout_confirmation_controller_.reset(new LogoutConfirmationController( |
66 system_tray_delegate_->Shutdown(); | 68 base::Bind(&SystemTrayDelegate::SignOut, |
67 system_tray_delegate_.reset(); | 69 base::Unretained(system_tray_delegate_.get())))); |
68 } | 70 #endif |
| 71 } |
| 72 |
| 73 void WmShell::DeleteSystemTrayDelegate() { |
| 74 DCHECK(system_tray_delegate_); |
| 75 #if defined(OS_CHROMEOS) |
| 76 logout_confirmation_controller_.reset(); |
| 77 #endif |
| 78 system_tray_delegate_.reset(); |
69 } | 79 } |
70 | 80 |
71 void WmShell::DeleteWindowSelectorController() { | 81 void WmShell::DeleteWindowSelectorController() { |
72 window_selector_controller_.reset(); | 82 window_selector_controller_.reset(); |
73 } | 83 } |
74 | 84 |
75 } // namespace ash | 85 } // namespace ash |
OLD | NEW |