| 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/screens/user_selection_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 : handler_(nullptr), | 117 : handler_(nullptr), |
| 118 login_display_delegate_(nullptr), | 118 login_display_delegate_(nullptr), |
| 119 view_(nullptr), | 119 view_(nullptr), |
| 120 display_type_(display_type), | 120 display_type_(display_type), |
| 121 weak_factory_(this) { | 121 weak_factory_(this) { |
| 122 } | 122 } |
| 123 | 123 |
| 124 UserSelectionScreen::~UserSelectionScreen() { | 124 UserSelectionScreen::~UserSelectionScreen() { |
| 125 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(nullptr); | 125 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(nullptr); |
| 126 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); | 126 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); |
| 127 if (activity_detector->HasObserver(this)) | 127 if (activity_detector && activity_detector->HasObserver(this)) |
| 128 activity_detector->RemoveObserver(this); | 128 activity_detector->RemoveObserver(this); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void UserSelectionScreen::InitEasyUnlock() { | 131 void UserSelectionScreen::InitEasyUnlock() { |
| 132 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(this); | 132 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(this); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void UserSelectionScreen::SetLoginDisplayDelegate( | 135 void UserSelectionScreen::SetLoginDisplayDelegate( |
| 136 LoginDisplay::Delegate* login_display_delegate) { | 136 LoginDisplay::Delegate* login_display_delegate) { |
| 137 login_display_delegate_ = login_display_delegate; | 137 login_display_delegate_ = login_display_delegate; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 void UserSelectionScreen::SetView(UserBoardView* view) { | 255 void UserSelectionScreen::SetView(UserBoardView* view) { |
| 256 view_ = view; | 256 view_ = view; |
| 257 } | 257 } |
| 258 | 258 |
| 259 void UserSelectionScreen::Init(const user_manager::UserList& users, | 259 void UserSelectionScreen::Init(const user_manager::UserList& users, |
| 260 bool show_guest) { | 260 bool show_guest) { |
| 261 users_ = users; | 261 users_ = users; |
| 262 show_guest_ = show_guest; | 262 show_guest_ = show_guest; |
| 263 | 263 |
| 264 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); | 264 ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); |
| 265 if (!activity_detector->HasObserver(this)) | 265 if (activity_detector && !activity_detector->HasObserver(this)) |
| 266 activity_detector->AddObserver(this); | 266 activity_detector->AddObserver(this); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void UserSelectionScreen::OnBeforeUserRemoved(const AccountId& account_id) { | 269 void UserSelectionScreen::OnBeforeUserRemoved(const AccountId& account_id) { |
| 270 for (user_manager::UserList::iterator it = users_.begin(); it != users_.end(); | 270 for (user_manager::UserList::iterator it = users_.begin(); it != users_.end(); |
| 271 ++it) { | 271 ++it) { |
| 272 if ((*it)->GetAccountId() == account_id) { | 272 if ((*it)->GetAccountId() == account_id) { |
| 273 users_.erase(it); | 273 users_.erase(it); |
| 274 break; | 274 break; |
| 275 } | 275 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 // The user profile should exist if and only if this is the lock screen. | 553 // The user profile should exist if and only if this is the lock screen. |
| 554 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 554 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
| 555 | 555 |
| 556 if (!profile) | 556 if (!profile) |
| 557 profile = profile_helper->GetSigninProfile(); | 557 profile = profile_helper->GetSigninProfile(); |
| 558 | 558 |
| 559 return EasyUnlockService::Get(profile); | 559 return EasyUnlockService::Get(profile); |
| 560 } | 560 } |
| 561 | 561 |
| 562 } // namespace chromeos | 562 } // namespace chromeos |
| OLD | NEW |