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