| 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/keyboard_overlay/keyboard_overlay_view.h" | 7 #include "ash/keyboard_overlay/keyboard_overlay_view.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 11 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 12 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 12 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 13 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" | 13 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
| 14 #include "chrome/browser/chromeos/display/display_preferences.h" | 14 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 15 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" | 15 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" |
| 16 #include "chrome/browser/chromeos/extensions/media_player_api.h" | 16 #include "chrome/browser/chromeos/extensions/media_player_api.h" |
| 17 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | 17 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
| 18 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 18 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 19 #include "chrome/browser/chromeos/login/screen_locker.h" | 19 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 20 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" | 20 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
| 21 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" | 21 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 content::Referrer(), | 105 content::Referrer(), |
| 106 NEW_FOREGROUND_TAB, | 106 NEW_FOREGROUND_TAB, |
| 107 content::PAGE_TRANSITION_GENERATED, | 107 content::PAGE_TRANSITION_GENERATED, |
| 108 false)); | 108 false)); |
| 109 browser->window()->Show(); | 109 browser->window()->Show(); |
| 110 browser->window()->Activate(); | 110 browser->window()->Activate(); |
| 111 page->GetView()->Focus(); | 111 page->GetView()->Focus(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ChromeShellDelegate::ToggleHighContrast() { | 114 void ChromeShellDelegate::ToggleHighContrast() { |
| 115 bool enabled = chromeos::accessibility::IsHighContrastEnabled(); | 115 DCHECK(chromeos::AccessibilityManager::Get()); |
| 116 chromeos::accessibility::EnableHighContrast(!enabled); | 116 bool enabled = chromeos::AccessibilityManager::Get()->IsHighContrastEnabled(); |
| 117 chromeos::AccessibilityManager::Get()->EnableHighContrast(!enabled); |
| 117 } | 118 } |
| 118 | 119 |
| 119 bool ChromeShellDelegate::IsSpokenFeedbackEnabled() const { | 120 bool ChromeShellDelegate::IsSpokenFeedbackEnabled() const { |
| 120 return chromeos::accessibility::IsSpokenFeedbackEnabled(); | 121 DCHECK(chromeos::AccessibilityManager::Get()); |
| 122 return chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled(); |
| 121 } | 123 } |
| 122 | 124 |
| 123 void ChromeShellDelegate::ToggleSpokenFeedback( | 125 void ChromeShellDelegate::ToggleSpokenFeedback( |
| 124 ash::AccessibilityNotificationVisibility notify) { | 126 ash::AccessibilityNotificationVisibility notify) { |
| 127 DCHECK(chromeos::AccessibilityManager::Get()); |
| 125 content::WebUI* web_ui = NULL; | 128 content::WebUI* web_ui = NULL; |
| 126 | 129 |
| 127 chromeos::LoginDisplayHostImpl* host = | 130 chromeos::LoginDisplayHostImpl* host = |
| 128 static_cast<chromeos::LoginDisplayHostImpl*>( | 131 static_cast<chromeos::LoginDisplayHostImpl*>( |
| 129 chromeos::LoginDisplayHostImpl::default_host()); | 132 chromeos::LoginDisplayHostImpl::default_host()); |
| 130 if (host && host->GetOobeUI()) | 133 if (host && host->GetOobeUI()) |
| 131 web_ui = host->GetOobeUI()->web_ui(); | 134 web_ui = host->GetOobeUI()->web_ui(); |
| 132 | 135 |
| 133 if (!web_ui && | 136 if (!web_ui && |
| 134 chromeos::ScreenLocker::default_screen_locker() && | 137 chromeos::ScreenLocker::default_screen_locker() && |
| 135 chromeos::ScreenLocker::default_screen_locker()->locked()) { | 138 chromeos::ScreenLocker::default_screen_locker()->locked()) { |
| 136 web_ui = chromeos::ScreenLocker::default_screen_locker()-> | 139 web_ui = chromeos::ScreenLocker::default_screen_locker()-> |
| 137 GetAssociatedWebUI(); | 140 GetAssociatedWebUI(); |
| 138 } | 141 } |
| 139 chromeos::accessibility::ToggleSpokenFeedback(web_ui, notify); | 142 chromeos::AccessibilityManager::Get()->ToggleSpokenFeedback(web_ui, notify); |
| 140 } | 143 } |
| 141 | 144 |
| 142 bool ChromeShellDelegate::IsHighContrastEnabled() const { | 145 bool ChromeShellDelegate::IsHighContrastEnabled() const { |
| 143 return chromeos::accessibility::IsHighContrastEnabled(); | 146 DCHECK(chromeos::AccessibilityManager::Get()); |
| 147 return chromeos::AccessibilityManager::Get()->IsHighContrastEnabled(); |
| 144 } | 148 } |
| 145 | 149 |
| 146 bool ChromeShellDelegate::IsMagnifierEnabled() const { | 150 bool ChromeShellDelegate::IsMagnifierEnabled() const { |
| 147 DCHECK(chromeos::MagnificationManager::Get()); | 151 DCHECK(chromeos::MagnificationManager::Get()); |
| 148 return chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); | 152 return chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); |
| 149 } | 153 } |
| 150 | 154 |
| 151 ash::MagnifierType ChromeShellDelegate::GetMagnifierType() const { | 155 ash::MagnifierType ChromeShellDelegate::GetMagnifierType() const { |
| 152 DCHECK(chromeos::MagnificationManager::Get()); | 156 DCHECK(chromeos::MagnificationManager::Get()); |
| 153 return chromeos::MagnificationManager::Get()->GetMagnifierType(); | 157 return chromeos::MagnificationManager::Get()->GetMagnifierType(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 251 } |
| 248 | 252 |
| 249 void ChromeShellDelegate::PlatformInit() { | 253 void ChromeShellDelegate::PlatformInit() { |
| 250 registrar_.Add(this, | 254 registrar_.Add(this, |
| 251 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 255 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 252 content::NotificationService::AllSources()); | 256 content::NotificationService::AllSources()); |
| 253 registrar_.Add(this, | 257 registrar_.Add(this, |
| 254 chrome::NOTIFICATION_SESSION_STARTED, | 258 chrome::NOTIFICATION_SESSION_STARTED, |
| 255 content::NotificationService::AllSources()); | 259 content::NotificationService::AllSources()); |
| 256 } | 260 } |
| OLD | NEW |