OLD | NEW |
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 Loading... |
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::kMagnifierType, |
| 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 Loading... |
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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 default: | 1106 default: |
1092 NOTREACHED(); | 1107 NOTREACHED(); |
1093 } | 1108 } |
1094 } | 1109 } |
1095 | 1110 |
1096 void OnLanguageRemapSearchKeyToChanged() { | 1111 void OnLanguageRemapSearchKeyToChanged() { |
1097 search_key_mapped_to_ = pref_registrar_->prefs()->GetInteger( | 1112 search_key_mapped_to_ = pref_registrar_->prefs()->GetInteger( |
1098 prefs::kLanguageRemapSearchKeyTo); | 1113 prefs::kLanguageRemapSearchKeyTo); |
1099 } | 1114 } |
1100 | 1115 |
1101 void OnSpokenFeedbackEnabledChanged() { | 1116 void OnAccessibilityModeChanged() { |
1102 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged( | 1117 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(); |
1103 accessibility_enabled_.prefs()->GetBoolean( | |
1104 prefs::kSpokenFeedbackEnabled)); | |
1105 } | 1118 } |
1106 | 1119 |
1107 // Overridden from InputMethodManager::Observer. | 1120 // Overridden from InputMethodManager::Observer. |
1108 virtual void InputMethodChanged( | 1121 virtual void InputMethodChanged( |
1109 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { | 1122 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { |
1110 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1123 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
1111 } | 1124 } |
1112 | 1125 |
1113 virtual void InputMethodPropertyChanged( | 1126 virtual void InputMethodPropertyChanged( |
1114 input_method::InputMethodManager* manager) OVERRIDE { | 1127 input_method::InputMethodManager* manager) OVERRIDE { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 base::HourClockType clock_type_; | 1272 base::HourClockType clock_type_; |
1260 int search_key_mapped_to_; | 1273 int search_key_mapped_to_; |
1261 bool screen_locked_; | 1274 bool screen_locked_; |
1262 ConnectionState connected_network_state_; | 1275 ConnectionState connected_network_state_; |
1263 std::string connected_network_path_; | 1276 std::string connected_network_path_; |
1264 | 1277 |
1265 std::string last_connection_string_; | 1278 std::string last_connection_string_; |
1266 | 1279 |
1267 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; | 1280 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; |
1268 | 1281 |
1269 BooleanPrefMember accessibility_enabled_; | 1282 BooleanPrefMember spoken_feedback_enabled_; |
| 1283 BooleanPrefMember high_contrast_enabled_; |
| 1284 StringPrefMember screen_magnifier_type_; |
1270 | 1285 |
1271 scoped_ptr<DataPromoNotification> data_promo_notification_; | 1286 scoped_ptr<DataPromoNotification> data_promo_notification_; |
1272 | 1287 |
1273 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; | 1288 scoped_ptr<ash::VolumeControlDelegate> volume_control_delegate_; |
1274 | 1289 |
1275 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1290 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1276 }; | 1291 }; |
1277 | 1292 |
1278 } // namespace | 1293 } // namespace |
1279 | 1294 |
1280 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1295 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1281 return new chromeos::SystemTrayDelegate(); | 1296 return new chromeos::SystemTrayDelegate(); |
1282 } | 1297 } |
1283 | 1298 |
1284 } // namespace chromeos | 1299 } // namespace chromeos |
OLD | NEW |