OLD | NEW |
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "ash/wm/user_activity_observer.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/timer.h" |
12 #include "chrome/browser/chromeos/login/login_display.h" | 14 #include "chrome/browser/chromeos/login/login_display.h" |
13 #include "chrome/browser/chromeos/login/user.h" | 15 #include "chrome/browser/chromeos/login/user.h" |
14 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" | 16 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" |
15 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 17 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
16 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
17 | 19 |
18 namespace chromeos { | 20 namespace chromeos { |
19 // WebUI-based login UI implementation. | 21 // WebUI-based login UI implementation. |
20 class WebUILoginDisplay : public LoginDisplay, | 22 class WebUILoginDisplay : public LoginDisplay, |
21 public NativeWindowDelegate, | 23 public NativeWindowDelegate, |
22 public SigninScreenHandlerDelegate { | 24 public SigninScreenHandlerDelegate, |
| 25 public ash::UserActivityObserver { |
23 public: | 26 public: |
24 explicit WebUILoginDisplay(LoginDisplay::Delegate* delegate); | 27 explicit WebUILoginDisplay(LoginDisplay::Delegate* delegate); |
25 virtual ~WebUILoginDisplay(); | 28 virtual ~WebUILoginDisplay(); |
26 | 29 |
27 // LoginDisplay implementation: | 30 // LoginDisplay implementation: |
28 virtual void Init(const UserList& users, | 31 virtual void Init(const UserList& users, |
29 bool show_guest, | 32 bool show_guest, |
30 bool show_users, | 33 bool show_users, |
31 bool show_new_user) OVERRIDE; | 34 bool show_new_user) OVERRIDE; |
32 virtual void OnPreferencesChanged() OVERRIDE; | 35 virtual void OnPreferencesChanged() OVERRIDE; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 LoginDisplayWebUIHandler* webui_handler) OVERRIDE; | 74 LoginDisplayWebUIHandler* webui_handler) OVERRIDE; |
72 virtual void ShowSigninScreenForCreds(const std::string& username, | 75 virtual void ShowSigninScreenForCreds(const std::string& username, |
73 const std::string& password); | 76 const std::string& password); |
74 virtual const UserList& GetUsers() const OVERRIDE; | 77 virtual const UserList& GetUsers() const OVERRIDE; |
75 virtual bool IsShowGuest() const OVERRIDE; | 78 virtual bool IsShowGuest() const OVERRIDE; |
76 virtual bool IsShowUsers() const OVERRIDE; | 79 virtual bool IsShowUsers() const OVERRIDE; |
77 virtual bool IsShowNewUser() const OVERRIDE; | 80 virtual bool IsShowNewUser() const OVERRIDE; |
78 virtual void SetDisplayEmail(const std::string& email) OVERRIDE; | 81 virtual void SetDisplayEmail(const std::string& email) OVERRIDE; |
79 virtual void Signout() OVERRIDE; | 82 virtual void Signout() OVERRIDE; |
80 | 83 |
| 84 // UserActivityDetector implementation: |
| 85 virtual void OnUserActivity() OVERRIDE; |
| 86 |
81 private: | 87 private: |
| 88 void StartPasswordClearTimer(); |
| 89 void OnPasswordClearTimerExpired(); |
| 90 |
82 // Set of Users that are visible. | 91 // Set of Users that are visible. |
83 UserList users_; | 92 UserList users_; |
84 | 93 |
85 // Whether to show guest login. | 94 // Whether to show guest login. |
86 bool show_guest_; | 95 bool show_guest_; |
87 | 96 |
88 // Weather to show the user pads or a plain credentials dialogue. | 97 // Weather to show the user pads or a plain credentials dialogue. |
89 bool show_users_; | 98 bool show_users_; |
90 | 99 |
91 // Whether to show add new user. | 100 // Whether to show add new user. |
92 bool show_new_user_; | 101 bool show_new_user_; |
93 | 102 |
| 103 // Timer for measuring idle state duration before password clear. |
| 104 base::OneShotTimer<WebUILoginDisplay> password_clear_timer_; |
| 105 |
94 // Reference to the WebUI handling layer for the login screen | 106 // Reference to the WebUI handling layer for the login screen |
95 LoginDisplayWebUIHandler* webui_handler_; | 107 LoginDisplayWebUIHandler* webui_handler_; |
96 | 108 |
97 DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplay); | 109 DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplay); |
98 }; | 110 }; |
99 | 111 |
100 } // namespace chromeos | 112 } // namespace chromeos |
101 | 113 |
102 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ | 114 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ |
OLD | NEW |