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

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

Issue 11047030: Decouple EventClientImpl and root window. Check containers on the same root window as focused windo… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lock button Created 8 years, 2 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 | Annotate | Revision Log
« ash/shell.cc ('K') | « ash/wm/event_client_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/wm/power_button_controller.h" 5 #include "ash/wm/power_button_controller.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_delegate.h" 9 #include "ash/shell_delegate.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
11 #include "ash/wm/session_state_animator.h" 11 #include "ash/wm/session_state_animator.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "ui/aura/root_window.h" 13 #include "ui/aura/root_window.h"
14 #include "ui/aura/shared/compound_event_filter.h" 14 #include "ui/aura/shared/compound_event_filter.h"
15 15
16 #if defined(OS_CHROMEOS)
17 #include "base/chromeos/chromeos_version.h"
18 #endif
19
16 namespace ash { 20 namespace ash {
17 21
18 namespace { 22 namespace {
19 23
20 // Amount of time that the power button needs to be held before we lock the 24 // Amount of time that the power button needs to be held before we lock the
21 // screen. 25 // screen.
22 const int kLockTimeoutMs = 400; 26 const int kLockTimeoutMs = 400;
23 27
24 // Amount of time that the power button needs to be held before we shut down. 28 // Amount of time that the power button needs to be held before we shut down.
25 const int kShutdownTimeoutMs = 400; 29 const int kShutdownTimeoutMs = 400;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 StartShutdownTimer(); 304 StartShutdownTimer();
301 } 305 }
302 306
303 void PowerButtonController::OnShutdownTimeout() { 307 void PowerButtonController::OnShutdownTimeout() {
304 if (!shutting_down_) 308 if (!shutting_down_)
305 StartShutdownAnimationAndRequestShutdown(); 309 StartShutdownAnimationAndRequestShutdown();
306 } 310 }
307 311
308 void PowerButtonController::OnRealShutdownTimeout() { 312 void PowerButtonController::OnRealShutdownTimeout() {
309 DCHECK(shutting_down_); 313 DCHECK(shutting_down_);
314 #if defined(OS_CHROMEOS)
Daniel Erat 2012/10/08 14:41:51 this code seems a bit strange. you have an OS_CHR
oshima 2012/10/08 17:52:59 Chances are this class may not make sense at all o
Daniel Erat 2012/10/08 18:24:25 Yeah, I was just suggesting this for debugging.
315 if (!base::chromeos::IsRunningOnChromeOS()) {
316 ShellDelegate* delegate = Shell::GetInstance()->delegate();
317 if (delegate)
Daniel Erat 2012/10/08 14:41:51 random question: under what circumstances do we no
oshima 2012/10/08 17:52:59 There are a few unittests that create Shell with N
318 delegate->Exit();
319 }
320 #endif
310 delegate_->RequestShutdown(); 321 delegate_->RequestShutdown();
311 } 322 }
312 323
313 void PowerButtonController::StartLockTimer() { 324 void PowerButtonController::StartLockTimer() {
314 animator_->ShowBlackLayer(); 325 animator_->ShowBlackLayer();
315 animator_->StartAnimation( 326 animator_->StartAnimation(
316 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 327 internal::SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
317 internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE); 328 internal::SessionStateAnimator::ANIMATION_SLOW_CLOSE);
318 lock_timer_.Stop(); 329 lock_timer_.Stop();
319 lock_timer_.Start(FROM_HERE, 330 lock_timer_.Start(FROM_HERE,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 371 }
361 372
362 real_shutdown_timer_.Start( 373 real_shutdown_timer_.Start(
363 FROM_HERE, 374 FROM_HERE,
364 base::TimeDelta::FromMilliseconds( 375 base::TimeDelta::FromMilliseconds(
365 kFastCloseAnimMs + kShutdownRequestDelayMs), 376 kFastCloseAnimMs + kShutdownRequestDelayMs),
366 this, &PowerButtonController::OnRealShutdownTimeout); 377 this, &PowerButtonController::OnRealShutdownTimeout);
367 } 378 }
368 379
369 } // namespace ash 380 } // namespace ash
OLDNEW
« ash/shell.cc ('K') | « ash/wm/event_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698