| OLD | NEW |
| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 : controller_(controller) { | 279 : controller_(controller) { |
| 280 DCHECK(user_manager::UserManager::IsInitialized()); | 280 DCHECK(user_manager::UserManager::IsInitialized()); |
| 281 user_manager::UserManager::Get()->AddSessionStateObserver(this); | 281 user_manager::UserManager::Get()->AddSessionStateObserver(this); |
| 282 // A UserAddedToSession notification can be sent before a profile is loaded. | 282 // A UserAddedToSession notification can be sent before a profile is loaded. |
| 283 // Since our observers require that we have already a profile, we might have | 283 // Since our observers require that we have already a profile, we might have |
| 284 // to postpone the notification until the ProfileManager lets us know that | 284 // to postpone the notification until the ProfileManager lets us know that |
| 285 // the profile for that newly added user was added to the ProfileManager. | 285 // the profile for that newly added user was added to the ProfileManager. |
| 286 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, | 286 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, |
| 287 content::NotificationService::AllSources()); | 287 content::NotificationService::AllSources()); |
| 288 } | 288 } |
| 289 virtual ~ChromeLauncherControllerUserSwitchObserverChromeOS() { | 289 ~ChromeLauncherControllerUserSwitchObserverChromeOS() override { |
| 290 user_manager::UserManager::Get()->RemoveSessionStateObserver(this); | 290 user_manager::UserManager::Get()->RemoveSessionStateObserver(this); |
| 291 } | 291 } |
| 292 | 292 |
| 293 // user_manager::UserManager::UserSessionStateObserver overrides: | 293 // user_manager::UserManager::UserSessionStateObserver overrides: |
| 294 virtual void UserAddedToSession( | 294 void UserAddedToSession(const user_manager::User* added_user) override; |
| 295 const user_manager::User* added_user) override; | |
| 296 | 295 |
| 297 // content::NotificationObserver overrides: | 296 // content::NotificationObserver overrides: |
| 298 virtual void Observe(int type, | 297 void Observe(int type, |
| 299 const content::NotificationSource& source, | 298 const content::NotificationSource& source, |
| 300 const content::NotificationDetails& details) override; | 299 const content::NotificationDetails& details) override; |
| 301 | 300 |
| 302 private: | 301 private: |
| 303 // Add a user to the session. | 302 // Add a user to the session. |
| 304 void AddUser(Profile* profile); | 303 void AddUser(Profile* profile); |
| 305 | 304 |
| 306 // The owning ChromeLauncherController. | 305 // The owning ChromeLauncherController. |
| 307 ChromeLauncherController* controller_; | 306 ChromeLauncherController* controller_; |
| 308 | 307 |
| (...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 void ChromeLauncherController::ReleaseProfile() { | 2127 void ChromeLauncherController::ReleaseProfile() { |
| 2129 if (app_sync_ui_state_) | 2128 if (app_sync_ui_state_) |
| 2130 app_sync_ui_state_->RemoveObserver(this); | 2129 app_sync_ui_state_->RemoveObserver(this); |
| 2131 | 2130 |
| 2132 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2131 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
| 2133 | 2132 |
| 2134 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2133 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
| 2135 | 2134 |
| 2136 pref_change_registrar_.RemoveAll(); | 2135 pref_change_registrar_.RemoveAll(); |
| 2137 } | 2136 } |
| OLD | NEW |