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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #include "grit/ui_resources.h" | 84 #include "grit/ui_resources.h" |
85 #include "net/base/url_util.h" | 85 #include "net/base/url_util.h" |
86 #include "ui/aura/window.h" | 86 #include "ui/aura/window.h" |
87 #include "ui/aura/window_event_dispatcher.h" | 87 #include "ui/aura/window_event_dispatcher.h" |
88 #include "ui/base/l10n/l10n_util.h" | 88 #include "ui/base/l10n/l10n_util.h" |
89 #include "ui/keyboard/keyboard_util.h" | 89 #include "ui/keyboard/keyboard_util.h" |
90 #include "ui/wm/core/window_animations.h" | 90 #include "ui/wm/core/window_animations.h" |
91 | 91 |
92 #if defined(OS_CHROMEOS) | 92 #if defined(OS_CHROMEOS) |
93 #include "chrome/browser/browser_process.h" | 93 #include "chrome/browser/browser_process.h" |
94 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
95 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" | 94 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
96 #include "chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_contr
oller.h" | 95 #include "chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_contr
oller.h" |
97 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h" | 96 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h" |
| 97 #include "components/user_manager/user_manager.h" |
98 #endif | 98 #endif |
99 | 99 |
100 using extensions::Extension; | 100 using extensions::Extension; |
101 using extensions::UnloadedExtensionInfo; | 101 using extensions::UnloadedExtensionInfo; |
102 using extension_misc::kGmailAppId; | 102 using extension_misc::kGmailAppId; |
103 using content::WebContents; | 103 using content::WebContents; |
104 | 104 |
105 // static | 105 // static |
106 ChromeLauncherController* ChromeLauncherController::instance_ = NULL; | 106 ChromeLauncherController* ChromeLauncherController::instance_ = NULL; |
107 | 107 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 default: return std::string(); | 262 default: return std::string(); |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 } // namespace | 266 } // namespace |
267 | 267 |
268 #if defined(OS_CHROMEOS) | 268 #if defined(OS_CHROMEOS) |
269 // A class to get events from ChromeOS when a user gets changed or added. | 269 // A class to get events from ChromeOS when a user gets changed or added. |
270 class ChromeLauncherControllerUserSwitchObserverChromeOS | 270 class ChromeLauncherControllerUserSwitchObserverChromeOS |
271 : public ChromeLauncherControllerUserSwitchObserver, | 271 : public ChromeLauncherControllerUserSwitchObserver, |
272 public chromeos::UserManager::UserSessionStateObserver, | 272 public user_manager::UserManager::UserSessionStateObserver, |
273 content::NotificationObserver { | 273 content::NotificationObserver { |
274 public: | 274 public: |
275 ChromeLauncherControllerUserSwitchObserverChromeOS( | 275 ChromeLauncherControllerUserSwitchObserverChromeOS( |
276 ChromeLauncherController* controller) | 276 ChromeLauncherController* controller) |
277 : controller_(controller) { | 277 : controller_(controller) { |
278 DCHECK(chromeos::UserManager::IsInitialized()); | 278 DCHECK(user_manager::UserManager::IsInitialized()); |
279 chromeos::UserManager::Get()->AddSessionStateObserver(this); | 279 user_manager::UserManager::Get()->AddSessionStateObserver(this); |
280 // A UserAddedToSession notification can be sent before a profile is loaded. | 280 // A UserAddedToSession notification can be sent before a profile is loaded. |
281 // Since our observers require that we have already a profile, we might have | 281 // Since our observers require that we have already a profile, we might have |
282 // to postpone the notification until the ProfileManager lets us know that | 282 // to postpone the notification until the ProfileManager lets us know that |
283 // the profile for that newly added user was added to the ProfileManager. | 283 // the profile for that newly added user was added to the ProfileManager. |
284 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, | 284 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, |
285 content::NotificationService::AllSources()); | 285 content::NotificationService::AllSources()); |
286 } | 286 } |
287 virtual ~ChromeLauncherControllerUserSwitchObserverChromeOS() { | 287 virtual ~ChromeLauncherControllerUserSwitchObserverChromeOS() { |
288 chromeos::UserManager::Get()->RemoveSessionStateObserver(this); | 288 user_manager::UserManager::Get()->RemoveSessionStateObserver(this); |
289 } | 289 } |
290 | 290 |
291 // chromeos::UserManager::UserSessionStateObserver overrides: | 291 // user_manager::UserManager::UserSessionStateObserver overrides: |
292 virtual void UserAddedToSession( | 292 virtual void UserAddedToSession( |
293 const user_manager::User* added_user) OVERRIDE; | 293 const user_manager::User* added_user) OVERRIDE; |
294 | 294 |
295 // content::NotificationObserver overrides: | 295 // content::NotificationObserver overrides: |
296 virtual void Observe(int type, | 296 virtual void Observe(int type, |
297 const content::NotificationSource& source, | 297 const content::NotificationSource& source, |
298 const content::NotificationDetails& details) OVERRIDE; | 298 const content::NotificationDetails& details) OVERRIDE; |
299 | 299 |
300 private: | 300 private: |
301 // Add a user to the session. | 301 // Add a user to the session. |
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 } | 2095 } |
2096 | 2096 |
2097 void ChromeLauncherController::ReleaseProfile() { | 2097 void ChromeLauncherController::ReleaseProfile() { |
2098 if (app_sync_ui_state_) | 2098 if (app_sync_ui_state_) |
2099 app_sync_ui_state_->RemoveObserver(this); | 2099 app_sync_ui_state_->RemoveObserver(this); |
2100 | 2100 |
2101 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2101 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
2102 | 2102 |
2103 pref_change_registrar_.RemoveAll(); | 2103 pref_change_registrar_.RemoveAll(); |
2104 } | 2104 } |
OLD | NEW |