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

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: rebase @170134 Created 8 years 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 registrar_.Add(this, 190 registrar_.Add(this,
191 chrome::NOTIFICATION_SESSION_STARTED, 191 chrome::NOTIFICATION_SESSION_STARTED,
192 content::NotificationService::AllSources()); 192 content::NotificationService::AllSources());
193 } 193 }
194 registrar_.Add(this, 194 registrar_.Add(this,
195 chrome::NOTIFICATION_PROFILE_CREATED, 195 chrome::NOTIFICATION_PROFILE_CREATED,
196 content::NotificationService::AllSources()); 196 content::NotificationService::AllSources());
197 registrar_.Add(this, 197 registrar_.Add(this,
198 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 198 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
199 content::NotificationService::AllSources()); 199 content::NotificationService::AllSources());
200
201 } 200 }
202 201
203 virtual void Initialize() OVERRIDE { 202 virtual void Initialize() OVERRIDE {
204 AudioHandler::GetInstance()->AddVolumeObserver(this); 203 AudioHandler::GetInstance()->AddVolumeObserver(this);
205 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); 204 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
206 DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate( 205 DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate(
207 PowerManagerClient::UPDATE_INITIAL); 206 PowerManagerClient::UPDATE_INITIAL);
208 DBusThreadManager::Get()->GetRootPowerManagerClient()->AddObserver(this); 207 DBusThreadManager::Get()->GetRootPowerManagerClient()->AddObserver(this);
209 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); 208 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this);
210 209
211 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); 210 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary();
212 crosnet->AddNetworkManagerObserver(this); 211 crosnet->AddNetworkManagerObserver(this);
213 OnNetworkManagerChanged(crosnet); 212 OnNetworkManagerChanged(crosnet);
214 213
215 input_method::InputMethodManager::GetInstance()->AddObserver(this); 214 input_method::InputMethodManager::GetInstance()->AddObserver(this);
216 215
217 system::TimezoneSettings::GetInstance()->AddObserver(this); 216 system::TimezoneSettings::GetInstance()->AddObserver(this);
218 217
219 if (SystemKeyEventListener::GetInstance()) 218 if (SystemKeyEventListener::GetInstance())
220 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); 219 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this);
221 220
222 accessibility_enabled_.Init( 221 spoken_feedback_enabled_.Init(
223 prefs::kSpokenFeedbackEnabled, 222 prefs::kSpokenFeedbackEnabled,
224 g_browser_process->local_state(), 223 g_browser_process->local_state(),
225 base::Bind(&SystemTrayDelegate::OnSpokenFeedbackEnabledChanged, 224 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
225 base::Unretained(this)));
226
227 high_contrast_enabled_.Init(
228 prefs::kHighContrastEnabled,
229 g_browser_process->local_state(),
230 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
226 base::Unretained(this))); 231 base::Unretained(this)));
227 232
228 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT); 233 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT);
229 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); 234 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK);
230 235
231 bluetooth_adapter_ = device::BluetoothAdapterFactory::DefaultAdapter(); 236 bluetooth_adapter_ = device::BluetoothAdapterFactory::DefaultAdapter();
232 bluetooth_adapter_->AddObserver(this); 237 bluetooth_adapter_->AddObserver(this);
233 } 238 }
234 239
235 virtual ~SystemTrayDelegate() { 240 virtual ~SystemTrayDelegate() {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 content::RecordAction( 353 content::RecordAction(
349 content::UserMetricsAction("OpenLanguageOptionsDialog")); 354 content::UserMetricsAction("OpenLanguageOptionsDialog"));
350 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), 355 chrome::ShowSettingsSubPage(GetAppropriateBrowser(),
351 chrome::kLanguageOptionsSubPage); 356 chrome::kLanguageOptionsSubPage);
352 } 357 }
353 358
354 virtual void ShowHelp() OVERRIDE { 359 virtual void ShowHelp() OVERRIDE {
355 chrome::ShowHelp(GetAppropriateBrowser(), chrome::HELP_SOURCE_MENU); 360 chrome::ShowHelp(GetAppropriateBrowser(), chrome::HELP_SOURCE_MENU);
356 } 361 }
357 362
363 virtual void ShowAccessibilityHelp() OVERRIDE {
364 accessibility::ShowAccessibilityHelp(GetAppropriateBrowser());
365 }
366
358 virtual void ShutDown() OVERRIDE { 367 virtual void ShutDown() OVERRIDE {
359 ash::Shell::GetInstance()->session_state_controller()->RequestShutdown(); 368 ash::Shell::GetInstance()->session_state_controller()->RequestShutdown();
360 } 369 }
361 370
362 virtual void SignOut() OVERRIDE { 371 virtual void SignOut() OVERRIDE {
363 browser::AttemptUserExit(); 372 browser::AttemptUserExit();
364 } 373 }
365 374
366 virtual void RequestLockScreen() OVERRIDE { 375 virtual void RequestLockScreen() OVERRIDE {
367 DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen(); 376 DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen();
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 base::Bind(&SystemTrayDelegate::UpdateClockType, 771 base::Bind(&SystemTrayDelegate::UpdateClockType,
763 base::Unretained(this))); 772 base::Unretained(this)));
764 pref_registrar_->Add( 773 pref_registrar_->Add(
765 prefs::kLanguageRemapSearchKeyTo, 774 prefs::kLanguageRemapSearchKeyTo,
766 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged, 775 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged,
767 base::Unretained(this))); 776 base::Unretained(this)));
768 pref_registrar_->Add( 777 pref_registrar_->Add(
769 prefs::kShowLogoutButtonInTray, 778 prefs::kShowLogoutButtonInTray,
770 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray, 779 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray,
771 base::Unretained(this))); 780 base::Unretained(this)));
781 pref_registrar_->Add(
782 prefs::kMagnifierType,
783 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
784 base::Unretained(this)));
785
772 UpdateClockType(); 786 UpdateClockType();
773 UpdateShowLogoutButtonInTray(); 787 UpdateShowLogoutButtonInTray();
774 search_key_mapped_to_ = 788 search_key_mapped_to_ =
775 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); 789 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo);
776 } 790 }
777 791
778 void ObserveGDataUpdates() { 792 void ObserveGDataUpdates() {
779 DriveSystemService* system_service = FindDriveSystemService(); 793 DriveSystemService* system_service = FindDriveSystemService();
780 if (!system_service) 794 if (!system_service)
781 return; 795 return;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 default: 1102 default:
1089 NOTREACHED(); 1103 NOTREACHED();
1090 } 1104 }
1091 } 1105 }
1092 1106
1093 void OnLanguageRemapSearchKeyToChanged() { 1107 void OnLanguageRemapSearchKeyToChanged() {
1094 search_key_mapped_to_ = pref_registrar_->prefs()->GetInteger( 1108 search_key_mapped_to_ = pref_registrar_->prefs()->GetInteger(
1095 prefs::kLanguageRemapSearchKeyTo); 1109 prefs::kLanguageRemapSearchKeyTo);
1096 } 1110 }
1097 1111
1098 void OnSpokenFeedbackEnabledChanged() { 1112 void OnAccessibilityModeChanged() {
1099 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged( 1113 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged();
1100 accessibility_enabled_.prefs()->GetBoolean(
1101 prefs::kSpokenFeedbackEnabled));
1102 } 1114 }
1103 1115
1104 // Overridden from InputMethodManager::Observer. 1116 // Overridden from InputMethodManager::Observer.
1105 virtual void InputMethodChanged( 1117 virtual void InputMethodChanged(
1106 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { 1118 input_method::InputMethodManager* manager, bool show_message) OVERRIDE {
1107 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); 1119 GetSystemTrayNotifier()->NotifyRefreshIME(show_message);
1108 } 1120 }
1109 1121
1110 virtual void InputMethodPropertyChanged( 1122 virtual void InputMethodPropertyChanged(
1111 input_method::InputMethodManager* manager) OVERRIDE { 1123 input_method::InputMethodManager* manager) OVERRIDE {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 base::HourClockType clock_type_; 1268 base::HourClockType clock_type_;
1257 int search_key_mapped_to_; 1269 int search_key_mapped_to_;
1258 bool screen_locked_; 1270 bool screen_locked_;
1259 ConnectionState connected_network_state_; 1271 ConnectionState connected_network_state_;
1260 std::string connected_network_path_; 1272 std::string connected_network_path_;
1261 1273
1262 std::string last_connection_string_; 1274 std::string last_connection_string_;
1263 1275
1264 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; 1276 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;
1265 1277
1266 BooleanPrefMember accessibility_enabled_; 1278 BooleanPrefMember spoken_feedback_enabled_;
1279 BooleanPrefMember high_contrast_enabled_;
1267 1280
1268 scoped_ptr<DataPromoNotification> data_promo_notification_; 1281 scoped_ptr<DataPromoNotification> data_promo_notification_;
1269 1282
1270 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; 1283 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_;
1271 1284
1272 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); 1285 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate);
1273 }; 1286 };
1274 1287
1275 } // namespace 1288 } // namespace
1276 1289
1277 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1290 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1278 return new chromeos::SystemTrayDelegate(); 1291 return new chromeos::SystemTrayDelegate();
1279 } 1292 }
1280 1293
1281 } // namespace chromeos 1294 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | chrome/browser/resources/options/browser_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698