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

Side by Side Diff: chrome/browser/chromeos/login/webui_login_display.cc

Issue 12321136: Password in user pods clears after minute of idle state. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 7 years, 9 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
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 "chrome/browser/chromeos/login/webui_login_display.h" 5 #include "chrome/browser/chromeos/login/webui_login_display.h"
6 6
7 #include "ash/wm/user_activity_detector.h"
7 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 8 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
8 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" 9 #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
9 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 10 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
10 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 11 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
11 #include "chrome/browser/chromeos/login/screen_locker.h" 12 #include "chrome/browser/chromeos/login/screen_locker.h"
12 #include "chrome/browser/chromeos/login/wallpaper_manager.h" 13 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
13 #include "chrome/browser/chromeos/login/webui_login_display_host.h" 14 #include "chrome/browser/chromeos/login/webui_login_display_host.h"
14 #include "chrome/browser/chromeos/login/webui_login_view.h" 15 #include "chrome/browser/chromeos/login/webui_login_view.h"
15 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
17 #include "grit/chromium_strings.h" 18 #include "grit/chromium_strings.h"
18 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
21 22
22 namespace chromeos { 23 namespace chromeos {
23 24
25 namespace {
26
27 const int kPasswordClearTimeoutSec = 60;
28
29 }
30
24 // WebUILoginDisplay, public: -------------------------------------------------- 31 // WebUILoginDisplay, public: --------------------------------------------------
25 32
26 WebUILoginDisplay::~WebUILoginDisplay() { 33 WebUILoginDisplay::~WebUILoginDisplay() {
27 if (webui_handler_) 34 if (webui_handler_)
28 webui_handler_->ResetSigninScreenHandlerDelegate(); 35 webui_handler_->ResetSigninScreenHandlerDelegate();
36 ash::UserActivityDetector* activity_detector = ash::Shell::GetInstance()->
37 user_activity_detector();
38 if (activity_detector->HasObserver(this))
39 activity_detector->RemoveObserver(this);
29 } 40 }
30 41
31 // LoginDisplay implementation: ------------------------------------------------ 42 // LoginDisplay implementation: ------------------------------------------------
32 43
33 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate) 44 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate)
34 : LoginDisplay(delegate, gfx::Rect()), 45 : LoginDisplay(delegate, gfx::Rect()),
35 show_guest_(false), 46 show_guest_(false),
36 show_new_user_(false), 47 show_new_user_(false),
37 webui_handler_(NULL) { 48 webui_handler_(NULL) {
38 } 49 }
39 50
40 void WebUILoginDisplay::Init(const UserList& users, 51 void WebUILoginDisplay::Init(const UserList& users,
41 bool show_guest, 52 bool show_guest,
42 bool show_users, 53 bool show_users,
43 bool show_new_user) { 54 bool show_new_user) {
44 // Testing that the delegate has been set. 55 // Testing that the delegate has been set.
45 DCHECK(delegate_); 56 DCHECK(delegate_);
46 57
47 users_ = users; 58 users_ = users;
48 show_guest_ = show_guest; 59 show_guest_ = show_guest;
49 show_users_ = show_users; 60 show_users_ = show_users;
50 show_new_user_ = show_new_user; 61 show_new_user_ = show_new_user;
62
63 ash::UserActivityDetector* activity_detector = ash::Shell::GetInstance()->
64 user_activity_detector();
65 if (!activity_detector->HasObserver(this))
66 activity_detector->AddObserver(this);
51 } 67 }
52 68
53 void WebUILoginDisplay::OnPreferencesChanged() { 69 void WebUILoginDisplay::OnPreferencesChanged() {
54 if (webui_handler_) 70 if (webui_handler_)
55 webui_handler_->OnPreferencesChanged(); 71 webui_handler_->OnPreferencesChanged();
56 } 72 }
57 73
58 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { 74 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) {
59 for (UserList::iterator it = users_.begin(); it != users_.end(); ++it) { 75 for (UserList::iterator it = users_.begin(); it != users_.end(); ++it) {
60 if ((*it)->email() == username) { 76 if ((*it)->email() == username) {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 328
313 void WebUILoginDisplay::SetDisplayEmail(const std::string& email) { 329 void WebUILoginDisplay::SetDisplayEmail(const std::string& email) {
314 if (delegate_) 330 if (delegate_)
315 delegate_->SetDisplayEmail(email); 331 delegate_->SetDisplayEmail(email);
316 } 332 }
317 333
318 void WebUILoginDisplay::Signout() { 334 void WebUILoginDisplay::Signout() {
319 delegate_->Signout(); 335 delegate_->Signout();
320 } 336 }
321 337
338 void WebUILoginDisplay::OnUserActivity() {
339 if (!password_clear_timer_.IsRunning())
340 StartPasswordClearTimer();
341 password_clear_timer_.Reset();
342 }
343
344 void WebUILoginDisplay::StartPasswordClearTimer() {
345 DCHECK(!password_clear_timer_.IsRunning());
346 password_clear_timer_.Start(FROM_HERE,
347 base::TimeDelta::FromSeconds(kPasswordClearTimeoutSec), this,
348 &WebUILoginDisplay::OnPasswordClearTimerExpired);
349 }
350
351 void WebUILoginDisplay::OnPasswordClearTimerExpired() {
352 if (webui_handler_)
353 webui_handler_->ClearUserPodPassword();
354 }
355
322 } // namespace chromeos 356 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_display.h ('k') | chrome/browser/resources/chromeos/login/display_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698