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

Side by Side Diff: ash/wm/lock_state_controller.cc

Issue 2118593002: mash: Migrate ShellDelegate ownership and access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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
« no previous file with comments | « ash/wm/lock_layout_manager.cc ('k') | ash/wm/lock_state_controller_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/wm/lock_state_controller.h" 5 #include "ash/wm/lock_state_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "ash/cancel_mode.h" 11 #include "ash/cancel_mode.h"
12 #include "ash/common/accessibility_delegate.h" 12 #include "ash/common/accessibility_delegate.h"
13 #include "ash/common/ash_switches.h" 13 #include "ash/common/ash_switches.h"
14 #include "ash/common/shell_delegate.h"
14 #include "ash/common/shell_window_ids.h" 15 #include "ash/common/shell_window_ids.h"
15 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
16 #include "ash/shell.h" 17 #include "ash/shell.h"
17 #include "ash/shell_delegate.h"
18 #include "ash/wm/session_state_animator.h" 18 #include "ash/wm/session_state_animator.h"
19 #include "ash/wm/session_state_animator_impl.h" 19 #include "ash/wm/session_state_animator_impl.h"
20 #include "base/bind.h" 20 #include "base/bind.h"
21 #include "base/bind_helpers.h" 21 #include "base/bind_helpers.h"
22 #include "base/command_line.h" 22 #include "base/command_line.h"
23 #include "base/location.h" 23 #include "base/location.h"
24 #include "base/logging.h" 24 #include "base/logging.h"
25 #include "base/metrics/histogram_macros.h" 25 #include "base/metrics/histogram_macros.h"
26 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
27 #include "base/timer/timer.h" 27 #include "base/timer/timer.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 StartUnlockAnimationBeforeUIDestroyed(callback); 207 StartUnlockAnimationBeforeUIDestroyed(callback);
208 } 208 }
209 209
210 void LockStateController::SetLockScreenDisplayedCallback( 210 void LockStateController::SetLockScreenDisplayedCallback(
211 const base::Closure& callback) { 211 const base::Closure& callback) {
212 lock_screen_displayed_callback_ = callback; 212 lock_screen_displayed_callback_ = callback;
213 } 213 }
214 214
215 void LockStateController::OnHostCloseRequested( 215 void LockStateController::OnHostCloseRequested(
216 const aura::WindowTreeHost* host) { 216 const aura::WindowTreeHost* host) {
217 Shell::GetInstance()->delegate()->Exit(); 217 WmShell::Get()->delegate()->Exit();
218 } 218 }
219 219
220 void LockStateController::OnLoginStateChanged(LoginStatus status) { 220 void LockStateController::OnLoginStateChanged(LoginStatus status) {
221 if (status != LoginStatus::LOCKED) 221 if (status != LoginStatus::LOCKED)
222 login_status_ = status; 222 login_status_ = status;
223 system_is_locked_ = (status == LoginStatus::LOCKED); 223 system_is_locked_ = (status == LoginStatus::LOCKED);
224 } 224 }
225 225
226 void LockStateController::OnAppTerminating() { 226 void LockStateController::OnAppTerminating() {
227 // If we hear that Chrome is exiting but didn't request it ourselves, all we 227 // If we hear that Chrome is exiting but didn't request it ourselves, all we
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 real_shutdown_timer_.Start( 326 real_shutdown_timer_.Start(
327 FROM_HERE, duration, base::Bind(&LockStateController::OnRealPowerTimeout, 327 FROM_HERE, duration, base::Bind(&LockStateController::OnRealPowerTimeout,
328 base::Unretained(this))); 328 base::Unretained(this)));
329 } 329 }
330 330
331 void LockStateController::OnRealPowerTimeout() { 331 void LockStateController::OnRealPowerTimeout() {
332 VLOG(1) << "OnRealPowerTimeout"; 332 VLOG(1) << "OnRealPowerTimeout";
333 DCHECK(shutting_down_); 333 DCHECK(shutting_down_);
334 #if defined(OS_CHROMEOS) 334 #if defined(OS_CHROMEOS)
335 if (!base::SysInfo::IsRunningOnChromeOS()) { 335 if (!base::SysInfo::IsRunningOnChromeOS()) {
336 ShellDelegate* delegate = Shell::GetInstance()->delegate(); 336 ShellDelegate* delegate = WmShell::Get()->delegate();
337 if (delegate) { 337 if (delegate) {
338 delegate->Exit(); 338 delegate->Exit();
339 return; 339 return;
340 } 340 }
341 } 341 }
342 #endif 342 #endif
343 WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_SHUT_DOWN_POWER_BUTTON); 343 WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_SHUT_DOWN_POWER_BUTTON);
344 delegate_->RequestShutdown(); 344 delegate_->RequestShutdown();
345 } 345 }
346 346
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 SessionStateAnimator::AnimationSequence* animation_sequence) { 594 SessionStateAnimator::AnimationSequence* animation_sequence) {
595 if (unlocked_properties_.get() && 595 if (unlocked_properties_.get() &&
596 unlocked_properties_->background_is_hidden) { 596 unlocked_properties_->background_is_hidden) {
597 animation_sequence->StartAnimation(SessionStateAnimator::DESKTOP_BACKGROUND, 597 animation_sequence->StartAnimation(SessionStateAnimator::DESKTOP_BACKGROUND,
598 SessionStateAnimator::ANIMATION_FADE_OUT, 598 SessionStateAnimator::ANIMATION_FADE_OUT,
599 speed); 599 speed);
600 } 600 }
601 } 601 }
602 602
603 } // namespace ash 603 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_layout_manager.cc ('k') | ash/wm/lock_state_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698