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/wm/mru_window_tracker.h" | 10 #include "ash/wm/mru_window_tracker.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // remote which can't handle shortcut. | 61 // remote which can't handle shortcut. |
62 ash::SpokenFeedbackToggler::SetEnabled(chrome::IsRunningInForcedAppMode()); | 62 ash::SpokenFeedbackToggler::SetEnabled(chrome::IsRunningInForcedAppMode()); |
63 #endif | 63 #endif |
64 } | 64 } |
65 | 65 |
66 class AccessibilityDelegateImpl : public ash::AccessibilityDelegate { | 66 class AccessibilityDelegateImpl : public ash::AccessibilityDelegate { |
67 public: | 67 public: |
68 AccessibilityDelegateImpl() {} | 68 AccessibilityDelegateImpl() {} |
69 virtual ~AccessibilityDelegateImpl() {} | 69 virtual ~AccessibilityDelegateImpl() {} |
70 | 70 |
71 virtual void ToggleHighContrast() OVERRIDE { | 71 virtual void ToggleHighContrast() override { |
72 DCHECK(chromeos::AccessibilityManager::Get()); | 72 DCHECK(chromeos::AccessibilityManager::Get()); |
73 chromeos::AccessibilityManager::Get()->EnableHighContrast( | 73 chromeos::AccessibilityManager::Get()->EnableHighContrast( |
74 !chromeos::AccessibilityManager::Get()->IsHighContrastEnabled()); | 74 !chromeos::AccessibilityManager::Get()->IsHighContrastEnabled()); |
75 } | 75 } |
76 | 76 |
77 virtual bool IsSpokenFeedbackEnabled() const OVERRIDE { | 77 virtual bool IsSpokenFeedbackEnabled() const override { |
78 DCHECK(chromeos::AccessibilityManager::Get()); | 78 DCHECK(chromeos::AccessibilityManager::Get()); |
79 return chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled(); | 79 return chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled(); |
80 } | 80 } |
81 | 81 |
82 virtual void ToggleSpokenFeedback( | 82 virtual void ToggleSpokenFeedback( |
83 ash::AccessibilityNotificationVisibility notify) OVERRIDE { | 83 ash::AccessibilityNotificationVisibility notify) override { |
84 DCHECK(chromeos::AccessibilityManager::Get()); | 84 DCHECK(chromeos::AccessibilityManager::Get()); |
85 chromeos::AccessibilityManager::Get()->ToggleSpokenFeedback(notify); | 85 chromeos::AccessibilityManager::Get()->ToggleSpokenFeedback(notify); |
86 } | 86 } |
87 | 87 |
88 virtual bool IsHighContrastEnabled() const OVERRIDE { | 88 virtual bool IsHighContrastEnabled() const override { |
89 DCHECK(chromeos::AccessibilityManager::Get()); | 89 DCHECK(chromeos::AccessibilityManager::Get()); |
90 return chromeos::AccessibilityManager::Get()->IsHighContrastEnabled(); | 90 return chromeos::AccessibilityManager::Get()->IsHighContrastEnabled(); |
91 } | 91 } |
92 | 92 |
93 virtual void SetMagnifierEnabled(bool enabled) OVERRIDE { | 93 virtual void SetMagnifierEnabled(bool enabled) override { |
94 DCHECK(chromeos::MagnificationManager::Get()); | 94 DCHECK(chromeos::MagnificationManager::Get()); |
95 return chromeos::MagnificationManager::Get()->SetMagnifierEnabled(enabled); | 95 return chromeos::MagnificationManager::Get()->SetMagnifierEnabled(enabled); |
96 } | 96 } |
97 | 97 |
98 virtual void SetMagnifierType(ash::MagnifierType type) OVERRIDE { | 98 virtual void SetMagnifierType(ash::MagnifierType type) override { |
99 DCHECK(chromeos::MagnificationManager::Get()); | 99 DCHECK(chromeos::MagnificationManager::Get()); |
100 return chromeos::MagnificationManager::Get()->SetMagnifierType(type); | 100 return chromeos::MagnificationManager::Get()->SetMagnifierType(type); |
101 } | 101 } |
102 | 102 |
103 virtual bool IsMagnifierEnabled() const OVERRIDE { | 103 virtual bool IsMagnifierEnabled() const override { |
104 DCHECK(chromeos::MagnificationManager::Get()); | 104 DCHECK(chromeos::MagnificationManager::Get()); |
105 return chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); | 105 return chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); |
106 } | 106 } |
107 | 107 |
108 virtual ash::MagnifierType GetMagnifierType() const OVERRIDE { | 108 virtual ash::MagnifierType GetMagnifierType() const override { |
109 DCHECK(chromeos::MagnificationManager::Get()); | 109 DCHECK(chromeos::MagnificationManager::Get()); |
110 return chromeos::MagnificationManager::Get()->GetMagnifierType(); | 110 return chromeos::MagnificationManager::Get()->GetMagnifierType(); |
111 } | 111 } |
112 | 112 |
113 virtual void SetLargeCursorEnabled(bool enabled) OVERRIDE { | 113 virtual void SetLargeCursorEnabled(bool enabled) override { |
114 DCHECK(chromeos::AccessibilityManager::Get()); | 114 DCHECK(chromeos::AccessibilityManager::Get()); |
115 return chromeos::AccessibilityManager::Get()->EnableLargeCursor(enabled); | 115 return chromeos::AccessibilityManager::Get()->EnableLargeCursor(enabled); |
116 } | 116 } |
117 | 117 |
118 virtual bool IsLargeCursorEnabled() const OVERRIDE { | 118 virtual bool IsLargeCursorEnabled() const override { |
119 DCHECK(chromeos::AccessibilityManager::Get()); | 119 DCHECK(chromeos::AccessibilityManager::Get()); |
120 return chromeos::AccessibilityManager::Get()->IsLargeCursorEnabled(); | 120 return chromeos::AccessibilityManager::Get()->IsLargeCursorEnabled(); |
121 } | 121 } |
122 | 122 |
123 virtual void SetAutoclickEnabled(bool enabled) OVERRIDE { | 123 virtual void SetAutoclickEnabled(bool enabled) override { |
124 DCHECK(chromeos::AccessibilityManager::Get()); | 124 DCHECK(chromeos::AccessibilityManager::Get()); |
125 return chromeos::AccessibilityManager::Get()->EnableAutoclick(enabled); | 125 return chromeos::AccessibilityManager::Get()->EnableAutoclick(enabled); |
126 } | 126 } |
127 | 127 |
128 virtual bool IsAutoclickEnabled() const OVERRIDE { | 128 virtual bool IsAutoclickEnabled() const override { |
129 DCHECK(chromeos::AccessibilityManager::Get()); | 129 DCHECK(chromeos::AccessibilityManager::Get()); |
130 return chromeos::AccessibilityManager::Get()->IsAutoclickEnabled(); | 130 return chromeos::AccessibilityManager::Get()->IsAutoclickEnabled(); |
131 } | 131 } |
132 | 132 |
133 virtual void SetVirtualKeyboardEnabled(bool enabled) OVERRIDE { | 133 virtual void SetVirtualKeyboardEnabled(bool enabled) override { |
134 DCHECK(chromeos::AccessibilityManager::Get()); | 134 DCHECK(chromeos::AccessibilityManager::Get()); |
135 return chromeos::AccessibilityManager::Get()-> | 135 return chromeos::AccessibilityManager::Get()-> |
136 EnableVirtualKeyboard(enabled); | 136 EnableVirtualKeyboard(enabled); |
137 } | 137 } |
138 | 138 |
139 virtual bool IsVirtualKeyboardEnabled() const OVERRIDE { | 139 virtual bool IsVirtualKeyboardEnabled() const override { |
140 DCHECK(chromeos::AccessibilityManager::Get()); | 140 DCHECK(chromeos::AccessibilityManager::Get()); |
141 return chromeos::AccessibilityManager::Get()->IsVirtualKeyboardEnabled(); | 141 return chromeos::AccessibilityManager::Get()->IsVirtualKeyboardEnabled(); |
142 } | 142 } |
143 | 143 |
144 virtual bool ShouldShowAccessibilityMenu() const OVERRIDE { | 144 virtual bool ShouldShowAccessibilityMenu() const override { |
145 DCHECK(chromeos::AccessibilityManager::Get()); | 145 DCHECK(chromeos::AccessibilityManager::Get()); |
146 return chromeos::AccessibilityManager::Get()-> | 146 return chromeos::AccessibilityManager::Get()-> |
147 ShouldShowAccessibilityMenu(); | 147 ShouldShowAccessibilityMenu(); |
148 } | 148 } |
149 | 149 |
150 virtual bool IsBrailleDisplayConnected() const OVERRIDE { | 150 virtual bool IsBrailleDisplayConnected() const override { |
151 DCHECK(chromeos::AccessibilityManager::Get()); | 151 DCHECK(chromeos::AccessibilityManager::Get()); |
152 return chromeos::AccessibilityManager::Get()->IsBrailleDisplayConnected(); | 152 return chromeos::AccessibilityManager::Get()->IsBrailleDisplayConnected(); |
153 } | 153 } |
154 | 154 |
155 virtual void SilenceSpokenFeedback() const OVERRIDE { | 155 virtual void SilenceSpokenFeedback() const override { |
156 TtsController::GetInstance()->Stop(); | 156 TtsController::GetInstance()->Stop(); |
157 } | 157 } |
158 | 158 |
159 virtual void SaveScreenMagnifierScale(double scale) OVERRIDE { | 159 virtual void SaveScreenMagnifierScale(double scale) override { |
160 if (chromeos::MagnificationManager::Get()) | 160 if (chromeos::MagnificationManager::Get()) |
161 chromeos::MagnificationManager::Get()->SaveScreenMagnifierScale(scale); | 161 chromeos::MagnificationManager::Get()->SaveScreenMagnifierScale(scale); |
162 } | 162 } |
163 | 163 |
164 virtual double GetSavedScreenMagnifierScale() OVERRIDE { | 164 virtual double GetSavedScreenMagnifierScale() override { |
165 if (chromeos::MagnificationManager::Get()) { | 165 if (chromeos::MagnificationManager::Get()) { |
166 return chromeos::MagnificationManager::Get()-> | 166 return chromeos::MagnificationManager::Get()-> |
167 GetSavedScreenMagnifierScale(); | 167 GetSavedScreenMagnifierScale(); |
168 } | 168 } |
169 return std::numeric_limits<double>::min(); | 169 return std::numeric_limits<double>::min(); |
170 } | 170 } |
171 | 171 |
172 virtual void TriggerAccessibilityAlert( | 172 virtual void TriggerAccessibilityAlert( |
173 ash::AccessibilityAlert alert) OVERRIDE { | 173 ash::AccessibilityAlert alert) override { |
174 Profile* profile = ProfileManager::GetActiveUserProfile(); | 174 Profile* profile = ProfileManager::GetActiveUserProfile(); |
175 if (profile) { | 175 if (profile) { |
176 switch (alert) { | 176 switch (alert) { |
177 case ash::A11Y_ALERT_WINDOW_NEEDED: { | 177 case ash::A11Y_ALERT_WINDOW_NEEDED: { |
178 AccessibilityAlertInfo event( | 178 AccessibilityAlertInfo event( |
179 profile, l10n_util::GetStringUTF8(IDS_A11Y_ALERT_WINDOW_NEEDED)); | 179 profile, l10n_util::GetStringUTF8(IDS_A11Y_ALERT_WINDOW_NEEDED)); |
180 SendControlAccessibilityNotification( | 180 SendControlAccessibilityNotification( |
181 ui::AX_EVENT_ALERT, &event); | 181 ui::AX_EVENT_ALERT, &event); |
182 break; | 182 break; |
183 } | 183 } |
184 case ash::A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED: { | 184 case ash::A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED: { |
185 AccessibilityAlertInfo event( | 185 AccessibilityAlertInfo event( |
186 profile, l10n_util::GetStringUTF8( | 186 profile, l10n_util::GetStringUTF8( |
187 IDS_A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED)); | 187 IDS_A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED)); |
188 SendControlAccessibilityNotification( | 188 SendControlAccessibilityNotification( |
189 ui::AX_EVENT_ALERT, &event); | 189 ui::AX_EVENT_ALERT, &event); |
190 break; | 190 break; |
191 } | 191 } |
192 case ash::A11Y_ALERT_NONE: | 192 case ash::A11Y_ALERT_NONE: |
193 break; | 193 break; |
194 } | 194 } |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 virtual ash::AccessibilityAlert GetLastAccessibilityAlert() OVERRIDE { | 198 virtual ash::AccessibilityAlert GetLastAccessibilityAlert() override { |
199 return ash::A11Y_ALERT_NONE; | 199 return ash::A11Y_ALERT_NONE; |
200 } | 200 } |
201 | 201 |
202 virtual void PlayEarcon(int sound_key) OVERRIDE { | 202 virtual void PlayEarcon(int sound_key) override { |
203 DCHECK(chromeos::AccessibilityManager::Get()); | 203 DCHECK(chromeos::AccessibilityManager::Get()); |
204 return chromeos::AccessibilityManager::Get()->PlayEarcon(sound_key); | 204 return chromeos::AccessibilityManager::Get()->PlayEarcon(sound_key); |
205 } | 205 } |
206 | 206 |
207 virtual base::TimeDelta PlayShutdownSound() const OVERRIDE { | 207 virtual base::TimeDelta PlayShutdownSound() const override { |
208 return chromeos::AccessibilityManager::Get()->PlayShutdownSound(); | 208 return chromeos::AccessibilityManager::Get()->PlayShutdownSound(); |
209 } | 209 } |
210 | 210 |
211 private: | 211 private: |
212 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); | 212 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); |
213 }; | 213 }; |
214 | 214 |
215 } // anonymous namespace | 215 } // anonymous namespace |
216 | 216 |
217 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { | 217 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 280 } |
281 | 281 |
282 void ChromeShellDelegate::PlatformInit() { | 282 void ChromeShellDelegate::PlatformInit() { |
283 registrar_.Add(this, | 283 registrar_.Add(this, |
284 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 284 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
285 content::NotificationService::AllSources()); | 285 content::NotificationService::AllSources()); |
286 registrar_.Add(this, | 286 registrar_.Add(this, |
287 chrome::NOTIFICATION_SESSION_STARTED, | 287 chrome::NOTIFICATION_SESSION_STARTED, |
288 content::NotificationService::AllSources()); | 288 content::NotificationService::AllSources()); |
289 } | 289 } |
OLD | NEW |