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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // A class to get events from ChromeOS when a user gets changed or added. | 226 // A class to get events from ChromeOS when a user gets changed or added. |
227 class ChromeLauncherControllerUserSwitchObserverChromeOS | 227 class ChromeLauncherControllerUserSwitchObserverChromeOS |
228 : public ChromeLauncherControllerUserSwitchObserver, | 228 : public ChromeLauncherControllerUserSwitchObserver, |
229 public chromeos::UserManager::UserSessionStateObserver, | 229 public chromeos::UserManager::UserSessionStateObserver, |
230 content::NotificationObserver { | 230 content::NotificationObserver { |
231 public: | 231 public: |
232 ChromeLauncherControllerUserSwitchObserverChromeOS( | 232 ChromeLauncherControllerUserSwitchObserverChromeOS( |
233 ChromeLauncherController* controller) | 233 ChromeLauncherController* controller) |
234 : controller_(controller) { | 234 : controller_(controller) { |
235 DCHECK(chromeos::UserManager::IsInitialized()); | 235 DCHECK(chromeos::UserManager::IsInitialized()); |
236 chromeos::UserManager::Get()->AddSessionStateObserver(this); | 236 chromeos::GetUserManager()->AddSessionStateObserver(this); |
237 // A UserAddedToSession notification can be sent before a profile is loaded. | 237 // A UserAddedToSession notification can be sent before a profile is loaded. |
238 // Since our observers require that we have already a profile, we might have | 238 // Since our observers require that we have already a profile, we might have |
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::GetUserManager()->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(const chromeos::User* added_user) OVERRIDE; |
250 | 250 |
251 // content::NotificationObserver overrides: | 251 // content::NotificationObserver overrides: |
252 virtual void Observe(int type, | 252 virtual void Observe(int type, |
253 const content::NotificationSource& source, | 253 const content::NotificationSource& source, |
254 const content::NotificationDetails& details) OVERRIDE; | 254 const content::NotificationDetails& details) OVERRIDE; |
255 | 255 |
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2060 } | 2060 } |
2061 | 2061 |
2062 void ChromeLauncherController::ReleaseProfile() { | 2062 void ChromeLauncherController::ReleaseProfile() { |
2063 if (app_sync_ui_state_) | 2063 if (app_sync_ui_state_) |
2064 app_sync_ui_state_->RemoveObserver(this); | 2064 app_sync_ui_state_->RemoveObserver(this); |
2065 | 2065 |
2066 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2066 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
2067 | 2067 |
2068 pref_change_registrar_.RemoveAll(); | 2068 pref_change_registrar_.RemoveAll(); |
2069 } | 2069 } |
OLD | NEW |