OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 void Shell::SetDisplayWorkAreaInsets(Window* contains, | 326 void Shell::SetDisplayWorkAreaInsets(Window* contains, |
327 const gfx::Insets& insets) { | 327 const gfx::Insets& insets) { |
328 wm_shell_->SetDisplayWorkAreaInsets(WmWindow::Get(contains), insets); | 328 wm_shell_->SetDisplayWorkAreaInsets(WmWindow::Get(contains), insets); |
329 } | 329 } |
330 | 330 |
331 void Shell::OnAppTerminating() { | 331 void Shell::OnAppTerminating() { |
332 for (auto& observer : shell_observers_) | 332 for (auto& observer : shell_observers_) |
333 observer.OnAppTerminating(); | 333 observer.OnAppTerminating(); |
334 } | 334 } |
335 | 335 |
336 void Shell::OnLockStateChanged(bool locked) { | |
337 for (auto& observer : shell_observers_) | |
338 observer.OnLockStateChanged(locked); | |
339 #ifndef NDEBUG | |
340 // Make sure that there is no system modal in Lock layer when unlocked. | |
341 if (!locked) { | |
342 aura::Window::Windows containers = wm::GetContainersFromAllRootWindows( | |
343 kShellWindowId_LockSystemModalContainer, GetPrimaryRootWindow()); | |
344 for (aura::Window* container : containers) | |
345 DCHECK(container->children().empty()); | |
346 } | |
347 #endif | |
348 } | |
349 | |
350 void Shell::OnCastingSessionStartedOrStopped(bool started) { | 336 void Shell::OnCastingSessionStartedOrStopped(bool started) { |
351 for (auto& observer : shell_observers_) | 337 for (auto& observer : shell_observers_) |
352 observer.OnCastingSessionStartedOrStopped(started); | 338 observer.OnCastingSessionStartedOrStopped(started); |
353 } | 339 } |
354 | 340 |
355 void Shell::OnRootWindowAdded(WmWindow* root_window) { | 341 void Shell::OnRootWindowAdded(WmWindow* root_window) { |
356 for (auto& observer : shell_observers_) | 342 for (auto& observer : shell_observers_) |
357 observer.OnRootWindowAdded(root_window); | 343 observer.OnRootWindowAdded(root_window); |
358 } | 344 } |
359 | 345 |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 } | 1228 } |
1243 | 1229 |
1244 void Shell::LoginStatusChanged(LoginStatus login_status) { | 1230 void Shell::LoginStatusChanged(LoginStatus login_status) { |
1245 UpdateAfterLoginStatusChange(login_status); | 1231 UpdateAfterLoginStatusChange(login_status); |
1246 | 1232 |
1247 // TODO(xiyuan): Update OnLoginStateChanged -> OnLoginStatusChanged. | 1233 // TODO(xiyuan): Update OnLoginStateChanged -> OnLoginStatusChanged. |
1248 for (auto& observer : shell_observers_) | 1234 for (auto& observer : shell_observers_) |
1249 observer.OnLoginStateChanged(login_status); | 1235 observer.OnLoginStateChanged(login_status); |
1250 } | 1236 } |
1251 | 1237 |
| 1238 void Shell::LockStateChanged(bool locked) { |
| 1239 // TODO(xiyuan): Convert OnLockStateChanged() ShellObservers to |
| 1240 // SessionStateObservers. |
| 1241 for (auto& observer : shell_observers_) |
| 1242 observer.OnLockStateChanged(locked); |
| 1243 #ifndef NDEBUG |
| 1244 // Make sure that there is no system modal in Lock layer when unlocked. |
| 1245 if (!locked) { |
| 1246 aura::Window::Windows containers = wm::GetContainersFromAllRootWindows( |
| 1247 kShellWindowId_LockSystemModalContainer, GetPrimaryRootWindow()); |
| 1248 for (aura::Window* container : containers) |
| 1249 DCHECK(container->children().empty()); |
| 1250 } |
| 1251 #endif |
| 1252 } |
| 1253 |
1252 void Shell::OnPrefServiceInitialized( | 1254 void Shell::OnPrefServiceInitialized( |
1253 std::unique_ptr<::PrefService> pref_service) { | 1255 std::unique_ptr<::PrefService> pref_service) { |
1254 if (!instance_) | 1256 if (!instance_) |
1255 return; | 1257 return; |
1256 DCHECK(pref_service); | 1258 DCHECK(pref_service); |
1257 pref_service_ = std::move(pref_service); | 1259 pref_service_ = std::move(pref_service); |
1258 } | 1260 } |
1259 | 1261 |
1260 } // namespace ash | 1262 } // namespace ash |
OLD | NEW |