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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 398753004: [cros] Move User class to user_manager component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/ash/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // to postpone the notification until the ProfileManager lets us know that 239 // to postpone the notification until the ProfileManager lets us know that
240 // the profile for that newly added user was added to the ProfileManager. 240 // the profile for that newly added user was added to the ProfileManager.
241 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, 241 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED,
242 content::NotificationService::AllSources()); 242 content::NotificationService::AllSources());
243 } 243 }
244 virtual ~ChromeLauncherControllerUserSwitchObserverChromeOS() { 244 virtual ~ChromeLauncherControllerUserSwitchObserverChromeOS() {
245 chromeos::UserManager::Get()->RemoveSessionStateObserver(this); 245 chromeos::UserManager::Get()->RemoveSessionStateObserver(this);
246 } 246 }
247 247
248 // chromeos::UserManager::UserSessionStateObserver overrides: 248 // chromeos::UserManager::UserSessionStateObserver overrides:
249 virtual void UserAddedToSession(const chromeos::User* added_user) OVERRIDE; 249 virtual void UserAddedToSession(
250 const user_manager::User* added_user) OVERRIDE;
250 251
251 // content::NotificationObserver overrides: 252 // content::NotificationObserver overrides:
252 virtual void Observe(int type, 253 virtual void Observe(int type,
253 const content::NotificationSource& source, 254 const content::NotificationSource& source,
254 const content::NotificationDetails& details) OVERRIDE; 255 const content::NotificationDetails& details) OVERRIDE;
255 256
256 private: 257 private:
257 // Add a user to the session. 258 // Add a user to the session.
258 void AddUser(Profile* profile); 259 void AddUser(Profile* profile);
259 260
260 // The owning ChromeLauncherController. 261 // The owning ChromeLauncherController.
261 ChromeLauncherController* controller_; 262 ChromeLauncherController* controller_;
262 263
263 // The notification registrar to track the Profile creations after a user got 264 // The notification registrar to track the Profile creations after a user got
264 // added to the session (if required). 265 // added to the session (if required).
265 content::NotificationRegistrar registrar_; 266 content::NotificationRegistrar registrar_;
266 267
267 // Users which were just added to the system, but which profiles were not yet 268 // Users which were just added to the system, but which profiles were not yet
268 // (fully) loaded. 269 // (fully) loaded.
269 std::set<std::string> added_user_ids_waiting_for_profiles_; 270 std::set<std::string> added_user_ids_waiting_for_profiles_;
270 271
271 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerUserSwitchObserverChromeOS); 272 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerUserSwitchObserverChromeOS);
272 }; 273 };
273 274
274 void ChromeLauncherControllerUserSwitchObserverChromeOS::UserAddedToSession( 275 void ChromeLauncherControllerUserSwitchObserverChromeOS::UserAddedToSession(
275 const chromeos::User* active_user) { 276 const user_manager::User* active_user) {
276 Profile* profile = multi_user_util::GetProfileFromUserID( 277 Profile* profile = multi_user_util::GetProfileFromUserID(
277 active_user->email()); 278 active_user->email());
278 // If we do not have a profile yet, we postpone forwarding the notification 279 // If we do not have a profile yet, we postpone forwarding the notification
279 // until it is loaded. 280 // until it is loaded.
280 if (!profile) 281 if (!profile)
281 added_user_ids_waiting_for_profiles_.insert(active_user->email()); 282 added_user_ids_waiting_for_profiles_.insert(active_user->email());
282 else 283 else
283 AddUser(profile); 284 AddUser(profile);
284 } 285 }
285 286
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 } 2061 }
2061 2062
2062 void ChromeLauncherController::ReleaseProfile() { 2063 void ChromeLauncherController::ReleaseProfile() {
2063 if (app_sync_ui_state_) 2064 if (app_sync_ui_state_)
2064 app_sync_ui_state_->RemoveObserver(this); 2065 app_sync_ui_state_->RemoveObserver(this);
2065 2066
2066 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); 2067 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this);
2067 2068
2068 pref_change_registrar_.RemoveAll(); 2069 pref_change_registrar_.RemoveAll();
2069 } 2070 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698