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