| 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 "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 7 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 9 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" | 9 #include "chrome/browser/chromeos/login/screens/chrome_user_selection_screen.h" |
| 10 #include "chrome/browser/chromeos/login/signin_screen_controller.h" | 10 #include "chrome/browser/chromeos/login/signin_screen_controller.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 29 | 29 |
| 30 namespace chromeos { | 30 namespace chromeos { |
| 31 | 31 |
| 32 // WebUILoginDisplay, public: -------------------------------------------------- | 32 // WebUILoginDisplay, public: -------------------------------------------------- |
| 33 | 33 |
| 34 WebUILoginDisplay::~WebUILoginDisplay() { | 34 WebUILoginDisplay::~WebUILoginDisplay() { |
| 35 if (webui_handler_) | 35 if (webui_handler_) |
| 36 webui_handler_->ResetSigninScreenHandlerDelegate(); | 36 webui_handler_->ResetSigninScreenHandlerDelegate(); |
| 37 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); | 37 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); |
| 38 if (activity_detector->HasObserver(this)) | 38 if (activity_detector && activity_detector->HasObserver(this)) |
| 39 activity_detector->RemoveObserver(this); | 39 activity_detector->RemoveObserver(this); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // LoginDisplay implementation: ------------------------------------------------ | 42 // LoginDisplay implementation: ------------------------------------------------ |
| 43 | 43 |
| 44 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate) | 44 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate) |
| 45 : LoginDisplay(delegate, gfx::Rect()) {} | 45 : LoginDisplay(delegate, gfx::Rect()) {} |
| 46 | 46 |
| 47 void WebUILoginDisplay::ClearAndEnablePassword() { | 47 void WebUILoginDisplay::ClearAndEnablePassword() { |
| 48 if (webui_handler_) | 48 if (webui_handler_) |
| 49 webui_handler_->ClearAndEnablePassword(); | 49 webui_handler_->ClearAndEnablePassword(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void WebUILoginDisplay::Init(const user_manager::UserList& users, | 52 void WebUILoginDisplay::Init(const user_manager::UserList& users, |
| 53 bool show_guest, | 53 bool show_guest, |
| 54 bool show_users, | 54 bool show_users, |
| 55 bool show_new_user) { | 55 bool show_new_user) { |
| 56 // Testing that the delegate has been set. | 56 // Testing that the delegate has been set. |
| 57 DCHECK(delegate_); | 57 DCHECK(delegate_); |
| 58 SignInScreenController::Get()->Init(users, show_guest); | 58 SignInScreenController::Get()->Init(users, show_guest); |
| 59 show_guest_ = show_guest; | 59 show_guest_ = show_guest; |
| 60 show_users_ = show_users; | 60 show_users_ = show_users; |
| 61 show_new_user_ = show_new_user; | 61 show_new_user_ = show_new_user; |
| 62 | 62 |
| 63 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); | 63 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); |
| 64 if (!activity_detector->HasObserver(this)) | 64 if (activity_detector && !activity_detector->HasObserver(this)) |
| 65 activity_detector->AddObserver(this); | 65 activity_detector->AddObserver(this); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // ---- Common methods | 68 // ---- Common methods |
| 69 | 69 |
| 70 // ---- User selection screen methods | 70 // ---- User selection screen methods |
| 71 | 71 |
| 72 void WebUILoginDisplay::HandleGetUsers() { | 72 void WebUILoginDisplay::HandleGetUsers() { |
| 73 SignInScreenController::Get()->SendUserList(); | 73 SignInScreenController::Get()->SendUserList(); |
| 74 } | 74 } |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 325 } |
| 326 | 326 |
| 327 bool WebUILoginDisplay::IsUserWhitelisted(const AccountId& account_id) { | 327 bool WebUILoginDisplay::IsUserWhitelisted(const AccountId& account_id) { |
| 328 DCHECK(delegate_); | 328 DCHECK(delegate_); |
| 329 if (delegate_) | 329 if (delegate_) |
| 330 return delegate_->IsUserWhitelisted(account_id); | 330 return delegate_->IsUserWhitelisted(account_id); |
| 331 return true; | 331 return true; |
| 332 } | 332 } |
| 333 | 333 |
| 334 } // namespace chromeos | 334 } // namespace chromeos |
| OLD | NEW |