| 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/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
| 8 #include "ash/magnifier/magnifier_constants.h" | 8 #include "ash/magnifier/magnifier_constants.h" |
| 9 #include "ash/media_delegate.h" |
| 9 #include "ash/system/tray/default_system_tray_delegate.h" | 10 #include "ash/system/tray/default_system_tray_delegate.h" |
| 10 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/prefs/session_startup_pref.h" | 14 #include "chrome/browser/prefs/session_startup_pref.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/ui/ash/caps_lock_delegate_views.h" | 16 #include "chrome/browser/ui/ash/caps_lock_delegate_views.h" |
| 16 #include "chrome/browser/ui/ash/chrome_new_window_delegate.h" | 17 #include "chrome/browser/ui/ash/chrome_new_window_delegate.h" |
| 17 #include "chrome/browser/ui/ash/session_state_delegate_views.h" | 18 #include "chrome/browser/ui/ash/session_state_delegate_views.h" |
| 18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 40 | 41 |
| 41 // Overridden from ash::NewWindowDelegate: | 42 // Overridden from ash::NewWindowDelegate: |
| 42 virtual void OpenFileManager() OVERRIDE {} | 43 virtual void OpenFileManager() OVERRIDE {} |
| 43 virtual void OpenCrosh() OVERRIDE {} | 44 virtual void OpenCrosh() OVERRIDE {} |
| 44 virtual void ShowKeyboardOverlay() OVERRIDE {} | 45 virtual void ShowKeyboardOverlay() OVERRIDE {} |
| 45 | 46 |
| 46 private: | 47 private: |
| 47 DISALLOW_COPY_AND_ASSIGN(NewWindowDelegateImpl); | 48 DISALLOW_COPY_AND_ASSIGN(NewWindowDelegateImpl); |
| 48 }; | 49 }; |
| 49 | 50 |
| 51 class MediaDelegateImpl : public ash::MediaDelegate { |
| 52 public: |
| 53 MediaDelegateImpl() {} |
| 54 virtual ~MediaDelegateImpl() {} |
| 55 virtual void HandleMediaNextTrack() OVERRIDE {} |
| 56 virtual void HandleMediaPlayPause() OVERRIDE {} |
| 57 virtual void HandleMediaPrevTrack() OVERRIDE {} |
| 58 |
| 59 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); |
| 61 }; |
| 62 |
| 50 class EmptyAccessibilityDelegate : public ash::AccessibilityDelegate { | 63 class EmptyAccessibilityDelegate : public ash::AccessibilityDelegate { |
| 51 public: | 64 public: |
| 52 EmptyAccessibilityDelegate() {} | 65 EmptyAccessibilityDelegate() {} |
| 53 virtual ~EmptyAccessibilityDelegate() {} | 66 virtual ~EmptyAccessibilityDelegate() {} |
| 54 | 67 |
| 55 virtual void ToggleHighContrast() OVERRIDE { | 68 virtual void ToggleHighContrast() OVERRIDE { |
| 56 } | 69 } |
| 57 | 70 |
| 58 virtual bool IsHighContrastEnabled() const OVERRIDE { | 71 virtual bool IsHighContrastEnabled() const OVERRIDE { |
| 59 return false; | 72 return false; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void ChromeShellDelegate::PreInit() { | 135 void ChromeShellDelegate::PreInit() { |
| 123 } | 136 } |
| 124 | 137 |
| 125 void ChromeShellDelegate::Shutdown() { | 138 void ChromeShellDelegate::Shutdown() { |
| 126 } | 139 } |
| 127 | 140 |
| 128 ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() { | 141 ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() { |
| 129 return new NewWindowDelegateImpl; | 142 return new NewWindowDelegateImpl; |
| 130 } | 143 } |
| 131 | 144 |
| 145 ash::MediaDelegate* ChromeShellDelegate::CreateMediaDelegate() { |
| 146 return new MediaDelegateImpl; |
| 147 } |
| 148 |
| 132 ash::CapsLockDelegate* ChromeShellDelegate::CreateCapsLockDelegate() { | 149 ash::CapsLockDelegate* ChromeShellDelegate::CreateCapsLockDelegate() { |
| 133 return new CapsLockDelegate(); | 150 return new CapsLockDelegate(); |
| 134 } | 151 } |
| 135 | 152 |
| 136 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { | 153 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { |
| 137 return new SessionStateDelegate; | 154 return new SessionStateDelegate; |
| 138 } | 155 } |
| 139 | 156 |
| 140 ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate() { | 157 ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate() { |
| 141 #if defined(OS_WIN) | 158 #if defined(OS_WIN) |
| 142 return CreateWindowsSystemTrayDelegate(); | 159 return CreateWindowsSystemTrayDelegate(); |
| 143 #else | 160 #else |
| 144 return new ash::DefaultSystemTrayDelegate; | 161 return new ash::DefaultSystemTrayDelegate; |
| 145 #endif | 162 #endif |
| 146 } | 163 } |
| 147 | 164 |
| 148 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { | 165 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { |
| 149 return new EmptyAccessibilityDelegate; | 166 return new EmptyAccessibilityDelegate; |
| 150 } | 167 } |
| 151 | 168 |
| 152 ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() { | 169 ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() { |
| 153 #if defined(OS_WIN) | 170 #if defined(OS_WIN) |
| 154 return ::CreateUserWallpaperDelegate(); | 171 return ::CreateUserWallpaperDelegate(); |
| 155 #else | 172 #else |
| 156 return NULL; | 173 return NULL; |
| 157 #endif | 174 #endif |
| 158 } | 175 } |
| 159 | 176 |
| 160 void ChromeShellDelegate::HandleMediaNextTrack() { | |
| 161 } | |
| 162 | |
| 163 void ChromeShellDelegate::HandleMediaPlayPause() { | |
| 164 } | |
| 165 | |
| 166 void ChromeShellDelegate::HandleMediaPrevTrack() { | |
| 167 } | |
| 168 | |
| 169 void ChromeShellDelegate::Observe(int type, | 177 void ChromeShellDelegate::Observe(int type, |
| 170 const content::NotificationSource& source, | 178 const content::NotificationSource& source, |
| 171 const content::NotificationDetails& details) { | 179 const content::NotificationDetails& details) { |
| 172 switch (type) { | 180 switch (type) { |
| 173 case chrome::NOTIFICATION_ASH_SESSION_STARTED: { | 181 case chrome::NOTIFICATION_ASH_SESSION_STARTED: { |
| 174 // If we are launched to service a windows 8 search request then let the | 182 // If we are launched to service a windows 8 search request then let the |
| 175 // IPC which carries the search string create the browser and initiate | 183 // IPC which carries the search string create the browser and initiate |
| 176 // the navigation. | 184 // the navigation. |
| 177 if (CommandLine::ForCurrentProcess()->HasSwitch( | 185 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 178 switches::kWindows8Search)) | 186 switches::kWindows8Search)) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 void ChromeShellDelegate::PlatformInit() { | 230 void ChromeShellDelegate::PlatformInit() { |
| 223 #if defined(OS_WIN) | 231 #if defined(OS_WIN) |
| 224 registrar_.Add(this, | 232 registrar_.Add(this, |
| 225 chrome::NOTIFICATION_ASH_SESSION_STARTED, | 233 chrome::NOTIFICATION_ASH_SESSION_STARTED, |
| 226 content::NotificationService::AllSources()); | 234 content::NotificationService::AllSources()); |
| 227 registrar_.Add(this, | 235 registrar_.Add(this, |
| 228 chrome::NOTIFICATION_ASH_SESSION_ENDED, | 236 chrome::NOTIFICATION_ASH_SESSION_ENDED, |
| 229 content::NotificationService::AllSources()); | 237 content::NotificationService::AllSources()); |
| 230 #endif | 238 #endif |
| 231 } | 239 } |
| OLD | NEW |