| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 192 } |
| 195 | 193 |
| 196 virtual base::TimeDelta PlayShutdownSound() const OVERRIDE { | 194 virtual base::TimeDelta PlayShutdownSound() const OVERRIDE { |
| 197 return chromeos::AccessibilityManager::Get()->PlayShutdownSound(); | 195 return chromeos::AccessibilityManager::Get()->PlayShutdownSound(); |
| 198 } | 196 } |
| 199 | 197 |
| 200 private: | 198 private: |
| 201 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); | 199 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); |
| 202 }; | 200 }; |
| 203 | 201 |
| 204 class MediaDelegateImpl : public ash::MediaDelegate { | |
| 205 public: | |
| 206 MediaDelegateImpl() {} | |
| 207 virtual ~MediaDelegateImpl() {} | |
| 208 | |
| 209 virtual void HandleMediaNextTrack() OVERRIDE { | |
| 210 extensions::MediaPlayerAPI::Get( | |
| 211 ProfileManager::GetActiveUserProfile())-> | |
| 212 media_player_event_router()->NotifyNextTrack(); | |
| 213 } | |
| 214 | |
| 215 virtual void HandleMediaPlayPause() OVERRIDE { | |
| 216 extensions::MediaPlayerAPI::Get( | |
| 217 ProfileManager::GetActiveUserProfile())-> | |
| 218 media_player_event_router()->NotifyTogglePlayState(); | |
| 219 } | |
| 220 | |
| 221 virtual void HandleMediaPrevTrack() OVERRIDE { | |
| 222 extensions::MediaPlayerAPI::Get( | |
| 223 ProfileManager::GetActiveUserProfile())-> | |
| 224 media_player_event_router()->NotifyPrevTrack(); | |
| 225 } | |
| 226 | |
| 227 private: | |
| 228 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); | |
| 229 }; | |
| 230 | |
| 231 } // anonymous namespace | 202 } // anonymous namespace |
| 232 | 203 |
| 233 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { | 204 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { |
| 234 return CommandLine::ForCurrentProcess()->HasSwitch( | 205 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 235 chromeos::switches::kFirstExecAfterBoot); | 206 chromeos::switches::kFirstExecAfterBoot); |
| 236 } | 207 } |
| 237 | 208 |
| 238 void ChromeShellDelegate::PreInit() { | 209 void ChromeShellDelegate::PreInit() { |
| 239 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); | 210 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); |
| 240 // Set the observer now so that we can save the initial state | 211 // Set the observer now so that we can save the initial state |
| (...skipping 12 matching lines...) Expand all Loading... |
| 253 | 224 |
| 254 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { | 225 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { |
| 255 return new AccessibilityDelegateImpl; | 226 return new AccessibilityDelegateImpl; |
| 256 } | 227 } |
| 257 | 228 |
| 258 ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() { | 229 ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() { |
| 259 return new ChromeNewWindowDelegateChromeos; | 230 return new ChromeNewWindowDelegateChromeos; |
| 260 } | 231 } |
| 261 | 232 |
| 262 ash::MediaDelegate* ChromeShellDelegate::CreateMediaDelegate() { | 233 ash::MediaDelegate* ChromeShellDelegate::CreateMediaDelegate() { |
| 263 return new MediaDelegateImpl; | 234 return new MediaDelegateChromeOS; |
| 264 } | 235 } |
| 265 | 236 |
| 266 ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate() { | 237 ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate() { |
| 267 return chromeos::CreateSystemTrayDelegate(); | 238 return chromeos::CreateSystemTrayDelegate(); |
| 268 } | 239 } |
| 269 | 240 |
| 270 ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() { | 241 ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() { |
| 271 return chromeos::CreateUserWallpaperDelegate(); | 242 return chromeos::CreateUserWallpaperDelegate(); |
| 272 } | 243 } |
| 273 | 244 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 296 } | 267 } |
| 297 | 268 |
| 298 void ChromeShellDelegate::PlatformInit() { | 269 void ChromeShellDelegate::PlatformInit() { |
| 299 registrar_.Add(this, | 270 registrar_.Add(this, |
| 300 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 271 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 301 content::NotificationService::AllSources()); | 272 content::NotificationService::AllSources()); |
| 302 registrar_.Add(this, | 273 registrar_.Add(this, |
| 303 chrome::NOTIFICATION_SESSION_STARTED, | 274 chrome::NOTIFICATION_SESSION_STARTED, |
| 304 content::NotificationService::AllSources()); | 275 content::NotificationService::AllSources()); |
| 305 } | 276 } |
| OLD | NEW |