| 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/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/magnifier_key_scroller.h" | 7 #include "ash/accelerators/magnifier_key_scroller.h" |
| 8 #include "ash/accelerators/spoken_feedback_toggler.h" | 8 #include "ash/accelerators/spoken_feedback_toggler.h" |
| 9 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
| 10 #include "ash/media_delegate.h" | |
| 11 #include "ash/wm/mru_window_tracker.h" | 10 #include "ash/wm/mru_window_tracker.h" |
| 12 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
| 13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 14 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 15 #include "chrome/browser/accessibility/accessibility_events.h" | 14 #include "chrome/browser/accessibility/accessibility_events.h" |
| 16 #include "chrome/browser/app_mode/app_mode_utils.h" | 15 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 17 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 18 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 17 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 19 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 18 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 20 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" | 19 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
| 21 #include "chrome/browser/chromeos/display/display_configuration_observer.h" | 20 #include "chrome/browser/chromeos/display/display_configuration_observer.h" |
| 22 #include "chrome/browser/chromeos/display/display_preferences.h" | 21 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 23 #include "chrome/browser/chromeos/extensions/media_player_api.h" | |
| 24 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | |
| 25 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 22 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
| 28 #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" | 25 #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" |
| 29 #include "chrome/browser/speech/tts_controller.h" | 26 #include "chrome/browser/speech/tts_controller.h" |
| 30 #include "chrome/browser/sync/sync_error_notifier_factory_ash.h" | 27 #include "chrome/browser/sync/sync_error_notifier_factory_ash.h" |
| 31 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" | 28 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" |
| 29 #include "chrome/browser/ui/ash/media_delegate_chromeos.h" |
| 32 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" | 30 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" |
| 33 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" | 31 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
| 34 #include "chrome/browser/ui/browser.h" | 32 #include "chrome/browser/ui/browser.h" |
| 35 #include "chrome/browser/ui/browser_finder.h" | 33 #include "chrome/browser/ui/browser_finder.h" |
| 36 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
| 37 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
| 38 #include "chromeos/chromeos_switches.h" | 36 #include "chromeos/chromeos_switches.h" |
| 39 #include "chromeos/ime/input_method_manager.h" | 37 #include "chromeos/ime/input_method_manager.h" |
| 40 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
| 41 #include "content/public/browser/user_metrics.h" | 39 #include "content/public/browser/user_metrics.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 } | 200 } |
| 203 | 201 |
| 204 virtual base::TimeDelta PlayShutdownSound() const OVERRIDE { | 202 virtual base::TimeDelta PlayShutdownSound() const OVERRIDE { |
| 205 return chromeos::AccessibilityManager::Get()->PlayShutdownSound(); | 203 return chromeos::AccessibilityManager::Get()->PlayShutdownSound(); |
| 206 } | 204 } |
| 207 | 205 |
| 208 private: | 206 private: |
| 209 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); | 207 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); |
| 210 }; | 208 }; |
| 211 | 209 |
| 212 class MediaDelegateImpl : public ash::MediaDelegate { | |
| 213 public: | |
| 214 MediaDelegateImpl() {} | |
| 215 virtual ~MediaDelegateImpl() {} | |
| 216 | |
| 217 virtual void HandleMediaNextTrack() OVERRIDE { | |
| 218 extensions::MediaPlayerAPI::Get( | |
| 219 ProfileManager::GetActiveUserProfile())-> | |
| 220 media_player_event_router()->NotifyNextTrack(); | |
| 221 } | |
| 222 | |
| 223 virtual void HandleMediaPlayPause() OVERRIDE { | |
| 224 extensions::MediaPlayerAPI::Get( | |
| 225 ProfileManager::GetActiveUserProfile())-> | |
| 226 media_player_event_router()->NotifyTogglePlayState(); | |
| 227 } | |
| 228 | |
| 229 virtual void HandleMediaPrevTrack() OVERRIDE { | |
| 230 extensions::MediaPlayerAPI::Get( | |
| 231 ProfileManager::GetActiveUserProfile())-> | |
| 232 media_player_event_router()->NotifyPrevTrack(); | |
| 233 } | |
| 234 | |
| 235 private: | |
| 236 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); | |
| 237 }; | |
| 238 | |
| 239 } // anonymous namespace | 210 } // anonymous namespace |
| 240 | 211 |
| 241 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { | 212 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { |
| 242 return CommandLine::ForCurrentProcess()->HasSwitch( | 213 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 243 chromeos::switches::kFirstExecAfterBoot); | 214 chromeos::switches::kFirstExecAfterBoot); |
| 244 } | 215 } |
| 245 | 216 |
| 246 void ChromeShellDelegate::PreInit() { | 217 void ChromeShellDelegate::PreInit() { |
| 247 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); | 218 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); |
| 248 // Set the observer now so that we can save the initial state | 219 // Set the observer now so that we can save the initial state |
| (...skipping 12 matching lines...) Expand all Loading... |
| 261 | 232 |
| 262 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { | 233 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { |
| 263 return new AccessibilityDelegateImpl; | 234 return new AccessibilityDelegateImpl; |
| 264 } | 235 } |
| 265 | 236 |
| 266 ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() { | 237 ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() { |
| 267 return new ChromeNewWindowDelegateChromeos; | 238 return new ChromeNewWindowDelegateChromeos; |
| 268 } | 239 } |
| 269 | 240 |
| 270 ash::MediaDelegate* ChromeShellDelegate::CreateMediaDelegate() { | 241 ash::MediaDelegate* ChromeShellDelegate::CreateMediaDelegate() { |
| 271 return new MediaDelegateImpl; | 242 return new MediaDelegateChromeOS; |
| 272 } | 243 } |
| 273 | 244 |
| 274 ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate() { | 245 ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate() { |
| 275 return chromeos::CreateSystemTrayDelegate(); | 246 return chromeos::CreateSystemTrayDelegate(); |
| 276 } | 247 } |
| 277 | 248 |
| 278 ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() { | 249 ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() { |
| 279 return chromeos::CreateUserWallpaperDelegate(); | 250 return chromeos::CreateUserWallpaperDelegate(); |
| 280 } | 251 } |
| 281 | 252 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 304 } | 275 } |
| 305 | 276 |
| 306 void ChromeShellDelegate::PlatformInit() { | 277 void ChromeShellDelegate::PlatformInit() { |
| 307 registrar_.Add(this, | 278 registrar_.Add(this, |
| 308 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 279 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 309 content::NotificationService::AllSources()); | 280 content::NotificationService::AllSources()); |
| 310 registrar_.Add(this, | 281 registrar_.Add(this, |
| 311 chrome::NOTIFICATION_SESSION_STARTED, | 282 chrome::NOTIFICATION_SESSION_STARTED, |
| 312 content::NotificationService::AllSources()); | 283 content::NotificationService::AllSources()); |
| 313 } | 284 } |
| OLD | NEW |