Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/chromeos/login/screens/user_selection_screen.cc

Issue 693643004: Make UserActivityDetector a singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_do_not_use_ash45
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) 108 wm::UserActivityDetector* activity_detector = wm::UserActivityDetector::Get();
110 // TODO(dpolukhin): crbug.com/408752
111 wm::UserActivityDetector* activity_detector =
112 ash::Shell::GetInstance()->user_activity_detector();
113 if (activity_detector->HasObserver(this)) 109 if (activity_detector->HasObserver(this))
114 activity_detector->RemoveObserver(this); 110 activity_detector->RemoveObserver(this);
115 #endif
116 } 111 }
117 112
118 // static 113 // static
119 void UserSelectionScreen::FillUserDictionary( 114 void UserSelectionScreen::FillUserDictionary(
120 user_manager::User* user, 115 user_manager::User* user,
121 bool is_owner, 116 bool is_owner,
122 bool is_signin_to_add, 117 bool is_signin_to_add,
123 ScreenlockBridge::LockHandler::AuthType auth_type, 118 ScreenlockBridge::LockHandler::AuthType auth_type,
124 const std::vector<std::string>* public_session_recommended_locales, 119 const std::vector<std::string>* public_session_recommended_locales,
125 base::DictionaryValue* user_dict) { 120 base::DictionaryValue* user_dict) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 198
204 void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) { 199 void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) {
205 handler_ = handler; 200 handler_ = handler;
206 } 201 }
207 202
208 void UserSelectionScreen::Init(const user_manager::UserList& users, 203 void UserSelectionScreen::Init(const user_manager::UserList& users,
209 bool show_guest) { 204 bool show_guest) {
210 users_ = users; 205 users_ = users;
211 show_guest_ = show_guest; 206 show_guest_ = show_guest;
212 207
213 #if !defined(USE_ATHENA) 208 wm::UserActivityDetector* activity_detector = wm::UserActivityDetector::Get();
214 // TODO(dpolukhin): crbug.com/408752
215 wm::UserActivityDetector* activity_detector =
216 ash::Shell::GetInstance()->user_activity_detector();
217 if (!activity_detector->HasObserver(this)) 209 if (!activity_detector->HasObserver(this))
218 activity_detector->AddObserver(this); 210 activity_detector->AddObserver(this);
219 #endif
220 } 211 }
221 212
222 void UserSelectionScreen::OnBeforeUserRemoved(const std::string& username) { 213 void UserSelectionScreen::OnBeforeUserRemoved(const std::string& username) {
223 for (user_manager::UserList::iterator it = users_.begin(); it != users_.end(); 214 for (user_manager::UserList::iterator it = users_.begin(); it != users_.end();
224 ++it) { 215 ++it) {
225 if ((*it)->email() == username) { 216 if ((*it)->email() == username) {
226 users_.erase(it); 217 users_.erase(it);
227 break; 218 break;
228 } 219 }
229 } 220 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 367 }
377 368
378 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType( 369 ScreenlockBridge::LockHandler::AuthType UserSelectionScreen::GetAuthType(
379 const std::string& username) const { 370 const std::string& username) const {
380 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) 371 if (user_auth_type_map_.find(username) == user_auth_type_map_.end())
381 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; 372 return ScreenlockBridge::LockHandler::OFFLINE_PASSWORD;
382 return user_auth_type_map_.find(username)->second; 373 return user_auth_type_map_.find(username)->second;
383 } 374 }
384 375
385 } // namespace chromeos 376 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc ('k') | chrome/browser/chromeos/login/ui/webui_login_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698