| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 user_dict->Set(kKeyInitialKeyboardLayout, | 100 user_dict->Set(kKeyInitialKeyboardLayout, |
| 101 GetCurrentKeyboardLayout().release()); | 101 GetCurrentKeyboardLayout().release()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace | 104 } // namespace |
| 105 | 105 |
| 106 UserSelectionScreen::UserSelectionScreen() : handler_(NULL) { | 106 UserSelectionScreen::UserSelectionScreen() : handler_(NULL) { |
| 107 } | 107 } |
| 108 | 108 |
| 109 UserSelectionScreen::~UserSelectionScreen() { | 109 UserSelectionScreen::~UserSelectionScreen() { |
| 110 #if !defined(USE_ATHENA) |
| 110 wm::UserActivityDetector* activity_detector = | 111 wm::UserActivityDetector* activity_detector = |
| 111 ash::Shell::GetInstance()->user_activity_detector(); | 112 ash::Shell::GetInstance()->user_activity_detector(); |
| 112 if (activity_detector->HasObserver(this)) | 113 if (activity_detector->HasObserver(this)) |
| 113 activity_detector->RemoveObserver(this); | 114 activity_detector->RemoveObserver(this); |
| 115 #endif |
| 114 } | 116 } |
| 115 | 117 |
| 116 // static | 118 // static |
| 117 void UserSelectionScreen::FillUserDictionary( | 119 void UserSelectionScreen::FillUserDictionary( |
| 118 user_manager::User* user, | 120 user_manager::User* user, |
| 119 bool is_owner, | 121 bool is_owner, |
| 120 bool is_signin_to_add, | 122 bool is_signin_to_add, |
| 121 ScreenlockBridge::LockHandler::AuthType auth_type, | 123 ScreenlockBridge::LockHandler::AuthType auth_type, |
| 122 const std::vector<std::string>* public_session_recommended_locales, | 124 const std::vector<std::string>* public_session_recommended_locales, |
| 123 base::DictionaryValue* user_dict) { | 125 base::DictionaryValue* user_dict) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 203 |
| 202 void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) { | 204 void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) { |
| 203 handler_ = handler; | 205 handler_ = handler; |
| 204 } | 206 } |
| 205 | 207 |
| 206 void UserSelectionScreen::Init(const user_manager::UserList& users, | 208 void UserSelectionScreen::Init(const user_manager::UserList& users, |
| 207 bool show_guest) { | 209 bool show_guest) { |
| 208 users_ = users; | 210 users_ = users; |
| 209 show_guest_ = show_guest; | 211 show_guest_ = show_guest; |
| 210 | 212 |
| 213 #if !defined(USE_ATHENA) |
| 211 wm::UserActivityDetector* activity_detector = | 214 wm::UserActivityDetector* activity_detector = |
| 212 ash::Shell::GetInstance()->user_activity_detector(); | 215 ash::Shell::GetInstance()->user_activity_detector(); |
| 213 if (!activity_detector->HasObserver(this)) | 216 if (!activity_detector->HasObserver(this)) |
| 214 activity_detector->AddObserver(this); | 217 activity_detector->AddObserver(this); |
| 218 #endif |
| 215 } | 219 } |
| 216 | 220 |
| 217 void UserSelectionScreen::OnBeforeUserRemoved(const std::string& username) { | 221 void UserSelectionScreen::OnBeforeUserRemoved(const std::string& username) { |
| 218 for (user_manager::UserList::iterator it = users_.begin(); it != users_.end(); | 222 for (user_manager::UserList::iterator it = users_.begin(); it != users_.end(); |
| 219 ++it) { | 223 ++it) { |
| 220 if ((*it)->email() == username) { | 224 if ((*it)->email() == username) { |
| 221 users_.erase(it); | 225 users_.erase(it); |
| 222 break; | 226 break; |
| 223 } | 227 } |
| 224 } | 228 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 } | 375 } |
| 372 | 376 |
| 373 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( | 377 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( |
| 374 const std::string& username) const { | 378 const std::string& username) const { |
| 375 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) | 379 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) |
| 376 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; | 380 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; |
| 377 return user_auth_type_map_.find(username)->second; | 381 return user_auth_type_map_.find(username)->second; |
| 378 } | 382 } |
| 379 | 383 |
| 380 } // namespace chromeos | 384 } // namespace chromeos |
| OLD | NEW |