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

Side by Side Diff: ash/system/chromeos/session/logout_confirmation_controller.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/system/chromeos/session/logout_confirmation_controller.h" 5 #include "ash/system/chromeos/session/logout_confirmation_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/system/chromeos/session/logout_confirmation_dialog.h" 10 #include "ash/system/chromeos/session/logout_confirmation_dialog.h"
(...skipping 14 matching lines...) Expand all
25 WmShell::Get()->AddShellObserver(this); 25 WmShell::Get()->AddShellObserver(this);
26 } 26 }
27 27
28 LogoutConfirmationController::~LogoutConfirmationController() { 28 LogoutConfirmationController::~LogoutConfirmationController() {
29 if (WmShell::HasInstance()) 29 if (WmShell::HasInstance())
30 WmShell::Get()->RemoveShellObserver(this); 30 WmShell::Get()->RemoveShellObserver(this);
31 if (dialog_) 31 if (dialog_)
32 dialog_->ControllerGone(); 32 dialog_->ControllerGone();
33 } 33 }
34 34
35 void LogoutConfirmationController::ConfirmLogout( 35 void LogoutConfirmationController::ConfirmLogout(base::TimeTicks logout_time) {
36 base::TimeTicks logout_time) {
37 if (!logout_time_.is_null() && logout_time >= logout_time_) { 36 if (!logout_time_.is_null() && logout_time >= logout_time_) {
38 // If a confirmation dialog is already being shown and its countdown expires 37 // If a confirmation dialog is already being shown and its countdown expires
39 // no later than the |logout_time| requested now, keep the current dialog 38 // no later than the |logout_time| requested now, keep the current dialog
40 // open. 39 // open.
41 return; 40 return;
42 } 41 }
43 logout_time_ = logout_time; 42 logout_time_ = logout_time;
44 43
45 if (!dialog_) { 44 if (!dialog_) {
46 // Show confirmation dialog unless this is a unit test without a Shell. 45 // Show confirmation dialog unless this is a unit test without a Shell.
47 if (WmShell::HasInstance()) 46 if (WmShell::HasInstance())
48 dialog_ = new LogoutConfirmationDialog(this, logout_time_); 47 dialog_ = new LogoutConfirmationDialog(this, logout_time_);
49 } else { 48 } else {
50 dialog_->Update(logout_time_); 49 dialog_->Update(logout_time_);
51 } 50 }
52 51
53 logout_timer_.Start(FROM_HERE, 52 logout_timer_.Start(FROM_HERE, logout_time_ - clock_->NowTicks(),
54 logout_time_ - clock_->NowTicks(),
55 logout_closure_); 53 logout_closure_);
56 } 54 }
57 55
58 void LogoutConfirmationController::SetClockForTesting( 56 void LogoutConfirmationController::SetClockForTesting(
59 std::unique_ptr<base::TickClock> clock) { 57 std::unique_ptr<base::TickClock> clock) {
60 clock_ = std::move(clock); 58 clock_ = std::move(clock);
61 } 59 }
62 60
63 void LogoutConfirmationController::OnLockStateChanged(bool locked) { 61 void LogoutConfirmationController::OnLockStateChanged(bool locked) {
64 if (!locked || logout_time_.is_null()) 62 if (!locked || logout_time_.is_null())
(...skipping 12 matching lines...) Expand all
77 logout_closure_.Run(); 75 logout_closure_.Run();
78 } 76 }
79 77
80 void LogoutConfirmationController::OnDialogClosed() { 78 void LogoutConfirmationController::OnDialogClosed() {
81 logout_time_ = base::TimeTicks(); 79 logout_time_ = base::TimeTicks();
82 dialog_ = NULL; 80 dialog_ = NULL;
83 logout_timer_.Stop(); 81 logout_timer_.Stop();
84 } 82 }
85 83
86 } // namespace ash 84 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698