Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc

Issue 682943002: Make chrome/browser/chromeos/accessibility compile on Athena with use_ash=0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_do_not_use_ash41_scroll_end_effect
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "ash/wm/window_util.h" 11 #include "ash/wm/window_util.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "chrome/browser/accessibility/accessibility_events.h" 14 #include "chrome/browser/accessibility/accessibility_events.h"
15 #include "chrome/browser/app_mode/app_mode_utils.h" 15 #include "chrome/browser/app_mode/app_mode_utils.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 17 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
18 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
19 #include "chrome/browser/chromeos/display/display_configuration_observer.h" 18 #include "chrome/browser/chromeos/display/display_configuration_observer.h"
20 #include "chrome/browser/chromeos/display/display_preferences.h" 19 #include "chrome/browser/chromeos/display/display_preferences.h"
21 #include "chrome/browser/chromeos/profiles/profile_helper.h" 20 #include "chrome/browser/chromeos/profiles/profile_helper.h"
22 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
24 #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" 23 #include "chrome/browser/signin/signin_error_notifier_factory_ash.h"
25 #include "chrome/browser/speech/tts_controller.h" 24 #include "chrome/browser/speech/tts_controller.h"
26 #include "chrome/browser/sync/sync_error_notifier_factory_ash.h" 25 #include "chrome/browser/sync/sync_error_notifier_factory_ash.h"
27 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" 26 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h"
28 #include "chrome/browser/ui/ash/media_delegate_chromeos.h" 27 #include "chrome/browser/ui/ash/media_delegate_chromeos.h"
29 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" 28 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h"
30 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" 29 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
31 #include "chrome/browser/ui/browser.h" 30 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_finder.h" 31 #include "chrome/browser/ui/browser_finder.h"
33 #include "chrome/browser/ui/browser_window.h" 32 #include "chrome/browser/ui/browser_window.h"
34 #include "chrome/grit/generated_resources.h" 33 #include "chrome/grit/generated_resources.h"
35 #include "chromeos/chromeos_switches.h" 34 #include "chromeos/chromeos_switches.h"
36 #include "chromeos/ime/input_method_manager.h" 35 #include "chromeos/ime/input_method_manager.h"
37 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/user_metrics.h" 37 #include "content/public/browser/user_metrics.h"
39 #include "ui/aura/window.h" 38 #include "ui/aura/window.h"
40 #include "ui/base/l10n/l10n_util.h" 39 #include "ui/base/l10n/l10n_util.h"
41 40
42 #if !defined(USE_ATHENA) 41 #if !defined(USE_ATHENA)
42 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
43 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" 43 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h"
44 #endif 44 #endif
45 45
46 namespace { 46 namespace {
47 47
48 void InitAfterSessionStart() { 48 void InitAfterSessionStart() {
49 // Restore focus after the user session is started. It's needed because some 49 // Restore focus after the user session is started. It's needed because some
50 // windows can be opened in background while login UI is still active because 50 // windows can be opened in background while login UI is still active because
51 // we currently restore browser windows before login UI is deleted. 51 // we currently restore browser windows before login UI is deleted.
52 ash::Shell* shell = ash::Shell::GetInstance(); 52 ash::Shell* shell = ash::Shell::GetInstance();
53 ash::MruWindowTracker::WindowList mru_list = 53 ash::MruWindowTracker::WindowList mru_list =
54 shell->mru_window_tracker()->BuildMruWindowList(); 54 shell->mru_window_tracker()->BuildMruWindowList();
55 if (!mru_list.empty()) 55 if (!mru_list.empty())
56 mru_list.front()->Focus(); 56 mru_list.front()->Focus();
57 57
58 #if defined(USE_X11) 58 #if defined(USE_X11)
59 // Enable magnifier scroll keys as there may be no mouse cursor in kiosk mode. 59 // Enable magnifier scroll keys as there may be no mouse cursor in kiosk mode.
60 ash::MagnifierKeyScroller::SetEnabled(chrome::IsRunningInForcedAppMode()); 60 ash::MagnifierKeyScroller::SetEnabled(chrome::IsRunningInForcedAppMode());
61 61
62 // Enable long press action to toggle spoken feedback with hotrod 62 // Enable long press action to toggle spoken feedback with hotrod
63 // remote which can't handle shortcut. 63 // remote which can't handle shortcut.
64 ash::SpokenFeedbackToggler::SetEnabled(chrome::IsRunningInForcedAppMode()); 64 ash::SpokenFeedbackToggler::SetEnabled(chrome::IsRunningInForcedAppMode());
65 #endif 65 #endif
66 } 66 }
67 67
68 #if !defined(USE_ATHENA)
68 class AccessibilityDelegateImpl : public ash::AccessibilityDelegate { 69 class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
69 public: 70 public:
70 AccessibilityDelegateImpl() {} 71 AccessibilityDelegateImpl() {}
71 virtual ~AccessibilityDelegateImpl() {} 72 virtual ~AccessibilityDelegateImpl() {}
72 73
73 virtual void ToggleHighContrast() override { 74 virtual void ToggleHighContrast() override {
74 DCHECK(chromeos::AccessibilityManager::Get()); 75 DCHECK(chromeos::AccessibilityManager::Get());
75 chromeos::AccessibilityManager::Get()->EnableHighContrast( 76 chromeos::AccessibilityManager::Get()->EnableHighContrast(
76 !chromeos::AccessibilityManager::Get()->IsHighContrastEnabled()); 77 !chromeos::AccessibilityManager::Get()->IsHighContrastEnabled());
77 } 78 }
78 79
79 virtual bool IsSpokenFeedbackEnabled() const override { 80 virtual bool IsSpokenFeedbackEnabled() const override {
80 DCHECK(chromeos::AccessibilityManager::Get()); 81 DCHECK(chromeos::AccessibilityManager::Get());
81 return chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled(); 82 return chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled();
82 } 83 }
83 84
84 virtual void ToggleSpokenFeedback( 85 virtual void ToggleSpokenFeedback(
85 ash::AccessibilityNotificationVisibility notify) override { 86 ui::AccessibilityNotificationVisibility notify) override {
86 DCHECK(chromeos::AccessibilityManager::Get()); 87 DCHECK(chromeos::AccessibilityManager::Get());
87 chromeos::AccessibilityManager::Get()->ToggleSpokenFeedback(notify); 88 chromeos::AccessibilityManager::Get()->ToggleSpokenFeedback(notify);
88 } 89 }
89 90
90 virtual bool IsHighContrastEnabled() const override { 91 virtual bool IsHighContrastEnabled() const override {
91 DCHECK(chromeos::AccessibilityManager::Get()); 92 DCHECK(chromeos::AccessibilityManager::Get());
92 return chromeos::AccessibilityManager::Get()->IsHighContrastEnabled(); 93 return chromeos::AccessibilityManager::Get()->IsHighContrastEnabled();
93 } 94 }
94 95
95 virtual void SetMagnifierEnabled(bool enabled) override { 96 virtual void SetMagnifierEnabled(bool enabled) override {
96 DCHECK(chromeos::MagnificationManager::Get()); 97 DCHECK(chromeos::MagnificationManager::Get());
97 return chromeos::MagnificationManager::Get()->SetMagnifierEnabled(enabled); 98 return chromeos::MagnificationManager::Get()->SetMagnifierEnabled(enabled);
98 } 99 }
99 100
100 virtual void SetMagnifierType(ash::MagnifierType type) override { 101 virtual void SetMagnifierType(ui::MagnifierType type) override {
101 DCHECK(chromeos::MagnificationManager::Get()); 102 DCHECK(chromeos::MagnificationManager::Get());
102 return chromeos::MagnificationManager::Get()->SetMagnifierType(type); 103 return chromeos::MagnificationManager::Get()->SetMagnifierType(type);
103 } 104 }
104 105
105 virtual bool IsMagnifierEnabled() const override { 106 virtual bool IsMagnifierEnabled() const override {
106 DCHECK(chromeos::MagnificationManager::Get()); 107 DCHECK(chromeos::MagnificationManager::Get());
107 return chromeos::MagnificationManager::Get()->IsMagnifierEnabled(); 108 return chromeos::MagnificationManager::Get()->IsMagnifierEnabled();
108 } 109 }
109 110
110 virtual ash::MagnifierType GetMagnifierType() const override { 111 virtual ui::MagnifierType GetMagnifierType() const override {
111 DCHECK(chromeos::MagnificationManager::Get()); 112 DCHECK(chromeos::MagnificationManager::Get());
112 return chromeos::MagnificationManager::Get()->GetMagnifierType(); 113 return chromeos::MagnificationManager::Get()->GetMagnifierType();
113 } 114 }
114 115
115 virtual void SetLargeCursorEnabled(bool enabled) override { 116 virtual void SetLargeCursorEnabled(bool enabled) override {
116 DCHECK(chromeos::AccessibilityManager::Get()); 117 DCHECK(chromeos::AccessibilityManager::Get());
117 return chromeos::AccessibilityManager::Get()->EnableLargeCursor(enabled); 118 return chromeos::AccessibilityManager::Get()->EnableLargeCursor(enabled);
118 } 119 }
119 120
120 virtual bool IsLargeCursorEnabled() const override { 121 virtual bool IsLargeCursorEnabled() const override {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 166
166 virtual double GetSavedScreenMagnifierScale() override { 167 virtual double GetSavedScreenMagnifierScale() override {
167 if (chromeos::MagnificationManager::Get()) { 168 if (chromeos::MagnificationManager::Get()) {
168 return chromeos::MagnificationManager::Get()-> 169 return chromeos::MagnificationManager::Get()->
169 GetSavedScreenMagnifierScale(); 170 GetSavedScreenMagnifierScale();
170 } 171 }
171 return std::numeric_limits<double>::min(); 172 return std::numeric_limits<double>::min();
172 } 173 }
173 174
174 virtual void TriggerAccessibilityAlert( 175 virtual void TriggerAccessibilityAlert(
175 ash::AccessibilityAlert alert) override { 176 ui::AccessibilityAlert alert) override {
176 Profile* profile = ProfileManager::GetActiveUserProfile(); 177 Profile* profile = ProfileManager::GetActiveUserProfile();
177 if (profile) { 178 if (profile) {
178 switch (alert) { 179 switch (alert) {
179 case ash::A11Y_ALERT_WINDOW_NEEDED: { 180 case ui::A11Y_ALERT_WINDOW_NEEDED: {
180 AccessibilityAlertInfo event( 181 AccessibilityAlertInfo event(
181 profile, l10n_util::GetStringUTF8(IDS_A11Y_ALERT_WINDOW_NEEDED)); 182 profile, l10n_util::GetStringUTF8(IDS_A11Y_ALERT_WINDOW_NEEDED));
182 SendControlAccessibilityNotification( 183 SendControlAccessibilityNotification(
183 ui::AX_EVENT_ALERT, &event); 184 ui::AX_EVENT_ALERT, &event);
184 break; 185 break;
185 } 186 }
186 case ash::A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED: { 187 case ui::A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED: {
187 AccessibilityAlertInfo event( 188 AccessibilityAlertInfo event(
188 profile, l10n_util::GetStringUTF8( 189 profile, l10n_util::GetStringUTF8(
189 IDS_A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED)); 190 IDS_A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED));
190 SendControlAccessibilityNotification( 191 SendControlAccessibilityNotification(
191 ui::AX_EVENT_ALERT, &event); 192 ui::AX_EVENT_ALERT, &event);
192 break; 193 break;
193 } 194 }
194 case ash::A11Y_ALERT_NONE: 195 case ui::A11Y_ALERT_NONE:
195 break; 196 break;
196 } 197 }
197 } 198 }
198 } 199 }
199 200
200 virtual ash::AccessibilityAlert GetLastAccessibilityAlert() override { 201 virtual ui::AccessibilityAlert GetLastAccessibilityAlert() override {
201 return ash::A11Y_ALERT_NONE; 202 return ui::A11Y_ALERT_NONE;
202 } 203 }
203 204
204 virtual void PlayEarcon(int sound_key) override { 205 virtual void PlayEarcon(int sound_key) override {
205 DCHECK(chromeos::AccessibilityManager::Get()); 206 DCHECK(chromeos::AccessibilityManager::Get());
206 return chromeos::AccessibilityManager::Get()->PlayEarcon(sound_key); 207 return chromeos::AccessibilityManager::Get()->PlayEarcon(sound_key);
207 } 208 }
208 209
209 virtual base::TimeDelta PlayShutdownSound() const override { 210 virtual base::TimeDelta PlayShutdownSound() const override {
210 return chromeos::AccessibilityManager::Get()->PlayShutdownSound(); 211 return chromeos::AccessibilityManager::Get()->PlayShutdownSound();
211 } 212 }
212 213
213 private: 214 private:
214 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl); 215 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateImpl);
215 }; 216 };
217 #endif
216 218
217 } // anonymous namespace 219 } // anonymous namespace
218 220
219 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { 221 bool ChromeShellDelegate::IsFirstRunAfterBoot() const {
220 return CommandLine::ForCurrentProcess()->HasSwitch( 222 return CommandLine::ForCurrentProcess()->HasSwitch(
221 chromeos::switches::kFirstExecAfterBoot); 223 chromeos::switches::kFirstExecAfterBoot);
222 } 224 }
223 225
224 void ChromeShellDelegate::PreInit() { 226 void ChromeShellDelegate::PreInit() {
225 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); 227 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot());
226 // Set the observer now so that we can save the initial state 228 // Set the observer now so that we can save the initial state
227 // in Shell::Init. 229 // in Shell::Init.
228 display_configuration_observer_.reset( 230 display_configuration_observer_.reset(
229 new chromeos::DisplayConfigurationObserver()); 231 new chromeos::DisplayConfigurationObserver());
230 } 232 }
231 233
232 void ChromeShellDelegate::PreShutdown() { 234 void ChromeShellDelegate::PreShutdown() {
233 display_configuration_observer_.reset(); 235 display_configuration_observer_.reset();
234 } 236 }
235 237
236 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { 238 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() {
237 return new SessionStateDelegateChromeos; 239 return new SessionStateDelegateChromeos;
238 } 240 }
239 241
240 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { 242 ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() {
243 #if defined(USE_ATHENA)
244 return nullptr;
245 #else
241 return new AccessibilityDelegateImpl; 246 return new AccessibilityDelegateImpl;
247 #endif
242 } 248 }
243 249
244 ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() { 250 ash::NewWindowDelegate* ChromeShellDelegate::CreateNewWindowDelegate() {
245 return new ChromeNewWindowDelegateChromeos; 251 return new ChromeNewWindowDelegateChromeos;
246 } 252 }
247 253
248 ash::MediaDelegate* ChromeShellDelegate::CreateMediaDelegate() { 254 ash::MediaDelegate* ChromeShellDelegate::CreateMediaDelegate() {
249 return new MediaDelegateChromeOS; 255 return new MediaDelegateChromeOS;
250 } 256 }
251 257
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 292 }
287 293
288 void ChromeShellDelegate::PlatformInit() { 294 void ChromeShellDelegate::PlatformInit() {
289 registrar_.Add(this, 295 registrar_.Add(this,
290 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 296 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
291 content::NotificationService::AllSources()); 297 content::NotificationService::AllSources());
292 registrar_.Add(this, 298 registrar_.Add(this,
293 chrome::NOTIFICATION_SESSION_STARTED, 299 chrome::NOTIFICATION_SESSION_STARTED,
294 content::NotificationService::AllSources()); 300 content::NotificationService::AllSources());
295 } 301 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | chrome/browser/ui/ash/chrome_shell_delegate_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698