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

Side by Side Diff: chrome/browser/chromeos/ui/idle_logout_dialog_view.h

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_
7
8 #include "base/gtest_prod_util.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/timer/timer.h"
11 #include "ui/views/window/dialog_delegate.h"
12
13 namespace base {
14 class TimeDelta;
15 }
16 namespace views {
17 class Label;
18 }
19
20 namespace chromeos {
21
22 class IdleLogoutDialogView;
23 class KioskModeSettings;
24
25 // A class that holds the settings for IdleLogoutDialogView; this class
26 // can be overridden with a mock for testing.
27 class IdleLogoutSettingsProvider {
28 public:
29 IdleLogoutSettingsProvider();
30 virtual ~IdleLogoutSettingsProvider();
31
32 virtual base::TimeDelta GetCountdownUpdateInterval();
33 virtual KioskModeSettings* GetKioskModeSettings();
34 virtual void LogoutCurrentUser(IdleLogoutDialogView* dialog);
35
36 private:
37 DISALLOW_COPY_AND_ASSIGN(IdleLogoutSettingsProvider);
38 };
39
40 // A class to show the logout on idle dialog if the machine is in retail mode.
41 class IdleLogoutDialogView : public views::DialogDelegateView {
42 public:
43 static void ShowDialog();
44 static void CloseDialog();
45
46 // views::DialogDelegateView:
47 virtual int GetDialogButtons() const OVERRIDE;
48 virtual ui::ModalType GetModalType() const OVERRIDE;
49 virtual base::string16 GetWindowTitle() const OVERRIDE;
50 virtual bool Close() OVERRIDE;
51
52 private:
53 friend class MockIdleLogoutSettingsProvider;
54 friend class IdleLogoutDialogViewTest;
55 FRIEND_TEST_ALL_PREFIXES(IdleLogoutDialogViewTest, ShowDialogAndCloseView);
56 FRIEND_TEST_ALL_PREFIXES(IdleLogoutDialogViewTest,
57 ShowDialogAndCloseViewClose);
58
59 IdleLogoutDialogView();
60 virtual ~IdleLogoutDialogView();
61
62 // Adds the labels and adds them to the layout.
63 void InitAndShow();
64
65 void Show();
66
67 void UpdateCountdown();
68
69 // For testing.
70 static IdleLogoutDialogView* current_instance();
71 static void set_settings_provider(IdleLogoutSettingsProvider* provider);
72
73 views::Label* restart_label_;
74
75 // Time at which the countdown is over and we should close the dialog.
76 base::Time countdown_end_time_;
77
78 base::RepeatingTimer<IdleLogoutDialogView> timer_;
79
80 static IdleLogoutSettingsProvider* provider_;
81
82 base::WeakPtrFactory<IdleLogoutDialogView> weak_ptr_factory_;
83
84 DISALLOW_COPY_AND_ASSIGN(IdleLogoutDialogView);
85 };
86
87 } // namespace chromeos
88
89 #endif // CHROME_BROWSER_CHROMEOS_UI_IDLE_LOGOUT_DIALOG_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698