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