OLD | NEW |
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 "chrome/browser/chromeos/login/ui/webui_login_display.h" | 5 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 8 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
10 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 10 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
11 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 11 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
12 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 12 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
13 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 13 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
16 #include "chromeos/ime/ime_keyboard.h" | 16 #include "chromeos/ime/ime_keyboard.h" |
17 #include "chromeos/ime/input_method_manager.h" | 17 #include "chromeos/ime/input_method_manager.h" |
18 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
22 #include "ui/wm/core/user_activity_detector.h" | 22 #include "ui/wm/core/user_activity_detector.h" |
23 | 23 |
24 namespace chromeos { | 24 namespace chromeos { |
25 | 25 |
| 26 namespace { |
| 27 |
| 28 const int kPasswordClearTimeoutSec = 60; |
| 29 |
| 30 } |
| 31 |
26 // WebUILoginDisplay, public: -------------------------------------------------- | 32 // WebUILoginDisplay, public: -------------------------------------------------- |
27 | 33 |
28 WebUILoginDisplay::~WebUILoginDisplay() { | 34 WebUILoginDisplay::~WebUILoginDisplay() { |
29 if (webui_handler_) | 35 if (webui_handler_) |
30 webui_handler_->ResetSigninScreenHandlerDelegate(); | 36 webui_handler_->ResetSigninScreenHandlerDelegate(); |
31 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()-> | 37 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()-> |
32 user_activity_detector(); | 38 user_activity_detector(); |
33 if (activity_detector->HasObserver(this)) | 39 if (activity_detector->HasObserver(this)) |
34 activity_detector->RemoveObserver(this); | 40 activity_detector->RemoveObserver(this); |
35 } | 41 } |
(...skipping 14 matching lines...) Expand all Loading... |
50 webui_handler_->ClearAndEnablePassword(); | 56 webui_handler_->ClearAndEnablePassword(); |
51 } | 57 } |
52 | 58 |
53 void WebUILoginDisplay::Init(const UserList& users, | 59 void WebUILoginDisplay::Init(const UserList& users, |
54 bool show_guest, | 60 bool show_guest, |
55 bool show_users, | 61 bool show_users, |
56 bool show_new_user) { | 62 bool show_new_user) { |
57 // Testing that the delegate has been set. | 63 // Testing that the delegate has been set. |
58 DCHECK(delegate_); | 64 DCHECK(delegate_); |
59 | 65 |
60 user_selection_screen_->Init(users, show_guest); | 66 user_selection_screen_->Init(users); |
61 show_guest_ = show_guest; | 67 show_guest_ = show_guest; |
62 show_users_ = show_users; | 68 show_users_ = show_users; |
63 show_new_user_ = show_new_user; | 69 show_new_user_ = show_new_user; |
64 | 70 |
65 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()-> | 71 wm::UserActivityDetector* activity_detector = ash::Shell::GetInstance()-> |
66 user_activity_detector(); | 72 user_activity_detector(); |
67 if (!activity_detector->HasObserver(this)) | 73 if (!activity_detector->HasObserver(this)) |
68 activity_detector->AddObserver(this); | 74 activity_detector->AddObserver(this); |
69 } | 75 } |
70 | 76 |
71 // ---- Common methods | 77 // ---- Common methods |
72 | 78 |
73 // ---- User selection screen methods | 79 // ---- User selection screen methods |
74 | 80 |
75 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { | 81 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { |
76 user_selection_screen_->OnBeforeUserRemoved(username); | 82 user_selection_screen_->OnBeforeUserRemoved(username); |
77 } | 83 } |
78 | 84 |
79 void WebUILoginDisplay::OnUserRemoved(const std::string& username) { | 85 void WebUILoginDisplay::OnUserRemoved(const std::string& username) { |
80 user_selection_screen_->OnUserRemoved(username); | 86 user_selection_screen_->OnUserRemoved(username); |
81 } | 87 } |
82 | 88 |
83 void WebUILoginDisplay::OnUserImageChanged(const User& user) { | 89 void WebUILoginDisplay::OnUserImageChanged(const User& user) { |
84 user_selection_screen_->OnUserImageChanged(user); | 90 user_selection_screen_->OnUserImageChanged(user); |
85 } | 91 } |
86 | 92 |
87 void WebUILoginDisplay::HandleGetUsers() { | 93 // User selection screen, screen lock API |
88 user_selection_screen_->HandleGetUsers(); | |
89 } | |
90 | 94 |
91 const UserList& WebUILoginDisplay::GetUsers() const { | 95 const UserList& WebUILoginDisplay::GetUsers() const { |
92 return user_selection_screen_->GetUsers(); | 96 return user_selection_screen_->GetUsers(); |
93 } | 97 } |
94 | 98 |
95 // User selection screen, screen lock API | |
96 | |
97 void WebUILoginDisplay::SetAuthType( | |
98 const std::string& username, | |
99 ScreenlockBridge::LockHandler::AuthType auth_type) { | |
100 user_selection_screen_->SetAuthType(username, auth_type); | |
101 } | |
102 | |
103 ScreenlockBridge::LockHandler::AuthType WebUILoginDisplay::GetAuthType( | |
104 const std::string& username) const { | |
105 return user_selection_screen_->GetAuthType(username); | |
106 } | |
107 | |
108 // ---- Gaia screen methods | 99 // ---- Gaia screen methods |
109 | 100 |
110 // ---- Not yet classified methods | 101 // ---- Not yet classified methods |
111 | 102 |
112 void WebUILoginDisplay::OnPreferencesChanged() { | 103 void WebUILoginDisplay::OnPreferencesChanged() { |
113 if (webui_handler_) | 104 if (webui_handler_) |
114 webui_handler_->OnPreferencesChanged(); | 105 webui_handler_->OnPreferencesChanged(); |
115 } | 106 } |
116 | 107 |
117 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { | 108 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 326 } |
336 | 327 |
337 bool WebUILoginDisplay::IsShowGuest() const { | 328 bool WebUILoginDisplay::IsShowGuest() const { |
338 return show_guest_; | 329 return show_guest_; |
339 } | 330 } |
340 | 331 |
341 bool WebUILoginDisplay::IsShowUsers() const { | 332 bool WebUILoginDisplay::IsShowUsers() const { |
342 return show_users_; | 333 return show_users_; |
343 } | 334 } |
344 | 335 |
| 336 bool WebUILoginDisplay::IsShowNewUser() const { |
| 337 return show_new_user_; |
| 338 } |
| 339 |
345 bool WebUILoginDisplay::IsSigninInProgress() const { | 340 bool WebUILoginDisplay::IsSigninInProgress() const { |
346 return delegate_->IsSigninInProgress(); | 341 return delegate_->IsSigninInProgress(); |
347 } | 342 } |
348 | 343 |
349 bool WebUILoginDisplay::IsUserSigninCompleted() const { | 344 bool WebUILoginDisplay::IsUserSigninCompleted() const { |
350 return is_signin_completed(); | 345 return is_signin_completed(); |
351 } | 346 } |
352 | 347 |
353 void WebUILoginDisplay::SetDisplayEmail(const std::string& email) { | 348 void WebUILoginDisplay::SetDisplayEmail(const std::string& email) { |
354 if (delegate_) | 349 if (delegate_) |
355 delegate_->SetDisplayEmail(email); | 350 delegate_->SetDisplayEmail(email); |
356 } | 351 } |
357 | 352 |
358 void WebUILoginDisplay::Signout() { | 353 void WebUILoginDisplay::Signout() { |
359 delegate_->Signout(); | 354 delegate_->Signout(); |
360 } | 355 } |
361 | 356 |
362 void WebUILoginDisplay::LoginAsKioskApp(const std::string& app_id, | 357 void WebUILoginDisplay::LoginAsKioskApp(const std::string& app_id, |
363 bool diagnostic_mode) { | 358 bool diagnostic_mode) { |
364 delegate_->LoginAsKioskApp(app_id, diagnostic_mode); | 359 delegate_->LoginAsKioskApp(app_id, diagnostic_mode); |
365 } | 360 } |
366 | 361 |
367 void WebUILoginDisplay::OnUserActivity(const ui::Event* event) { | 362 void WebUILoginDisplay::OnUserActivity(const ui::Event* event) { |
| 363 if (!password_clear_timer_.IsRunning()) |
| 364 StartPasswordClearTimer(); |
| 365 password_clear_timer_.Reset(); |
368 if (delegate_) | 366 if (delegate_) |
369 delegate_->ResetPublicSessionAutoLoginTimer(); | 367 delegate_->ResetPublicSessionAutoLoginTimer(); |
370 } | 368 } |
371 | 369 |
| 370 void WebUILoginDisplay::StartPasswordClearTimer() { |
| 371 DCHECK(!password_clear_timer_.IsRunning()); |
| 372 password_clear_timer_.Start(FROM_HERE, |
| 373 base::TimeDelta::FromSeconds(kPasswordClearTimeoutSec), this, |
| 374 &WebUILoginDisplay::OnPasswordClearTimerExpired); |
| 375 } |
| 376 |
| 377 void WebUILoginDisplay::OnPasswordClearTimerExpired() { |
| 378 if (webui_handler_) |
| 379 webui_handler_->ClearUserPodPassword(); |
| 380 } |
372 | 381 |
373 } // namespace chromeos | 382 } // namespace chromeos |
OLD | NEW |