| 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/media_delegate.h" | 8 #include "ash/media_delegate.h" |
| 9 #include "ash/wm/mru_window_tracker.h" | 9 #include "ash/wm/mru_window_tracker.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "chrome/browser/accessibility/accessibility_events.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 15 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 15 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 16 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 16 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" | 17 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
| 17 #include "chrome/browser/chromeos/display/display_preferences.h" | 18 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 18 #include "chrome/browser/chromeos/extensions/media_player_api.h" | 19 #include "chrome/browser/chromeos/extensions/media_player_api.h" |
| 19 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | 20 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
| 20 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" | 21 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/browser/speech/tts_controller.h" | 23 #include "chrome/browser/speech/tts_controller.h" |
| 23 #include "chrome/browser/ui/ash/caps_lock_delegate_chromeos.h" | 24 #include "chrome/browser/ui/ash/caps_lock_delegate_chromeos.h" |
| 24 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" | 25 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" |
| 25 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" | 26 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" |
| 26 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.h" |
| 28 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
| 29 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 30 #include "chromeos/chromeos_switches.h" | 31 #include "chromeos/chromeos_switches.h" |
| 31 #include "chromeos/dbus/dbus_thread_manager.h" | 32 #include "chromeos/dbus/dbus_thread_manager.h" |
| 32 #include "chromeos/dbus/power_manager_client.h" | 33 #include "chromeos/dbus/power_manager_client.h" |
| 33 #include "chromeos/ime/input_method_manager.h" | 34 #include "chromeos/ime/input_method_manager.h" |
| 34 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
| 37 #include "grit/generated_resources.h" |
| 36 #include "ui/aura/window.h" | 38 #include "ui/aura/window.h" |
| 39 #include "ui/base/l10n/l10n_util.h" |
| 37 | 40 |
| 38 namespace { | 41 namespace { |
| 39 | 42 |
| 40 // This function is used for restoring focus after the user session is started. | 43 // This function is used for restoring focus after the user session is started. |
| 41 // It's needed because some windows can be opened in background while login UI | 44 // It's needed because some windows can be opened in background while login UI |
| 42 // is still active because we currently restore browser windows before login UI | 45 // is still active because we currently restore browser windows before login UI |
| 43 // is deleted. | 46 // is deleted. |
| 44 void RestoreFocus() { | 47 void RestoreFocus() { |
| 45 ash::MruWindowTracker::WindowList mru_list = | 48 ash::MruWindowTracker::WindowList mru_list = |
| 46 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); | 49 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 138 } |
| 136 | 139 |
| 137 virtual double GetSavedScreenMagnifierScale() OVERRIDE { | 140 virtual double GetSavedScreenMagnifierScale() OVERRIDE { |
| 138 if (chromeos::MagnificationManager::Get()) { | 141 if (chromeos::MagnificationManager::Get()) { |
| 139 return chromeos::MagnificationManager::Get()-> | 142 return chromeos::MagnificationManager::Get()-> |
| 140 GetSavedScreenMagnifierScale(); | 143 GetSavedScreenMagnifierScale(); |
| 141 } | 144 } |
| 142 return std::numeric_limits<double>::min(); | 145 return std::numeric_limits<double>::min(); |
| 143 } | 146 } |
| 144 | 147 |
| 148 virtual void TriggerAccessibilityAlert( |
| 149 ash::AccessibilityAlert alert) OVERRIDE { |
| 150 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 151 if (profile) { |
| 152 switch (alert) { |
| 153 case ash::A11Y_ALERT_WINDOW_NEEDED: { |
| 154 AccessibilityAlertInfo event( |
| 155 profile, l10n_util::GetStringUTF8(IDS_A11Y_ALERT_WINDOW_NEEDED)); |
| 156 SendControlAccessibilityNotification( |
| 157 ui::AccessibilityTypes::EVENT_ALERT, &event); |
| 158 break; |
| 159 } |
| 160 case ash::A11Y_ALERT_NONE: |
| 161 break; |
| 162 } |
| 163 } |
| 164 } |
| 165 |
| 166 virtual ash::AccessibilityAlert GetLastAccessibilityAlert() OVERRIDE { |
| 167 return ash::A11Y_ALERT_NONE; |
| 168 } |
| 169 |
| 145 private: | 170 private: |
| 146 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); | 171 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); |
| 147 }; | 172 }; |
| 148 | 173 |
| 149 class MediaDelegateImpl : public ash::MediaDelegate { | 174 class MediaDelegateImpl : public ash::MediaDelegate { |
| 150 public: | 175 public: |
| 151 MediaDelegateImpl() {} | 176 MediaDelegateImpl() {} |
| 152 virtual ~MediaDelegateImpl() {} | 177 virtual ~MediaDelegateImpl() {} |
| 153 | 178 |
| 154 virtual void HandleMediaNextTrack() OVERRIDE { | 179 virtual void HandleMediaNextTrack() OVERRIDE { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 262 } |
| 238 | 263 |
| 239 void ChromeShellDelegate::PlatformInit() { | 264 void ChromeShellDelegate::PlatformInit() { |
| 240 registrar_.Add(this, | 265 registrar_.Add(this, |
| 241 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 266 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 242 content::NotificationService::AllSources()); | 267 content::NotificationService::AllSources()); |
| 243 registrar_.Add(this, | 268 registrar_.Add(this, |
| 244 chrome::NOTIFICATION_SESSION_STARTED, | 269 chrome::NOTIFICATION_SESSION_STARTED, |
| 245 content::NotificationService::AllSources()); | 270 content::NotificationService::AllSources()); |
| 246 } | 271 } |
| OLD | NEW |