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

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

Issue 2098023002: mash: Migrate remaining tray observers and notify functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. 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
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/last_window_closed_logout_reminder.h" 5 #include "ash/system/chromeos/session/last_window_closed_logout_reminder.h"
6 6
7 #include "ash/common/login_status.h" 7 #include "ash/common/login_status.h"
8 #include "ash/common/system/tray/system_tray_delegate.h" 8 #include "ash/common/system/tray/system_tray_delegate.h"
9 #include "ash/common/system/tray/system_tray_notifier.h"
9 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/system/chromeos/session/logout_confirmation_controller.h" 12 #include "ash/system/chromeos/session/logout_confirmation_controller.h"
12 #include "ash/system/tray/system_tray_notifier.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 14
15 namespace ash { 15 namespace ash {
16 namespace { 16 namespace {
17 const int kLogoutConfirmationDelayInSeconds = 20; 17 const int kLogoutConfirmationDelayInSeconds = 20;
18 } 18 }
19 19
20 LastWindowClosedLogoutReminder::LastWindowClosedLogoutReminder() { 20 LastWindowClosedLogoutReminder::LastWindowClosedLogoutReminder() {
21 Shell::GetInstance()->system_tray_notifier()->AddLastWindowClosedObserver( 21 WmShell::Get()->system_tray_notifier()->AddLastWindowClosedObserver(this);
22 this);
23 } 22 }
24 23
25 LastWindowClosedLogoutReminder::~LastWindowClosedLogoutReminder() { 24 LastWindowClosedLogoutReminder::~LastWindowClosedLogoutReminder() {
26 Shell::GetInstance()->system_tray_notifier()->RemoveLastWindowClosedObserver( 25 WmShell::Get()->system_tray_notifier()->RemoveLastWindowClosedObserver(this);
27 this);
28 } 26 }
29 27
30 void LastWindowClosedLogoutReminder::OnLastWindowClosed() { 28 void LastWindowClosedLogoutReminder::OnLastWindowClosed() {
31 if (WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != 29 if (WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() !=
32 LoginStatus::PUBLIC) { 30 LoginStatus::PUBLIC) {
33 return; 31 return;
34 } 32 }
35 33
36 // Ask the user to confirm logout if a public session is in progress and the 34 // Ask the user to confirm logout if a public session is in progress and the
37 // screen is not locked. 35 // screen is not locked.
38 Shell::GetInstance()->logout_confirmation_controller()->ConfirmLogout( 36 Shell::GetInstance()->logout_confirmation_controller()->ConfirmLogout(
39 base::TimeTicks::Now() + 37 base::TimeTicks::Now() +
40 base::TimeDelta::FromSeconds(kLogoutConfirmationDelayInSeconds)); 38 base::TimeDelta::FromSeconds(kLogoutConfirmationDelayInSeconds));
41 } 39 }
42 40
43 } // namespace ash 41 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698