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

Side by Side Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 11415025: A11y: Introduce High Contrast Mode and Screen Magnifier to ubar tray. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/system/ash_system_tray_delegate.h" 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/system/audio/audio_observer.h" 9 #include "ash/system/audio/audio_observer.h"
10 #include "ash/system/bluetooth/bluetooth_observer.h" 10 #include "ash/system/bluetooth/bluetooth_observer.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 registrar_.Add(this, 188 registrar_.Add(this,
189 chrome::NOTIFICATION_SESSION_STARTED, 189 chrome::NOTIFICATION_SESSION_STARTED,
190 content::NotificationService::AllSources()); 190 content::NotificationService::AllSources());
191 } 191 }
192 registrar_.Add(this, 192 registrar_.Add(this,
193 chrome::NOTIFICATION_PROFILE_CREATED, 193 chrome::NOTIFICATION_PROFILE_CREATED,
194 content::NotificationService::AllSources()); 194 content::NotificationService::AllSources());
195 registrar_.Add(this, 195 registrar_.Add(this,
196 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 196 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
197 content::NotificationService::AllSources()); 197 content::NotificationService::AllSources());
198
199 } 198 }
200 199
201 virtual void Initialize() OVERRIDE { 200 virtual void Initialize() OVERRIDE {
202 AudioHandler::GetInstance()->AddVolumeObserver(this); 201 AudioHandler::GetInstance()->AddVolumeObserver(this);
203 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); 202 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
204 DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate( 203 DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate(
205 PowerManagerClient::UPDATE_INITIAL); 204 PowerManagerClient::UPDATE_INITIAL);
206 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); 205 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this);
207 206
208 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); 207 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary();
209 crosnet->AddNetworkManagerObserver(this); 208 crosnet->AddNetworkManagerObserver(this);
210 OnNetworkManagerChanged(crosnet); 209 OnNetworkManagerChanged(crosnet);
211 crosnet->AddCellularDataPlanObserver(this); 210 crosnet->AddCellularDataPlanObserver(this);
212 211
213 input_method::InputMethodManager::GetInstance()->AddObserver(this); 212 input_method::InputMethodManager::GetInstance()->AddObserver(this);
214 213
215 system::TimezoneSettings::GetInstance()->AddObserver(this); 214 system::TimezoneSettings::GetInstance()->AddObserver(this);
216 215
217 if (SystemKeyEventListener::GetInstance()) 216 if (SystemKeyEventListener::GetInstance())
218 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); 217 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this);
219 218
220 accessibility_enabled_.Init( 219 spoken_feedback_enabled_.Init(
221 prefs::kSpokenFeedbackEnabled, 220 prefs::kSpokenFeedbackEnabled,
222 g_browser_process->local_state(), 221 g_browser_process->local_state(),
223 base::Bind(&SystemTrayDelegate::OnSpokenFeedbackEnabledChanged, 222 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
223 base::Unretained(this)));
224
225 high_contrast_enabled_.Init(
226 prefs::kHighContrastEnabled,
227 g_browser_process->local_state(),
228 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
229 base::Unretained(this)));
230
231 screen_magnifier_type_.Init(
232 prefs::kScreenMagnifierType,
233 g_browser_process->local_state(),
234 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
224 base::Unretained(this))); 235 base::Unretained(this)));
225 236
226 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT); 237 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT);
227 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); 238 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK);
228 239
229 bluetooth_adapter_ = device::BluetoothAdapterFactory::DefaultAdapter(); 240 bluetooth_adapter_ = device::BluetoothAdapterFactory::DefaultAdapter();
230 bluetooth_adapter_->AddObserver(this); 241 bluetooth_adapter_->AddObserver(this);
231 } 242 }
232 243
233 virtual ~SystemTrayDelegate() { 244 virtual ~SystemTrayDelegate() {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 content::RecordAction( 358 content::RecordAction(
348 content::UserMetricsAction("OpenLanguageOptionsDialog")); 359 content::UserMetricsAction("OpenLanguageOptionsDialog"));
349 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), 360 chrome::ShowSettingsSubPage(GetAppropriateBrowser(),
350 chrome::kLanguageOptionsSubPage); 361 chrome::kLanguageOptionsSubPage);
351 } 362 }
352 363
353 virtual void ShowHelp() OVERRIDE { 364 virtual void ShowHelp() OVERRIDE {
354 chrome::ShowHelp(GetAppropriateBrowser(), chrome::HELP_SOURCE_MENU); 365 chrome::ShowHelp(GetAppropriateBrowser(), chrome::HELP_SOURCE_MENU);
355 } 366 }
356 367
368 virtual void ShowAccessibilityHelp() OVERRIDE {
369 accessibility::ShowAccessibilityHelp(GetAppropriateBrowser());
370 }
371
357 virtual void ShutDown() OVERRIDE { 372 virtual void ShutDown() OVERRIDE {
358 ash::Shell::GetInstance()->session_state_controller()->RequestShutdown(); 373 ash::Shell::GetInstance()->session_state_controller()->RequestShutdown();
359 } 374 }
360 375
361 virtual void SignOut() OVERRIDE { 376 virtual void SignOut() OVERRIDE {
362 browser::AttemptUserExit(); 377 browser::AttemptUserExit();
363 } 378 }
364 379
365 virtual void RequestLockScreen() OVERRIDE { 380 virtual void RequestLockScreen() OVERRIDE {
366 DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen(); 381 DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen();
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 default: 1107 default:
1093 NOTREACHED(); 1108 NOTREACHED();
1094 } 1109 }
1095 } 1110 }
1096 1111
1097 void OnLanguageRemapSearchKeyToChanged() { 1112 void OnLanguageRemapSearchKeyToChanged() {
1098 search_key_mapped_to_ = pref_registrar_->prefs()->GetInteger( 1113 search_key_mapped_to_ = pref_registrar_->prefs()->GetInteger(
1099 prefs::kLanguageRemapSearchKeyTo); 1114 prefs::kLanguageRemapSearchKeyTo);
1100 } 1115 }
1101 1116
1102 void OnSpokenFeedbackEnabledChanged() { 1117 void OnAccessibilityModeChanged() {
1103 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged( 1118 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged();
1104 accessibility_enabled_.prefs()->GetBoolean(
1105 prefs::kSpokenFeedbackEnabled));
1106 } 1119 }
1107 1120
1108 // Overridden from InputMethodManager::Observer. 1121 // Overridden from InputMethodManager::Observer.
1109 virtual void InputMethodChanged( 1122 virtual void InputMethodChanged(
1110 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { 1123 input_method::InputMethodManager* manager, bool show_message) OVERRIDE {
1111 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); 1124 GetSystemTrayNotifier()->NotifyRefreshIME(show_message);
1112 } 1125 }
1113 1126
1114 virtual void InputMethodPropertyChanged( 1127 virtual void InputMethodPropertyChanged(
1115 input_method::InputMethodManager* manager) OVERRIDE { 1128 input_method::InputMethodManager* manager) OVERRIDE {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 base::HourClockType clock_type_; 1273 base::HourClockType clock_type_;
1261 int search_key_mapped_to_; 1274 int search_key_mapped_to_;
1262 bool screen_locked_; 1275 bool screen_locked_;
1263 ConnectionState connected_network_state_; 1276 ConnectionState connected_network_state_;
1264 std::string connected_network_path_; 1277 std::string connected_network_path_;
1265 1278
1266 std::string last_connection_string_; 1279 std::string last_connection_string_;
1267 1280
1268 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; 1281 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;
1269 1282
1270 BooleanPrefMember accessibility_enabled_; 1283 BooleanPrefMember spoken_feedback_enabled_;
1284 BooleanPrefMember high_contrast_enabled_;
1285 StringPrefMember screen_magnifier_type_;
1271 1286
1272 scoped_ptr<DataPromoNotification> data_promo_notification_; 1287 scoped_ptr<DataPromoNotification> data_promo_notification_;
1273 1288
1274 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; 1289 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_;
1275 1290
1276 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); 1291 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate);
1277 }; 1292 };
1278 1293
1279 } // namespace 1294 } // namespace
1280 1295
1281 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1296 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1282 return new chromeos::SystemTrayDelegate(); 1297 return new chromeos::SystemTrayDelegate();
1283 } 1298 }
1284 1299
1285 } // namespace chromeos 1300 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698