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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
10 #include "ash/common/focus_cycler.h" | 10 #include "ash/common/focus_cycler.h" |
11 #include "ash/common/keyboard/keyboard_ui.h" | 11 #include "ash/common/keyboard/keyboard_ui.h" |
| 12 #include "ash/common/shelf/shelf_model.h" |
12 #include "ash/common/shell_delegate.h" | 13 #include "ash/common/shell_delegate.h" |
13 #include "ash/common/shell_window_ids.h" | 14 #include "ash/common/shell_window_ids.h" |
14 #include "ash/common/system/brightness_control_delegate.h" | 15 #include "ash/common/system/brightness_control_delegate.h" |
15 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 16 #include "ash/common/system/keyboard_brightness_control_delegate.h" |
16 #include "ash/common/system/tray/system_tray_delegate.h" | 17 #include "ash/common/system/tray/system_tray_delegate.h" |
17 #include "ash/common/system/tray/system_tray_notifier.h" | 18 #include "ash/common/system/tray/system_tray_notifier.h" |
18 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 19 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
19 #include "ash/common/wm/mru_window_tracker.h" | 20 #include "ash/common/wm/mru_window_tracker.h" |
20 #include "ash/common/wm/overview/window_selector_controller.h" | 21 #include "ash/common/wm/overview/window_selector_controller.h" |
21 #include "ash/common/wm/window_cycle_controller.h" | 22 #include "ash/common/wm/window_cycle_controller.h" |
22 #include "ash/common/wm_window.h" | 23 #include "ash/common/wm_window.h" |
23 #include "base/bind.h" | 24 #include "base/bind.h" |
24 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #include "ui/app_list/presenter/app_list_presenter.h" |
| 27 #include "ui/display/display.h" |
25 | 28 |
26 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
27 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h
" | 30 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h
" |
28 #include "ash/common/system/chromeos/keyboard_brightness_controller.h" | 31 #include "ash/common/system/chromeos/keyboard_brightness_controller.h" |
29 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" | 32 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" |
30 #endif | 33 #endif |
31 | 34 |
32 namespace ash { | 35 namespace ash { |
33 | 36 |
34 // static | 37 // static |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 shell_observers_.AddObserver(observer); | 81 shell_observers_.AddObserver(observer); |
79 } | 82 } |
80 | 83 |
81 void WmShell::RemoveShellObserver(ShellObserver* observer) { | 84 void WmShell::RemoveShellObserver(ShellObserver* observer) { |
82 shell_observers_.RemoveObserver(observer); | 85 shell_observers_.RemoveObserver(observer); |
83 } | 86 } |
84 | 87 |
85 WmShell::WmShell(std::unique_ptr<ShellDelegate> shell_delegate) | 88 WmShell::WmShell(std::unique_ptr<ShellDelegate> shell_delegate) |
86 : delegate_(std::move(shell_delegate)), | 89 : delegate_(std::move(shell_delegate)), |
87 focus_cycler_(new FocusCycler), | 90 focus_cycler_(new FocusCycler), |
| 91 shelf_model_(new ShelfModel), |
88 system_tray_notifier_(new SystemTrayNotifier), | 92 system_tray_notifier_(new SystemTrayNotifier), |
89 window_selector_controller_(new WindowSelectorController) { | 93 window_selector_controller_(new WindowSelectorController) { |
90 #if defined(OS_CHROMEOS) | 94 #if defined(OS_CHROMEOS) |
91 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos); | 95 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos); |
92 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController); | 96 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController); |
93 #endif | 97 #endif |
94 window_cycle_controller_.reset(new WindowCycleController()); | 98 window_cycle_controller_.reset(new WindowCycleController()); |
95 } | 99 } |
96 | 100 |
97 WmShell::~WmShell() {} | 101 WmShell::~WmShell() {} |
(...skipping 11 matching lines...) Expand all Loading... |
109 continue; | 113 continue; |
110 for (const WmWindow* child : system_modal->GetChildren()) { | 114 for (const WmWindow* child : system_modal->GetChildren()) { |
111 if (child->IsSystemModal() && child->GetTargetVisibility()) { | 115 if (child->IsSystemModal() && child->GetTargetVisibility()) { |
112 return true; | 116 return true; |
113 } | 117 } |
114 } | 118 } |
115 } | 119 } |
116 return false; | 120 return false; |
117 } | 121 } |
118 | 122 |
| 123 void WmShell::ShowAppList() { |
| 124 // Show the app list on the default display for new windows. |
| 125 int64_t display_id = |
| 126 GetRootWindowForNewWindows()->GetDisplayNearestWindow().id(); |
| 127 delegate_->GetAppListPresenter()->Show(display_id); |
| 128 } |
| 129 |
| 130 void WmShell::DismissAppList() { |
| 131 delegate_->GetAppListPresenter()->Dismiss(); |
| 132 } |
| 133 |
| 134 void WmShell::ToggleAppList() { |
| 135 // Show the app list on the default display for new windows. |
| 136 int64_t display_id = |
| 137 GetRootWindowForNewWindows()->GetDisplayNearestWindow().id(); |
| 138 delegate_->GetAppListPresenter()->ToggleAppList(display_id); |
| 139 } |
| 140 |
| 141 bool WmShell::IsApplistVisible() const { |
| 142 return delegate_->GetAppListPresenter()->IsVisible(); |
| 143 } |
| 144 |
| 145 bool WmShell::GetAppListTargetVisibility() const { |
| 146 return delegate_->GetAppListPresenter()->GetTargetVisibility(); |
| 147 } |
| 148 |
119 void WmShell::SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui) { | 149 void WmShell::SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui) { |
120 keyboard_ui_ = std::move(keyboard_ui); | 150 keyboard_ui_ = std::move(keyboard_ui); |
121 } | 151 } |
122 | 152 |
123 void WmShell::SetSystemTrayDelegate( | 153 void WmShell::SetSystemTrayDelegate( |
124 std::unique_ptr<SystemTrayDelegate> delegate) { | 154 std::unique_ptr<SystemTrayDelegate> delegate) { |
125 DCHECK(delegate); | 155 DCHECK(delegate); |
126 DCHECK(!system_tray_delegate_); | 156 DCHECK(!system_tray_delegate_); |
127 // TODO(jamescook): Create via ShellDelegate once it moves to //ash/common. | 157 // TODO(jamescook): Create via ShellDelegate once it moves to //ash/common. |
128 system_tray_delegate_ = std::move(delegate); | 158 system_tray_delegate_ = std::move(delegate); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 190 |
161 void WmShell::CreateMruWindowTracker() { | 191 void WmShell::CreateMruWindowTracker() { |
162 mru_window_tracker_.reset(new MruWindowTracker); | 192 mru_window_tracker_.reset(new MruWindowTracker); |
163 } | 193 } |
164 | 194 |
165 void WmShell::DeleteMruWindowTracker() { | 195 void WmShell::DeleteMruWindowTracker() { |
166 mru_window_tracker_.reset(); | 196 mru_window_tracker_.reset(); |
167 } | 197 } |
168 | 198 |
169 } // namespace ash | 199 } // namespace ash |
OLD | NEW |