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 14 matching lines...) Expand all Loading... | |
25 #include "ash/volume_control_delegate.h" | 25 #include "ash/volume_control_delegate.h" |
26 #include "ash/wm/session_state_controller.h" | 26 #include "ash/wm/session_state_controller.h" |
27 #include "base/bind_helpers.h" | 27 #include "base/bind_helpers.h" |
28 #include "base/callback.h" | 28 #include "base/callback.h" |
29 #include "base/chromeos/chromeos_version.h" | 29 #include "base/chromeos/chromeos_version.h" |
30 #include "base/logging.h" | 30 #include "base/logging.h" |
31 #include "base/memory/weak_ptr.h" | 31 #include "base/memory/weak_ptr.h" |
32 #include "base/utf_string_conversions.h" | 32 #include "base/utf_string_conversions.h" |
33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
34 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 34 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
35 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | |
35 #include "chrome/browser/chromeos/audio/audio_handler.h" | 36 #include "chrome/browser/chromeos/audio/audio_handler.h" |
36 #include "chrome/browser/chromeos/cros/cros_library.h" | 37 #include "chrome/browser/chromeos/cros/cros_library.h" |
37 #include "chrome/browser/chromeos/cros/network_library.h" | 38 #include "chrome/browser/chromeos/cros/network_library.h" |
38 #include "chrome/browser/chromeos/drive/drive_system_service.h" | 39 #include "chrome/browser/chromeos/drive/drive_system_service.h" |
39 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 40 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
40 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 41 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
41 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 42 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
42 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 43 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
43 #include "chrome/browser/chromeos/login/base_login_display_host.h" | 44 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
44 #include "chrome/browser/chromeos/login/login_display_host.h" | 45 #include "chrome/browser/chromeos/login/login_display_host.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 public NetworkMenuIcon::Delegate, | 156 public NetworkMenuIcon::Delegate, |
156 public NetworkMenu::Delegate, | 157 public NetworkMenu::Delegate, |
157 public NetworkLibrary::NetworkManagerObserver, | 158 public NetworkLibrary::NetworkManagerObserver, |
158 public NetworkLibrary::NetworkObserver, | 159 public NetworkLibrary::NetworkObserver, |
159 public google_apis::DriveServiceObserver, | 160 public google_apis::DriveServiceObserver, |
160 public content::NotificationObserver, | 161 public content::NotificationObserver, |
161 public input_method::InputMethodManager::Observer, | 162 public input_method::InputMethodManager::Observer, |
162 public system::TimezoneSettings::Observer, | 163 public system::TimezoneSettings::Observer, |
163 public device::BluetoothAdapter::Observer, | 164 public device::BluetoothAdapter::Observer, |
164 public SystemKeyEventListener::CapsLockObserver, | 165 public SystemKeyEventListener::CapsLockObserver, |
165 public ash::NetworkTrayDelegate { | 166 public ash::NetworkTrayDelegate, |
167 public MagnificationObserver { | |
166 public: | 168 public: |
167 SystemTrayDelegate() | 169 SystemTrayDelegate() |
168 : ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( | 170 : ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( |
169 new base::WeakPtrFactory<SystemTrayDelegate>(this))), | 171 new base::WeakPtrFactory<SystemTrayDelegate>(this))), |
170 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( | 172 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( |
171 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 173 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
172 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( | 174 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( |
173 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 175 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
174 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), | 176 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), |
175 clock_type_(base::k24HourClock), | 177 clock_type_(base::k24HourClock), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 crosnet->AddNetworkManagerObserver(this); | 213 crosnet->AddNetworkManagerObserver(this); |
212 OnNetworkManagerChanged(crosnet); | 214 OnNetworkManagerChanged(crosnet); |
213 | 215 |
214 input_method::InputMethodManager::GetInstance()->AddObserver(this); | 216 input_method::InputMethodManager::GetInstance()->AddObserver(this); |
215 | 217 |
216 system::TimezoneSettings::GetInstance()->AddObserver(this); | 218 system::TimezoneSettings::GetInstance()->AddObserver(this); |
217 | 219 |
218 if (SystemKeyEventListener::GetInstance()) | 220 if (SystemKeyEventListener::GetInstance()) |
219 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); | 221 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); |
220 | 222 |
223 MagnificationManager::GetInstance()->AddObserver(this); | |
stevenjb
2012/12/04 01:35:34
We will need to ensure that we create Magnificatio
yoshiki
2012/12/04 08:30:20
Done.
| |
224 | |
221 spoken_feedback_enabled_.Init( | 225 spoken_feedback_enabled_.Init( |
222 prefs::kSpokenFeedbackEnabled, | 226 prefs::kSpokenFeedbackEnabled, |
223 g_browser_process->local_state(), | 227 g_browser_process->local_state(), |
224 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 228 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
225 base::Unretained(this))); | 229 base::Unretained(this))); |
226 | 230 |
227 high_contrast_enabled_.Init( | 231 high_contrast_enabled_.Init( |
228 prefs::kHighContrastEnabled, | 232 prefs::kHighContrastEnabled, |
229 g_browser_process->local_state(), | 233 g_browser_process->local_state(), |
230 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 234 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
(...skipping 15 matching lines...) Expand all Loading... | |
246 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 250 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
247 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 251 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
248 if (crosnet) | 252 if (crosnet) |
249 crosnet->RemoveNetworkManagerObserver(this); | 253 crosnet->RemoveNetworkManagerObserver(this); |
250 input_method::InputMethodManager::GetInstance()->RemoveObserver(this); | 254 input_method::InputMethodManager::GetInstance()->RemoveObserver(this); |
251 system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 255 system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
252 if (SystemKeyEventListener::GetInstance()) | 256 if (SystemKeyEventListener::GetInstance()) |
253 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); | 257 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); |
254 bluetooth_adapter_->RemoveObserver(this); | 258 bluetooth_adapter_->RemoveObserver(this); |
255 | 259 |
260 MagnificationManager::GetInstance()->RemoveObserver(this); | |
stevenjb
2012/12/04 01:35:34
This can be:
if (MagnificationManager::GetInstance
yoshiki
2012/12/04 08:30:20
Done.
| |
261 | |
256 // Stop observing gdata operations. | 262 // Stop observing gdata operations. |
257 DriveSystemService* system_service = FindDriveSystemService(); | 263 DriveSystemService* system_service = FindDriveSystemService(); |
258 if (system_service) { | 264 if (system_service) { |
259 system_service->drive_service()->RemoveObserver(this); | 265 system_service->drive_service()->RemoveObserver(this); |
260 } | 266 } |
261 } | 267 } |
262 | 268 |
263 // Overridden from ash::SystemTrayDelegate: | 269 // Overridden from ash::SystemTrayDelegate: |
264 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { | 270 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { |
265 // In case of OOBE / sign in screen tray will be shown later. | 271 // In case of OOBE / sign in screen tray will be shown later. |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 base::Bind(&SystemTrayDelegate::UpdateClockType, | 777 base::Bind(&SystemTrayDelegate::UpdateClockType, |
772 base::Unretained(this))); | 778 base::Unretained(this))); |
773 pref_registrar_->Add( | 779 pref_registrar_->Add( |
774 prefs::kLanguageRemapSearchKeyTo, | 780 prefs::kLanguageRemapSearchKeyTo, |
775 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged, | 781 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged, |
776 base::Unretained(this))); | 782 base::Unretained(this))); |
777 pref_registrar_->Add( | 783 pref_registrar_->Add( |
778 prefs::kShowLogoutButtonInTray, | 784 prefs::kShowLogoutButtonInTray, |
779 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray, | 785 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray, |
780 base::Unretained(this))); | 786 base::Unretained(this))); |
781 pref_registrar_->Add( | |
782 prefs::kMagnifierType, | |
783 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | |
784 base::Unretained(this))); | |
785 | 787 |
786 UpdateClockType(); | 788 UpdateClockType(); |
787 UpdateShowLogoutButtonInTray(); | 789 UpdateShowLogoutButtonInTray(); |
788 search_key_mapped_to_ = | 790 search_key_mapped_to_ = |
789 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); | 791 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); |
790 } | 792 } |
791 | 793 |
792 void ObserveGDataUpdates() { | 794 void ObserveGDataUpdates() { |
793 DriveSystemService* system_service = FindDriveSystemService(); | 795 DriveSystemService* system_service = FindDriveSystemService(); |
794 if (!system_service) | 796 if (!system_service) |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1103 NOTREACHED(); | 1105 NOTREACHED(); |
1104 } | 1106 } |
1105 } | 1107 } |
1106 | 1108 |
1107 void OnLanguageRemapSearchKeyToChanged() { | 1109 void OnLanguageRemapSearchKeyToChanged() { |
1108 search_key_mapped_to_ = pref_registrar_->prefs()->GetInteger( | 1110 search_key_mapped_to_ = pref_registrar_->prefs()->GetInteger( |
1109 prefs::kLanguageRemapSearchKeyTo); | 1111 prefs::kLanguageRemapSearchKeyTo); |
1110 } | 1112 } |
1111 | 1113 |
1112 void OnAccessibilityModeChanged() { | 1114 void OnAccessibilityModeChanged() { |
1115 LOG(ERROR) << "OnAccessibilityModeChanged"; | |
Daniel Erat
2012/12/04 01:06:36
nit: delete this
yoshiki
2012/12/04 08:30:20
Done.
| |
1113 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(); | 1116 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged(); |
1114 } | 1117 } |
1115 | 1118 |
1116 // Overridden from InputMethodManager::Observer. | 1119 // Overridden from InputMethodManager::Observer. |
1117 virtual void InputMethodChanged( | 1120 virtual void InputMethodChanged( |
1118 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { | 1121 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { |
1119 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1122 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
1120 } | 1123 } |
1121 | 1124 |
1122 virtual void InputMethodPropertyChanged( | 1125 virtual void InputMethodPropertyChanged( |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1249 } | 1252 } |
1250 | 1253 |
1251 if (!deal_url_to_open.empty()) { | 1254 if (!deal_url_to_open.empty()) { |
1252 Browser* browser = GetAppropriateBrowser(); | 1255 Browser* browser = GetAppropriateBrowser(); |
1253 if (!browser) | 1256 if (!browser) |
1254 return; | 1257 return; |
1255 chrome::ShowSingletonTab(browser, GURL(deal_url_to_open)); | 1258 chrome::ShowSingletonTab(browser, GURL(deal_url_to_open)); |
1256 } | 1259 } |
1257 } | 1260 } |
1258 | 1261 |
1262 // Overridden from MagnificationObserver | |
1263 void OnMagnifierTypeChanged(ash::MagnifierType new_type) { | |
1264 OnAccessibilityModeChanged(); | |
1265 } | |
1266 | |
1259 scoped_ptr<base::WeakPtrFactory<SystemTrayDelegate> > ui_weak_ptr_factory_; | 1267 scoped_ptr<base::WeakPtrFactory<SystemTrayDelegate> > ui_weak_ptr_factory_; |
1260 scoped_ptr<NetworkMenuIcon> network_icon_; | 1268 scoped_ptr<NetworkMenuIcon> network_icon_; |
1261 scoped_ptr<NetworkMenuIcon> network_icon_dark_; | 1269 scoped_ptr<NetworkMenuIcon> network_icon_dark_; |
1262 scoped_ptr<NetworkMenu> network_menu_; | 1270 scoped_ptr<NetworkMenu> network_menu_; |
1263 content::NotificationRegistrar registrar_; | 1271 content::NotificationRegistrar registrar_; |
1264 scoped_ptr<PrefChangeRegistrar> pref_registrar_; | 1272 scoped_ptr<PrefChangeRegistrar> pref_registrar_; |
1265 std::string cellular_device_path_; | 1273 std::string cellular_device_path_; |
1266 std::string active_network_path_; | 1274 std::string active_network_path_; |
1267 PowerSupplyStatus power_supply_status_; | 1275 PowerSupplyStatus power_supply_status_; |
1268 base::HourClockType clock_type_; | 1276 base::HourClockType clock_type_; |
(...skipping 16 matching lines...) Expand all Loading... | |
1285 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1293 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1286 }; | 1294 }; |
1287 | 1295 |
1288 } // namespace | 1296 } // namespace |
1289 | 1297 |
1290 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1298 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1291 return new chromeos::SystemTrayDelegate(); | 1299 return new chromeos::SystemTrayDelegate(); |
1292 } | 1300 } |
1293 | 1301 |
1294 } // namespace chromeos | 1302 } // namespace chromeos |
OLD | NEW |