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 13 matching lines...) Expand all Loading... |
24 #include "base/logging.h" | 24 #include "base/logging.h" |
25 #include "base/memory/weak_ptr.h" | 25 #include "base/memory/weak_ptr.h" |
26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
28 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 28 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
29 #include "chrome/browser/chromeos/audio/audio_handler.h" | 29 #include "chrome/browser/chromeos/audio/audio_handler.h" |
30 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | 30 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
31 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" | 31 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
32 #include "chrome/browser/chromeos/cros/cros_library.h" | 32 #include "chrome/browser/chromeos/cros/cros_library.h" |
33 #include "chrome/browser/chromeos/cros/network_library.h" | 33 #include "chrome/browser/chromeos/cros/network_library.h" |
| 34 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
| 35 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" |
34 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 36 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
35 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 37 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
36 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 38 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
37 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 39 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
38 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 40 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
39 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 41 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
40 #include "chrome/browser/chromeos/login/base_login_display_host.h" | 42 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
41 #include "chrome/browser/chromeos/login/login_display_host.h" | 43 #include "chrome/browser/chromeos/login/login_display_host.h" |
42 #include "chrome/browser/chromeos/login/message_bubble.h" | 44 #include "chrome/browser/chromeos/login/message_bubble.h" |
43 #include "chrome/browser/chromeos/login/user.h" | 45 #include "chrome/browser/chromeos/login/user.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 230 system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
229 if (SystemKeyEventListener::GetInstance()) | 231 if (SystemKeyEventListener::GetInstance()) |
230 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); | 232 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); |
231 bluetooth_adapter_->RemoveObserver(this); | 233 bluetooth_adapter_->RemoveObserver(this); |
232 | 234 |
233 // Stop observing gdata operations. | 235 // Stop observing gdata operations. |
234 Profile* profile = ProfileManager::GetDefaultProfile(); | 236 Profile* profile = ProfileManager::GetDefaultProfile(); |
235 if (gdata::util::IsGDataAvailable(profile)) { | 237 if (gdata::util::IsGDataAvailable(profile)) { |
236 GDataSystemService* system_service = | 238 GDataSystemService* system_service = |
237 GDataSystemServiceFactory::FindForProfile(profile); | 239 GDataSystemServiceFactory::FindForProfile(profile); |
238 if (system_service && system_service->file_system()) { | 240 if (system_service) { |
239 system_service->file_system()->GetOperationRegistry()-> | 241 system_service->docs_service()->operation_registry()-> |
240 RemoveObserver(this); | 242 RemoveObserver(this); |
241 } | 243 } |
242 } | 244 } |
243 } | 245 } |
244 | 246 |
245 // Overridden from ash::SystemTrayDelegate: | 247 // Overridden from ash::SystemTrayDelegate: |
246 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { | 248 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { |
247 return !chromeos::KioskModeSettings::Get()->IsKioskModeEnabled(); | 249 return !chromeos::KioskModeSettings::Get()->IsKioskModeEnabled(); |
248 } | 250 } |
249 | 251 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 ActivateInputMethodProperty(key); | 460 ActivateInputMethodProperty(key); |
459 } | 461 } |
460 | 462 |
461 virtual void CancelDriveOperation(const FilePath& file_path) OVERRIDE { | 463 virtual void CancelDriveOperation(const FilePath& file_path) OVERRIDE { |
462 Profile* profile = ProfileManager::GetDefaultProfile(); | 464 Profile* profile = ProfileManager::GetDefaultProfile(); |
463 if (!gdata::util::IsGDataAvailable(profile)) | 465 if (!gdata::util::IsGDataAvailable(profile)) |
464 return; | 466 return; |
465 | 467 |
466 GDataSystemService* system_service = | 468 GDataSystemService* system_service = |
467 GDataSystemServiceFactory::FindForProfile(profile); | 469 GDataSystemServiceFactory::FindForProfile(profile); |
468 if (!system_service || !system_service->file_system()) | 470 if (!system_service) |
469 return; | 471 return; |
470 | 472 |
471 system_service->file_system()->GetOperationRegistry()->CancelForFilePath( | 473 system_service->docs_service()->operation_registry()->CancelForFilePath( |
472 file_path); | 474 file_path); |
473 } | 475 } |
474 | 476 |
475 virtual void GetDriveOperationStatusList( | 477 virtual void GetDriveOperationStatusList( |
476 ash::DriveOperationStatusList* list) OVERRIDE { | 478 ash::DriveOperationStatusList* list) OVERRIDE { |
477 Profile* profile = ProfileManager::GetDefaultProfile(); | 479 Profile* profile = ProfileManager::GetDefaultProfile(); |
478 if (!gdata::util::IsGDataAvailable(profile)) | 480 if (!gdata::util::IsGDataAvailable(profile)) |
479 return; | 481 return; |
480 | 482 |
481 GDataSystemService* system_service = | 483 GDataSystemService* system_service = |
482 GDataSystemServiceFactory::FindForProfile(profile); | 484 GDataSystemServiceFactory::FindForProfile(profile); |
483 if (!system_service || !system_service->file_system()) | 485 if (!system_service) |
484 return; | 486 return; |
485 | 487 |
486 *list = GetDriveStatusList( | 488 *list = GetDriveStatusList( |
487 system_service->file_system()->GetOperationRegistry()-> | 489 system_service->docs_service()->operation_registry()-> |
488 GetProgressStatusList()); | 490 GetProgressStatusList()); |
489 } | 491 } |
490 | 492 |
491 | 493 |
492 virtual void GetMostRelevantNetworkIcon(ash::NetworkIconInfo* info, | 494 virtual void GetMostRelevantNetworkIcon(ash::NetworkIconInfo* info, |
493 bool dark) OVERRIDE { | 495 bool dark) OVERRIDE { |
494 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 496 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
495 info->image = !dark ? network_icon_->GetIconAndText(&info->description) : | 497 info->image = !dark ? network_icon_->GetIconAndText(&info->description) : |
496 network_icon_dark_->GetIconAndText(&info->description); | 498 network_icon_dark_->GetIconAndText(&info->description); |
497 info->tray_icon_visible = | 499 info->tray_icon_visible = |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 pref_registrar_->Init(profile->GetPrefs()); | 776 pref_registrar_->Init(profile->GetPrefs()); |
775 pref_registrar_->Add(prefs::kUse24HourClock, this); | 777 pref_registrar_->Add(prefs::kUse24HourClock, this); |
776 pref_registrar_->Add(prefs::kLanguageXkbRemapSearchKeyTo, this); | 778 pref_registrar_->Add(prefs::kLanguageXkbRemapSearchKeyTo, this); |
777 UpdateClockType(profile->GetPrefs()); | 779 UpdateClockType(profile->GetPrefs()); |
778 search_key_mapped_to_ = | 780 search_key_mapped_to_ = |
779 profile->GetPrefs()->GetInteger(prefs::kLanguageXkbRemapSearchKeyTo); | 781 profile->GetPrefs()->GetInteger(prefs::kLanguageXkbRemapSearchKeyTo); |
780 | 782 |
781 if (gdata::util::IsGDataAvailable(profile)) { | 783 if (gdata::util::IsGDataAvailable(profile)) { |
782 GDataSystemService* system_service = | 784 GDataSystemService* system_service = |
783 GDataSystemServiceFactory::FindForProfile(profile); | 785 GDataSystemServiceFactory::FindForProfile(profile); |
784 if (!system_service || !system_service->file_system()) | 786 if (!system_service) |
785 return; | 787 return; |
786 | 788 |
787 system_service->file_system()->GetOperationRegistry()-> | 789 system_service->docs_service()->operation_registry()->AddObserver(this); |
788 AddObserver(this); | |
789 } | 790 } |
790 } | 791 } |
791 | 792 |
792 void UpdateClockType(PrefService* service) { | 793 void UpdateClockType(PrefService* service) { |
793 clock_type_ = service->GetBoolean(prefs::kUse24HourClock) ? | 794 clock_type_ = service->GetBoolean(prefs::kUse24HourClock) ? |
794 base::k24HourClock : base::k12HourClock; | 795 base::k24HourClock : base::k12HourClock; |
795 ash::ClockObserver* observer = tray_->clock_observer(); | 796 ash::ClockObserver* observer = tray_->clock_observer(); |
796 if (observer) | 797 if (observer) |
797 observer->OnDateFormatChanged(); | 798 observer->OnDateFormatChanged(); |
798 } | 799 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 // This method is needed to ensure delayed cleanup of the latest reported | 1113 // This method is needed to ensure delayed cleanup of the latest reported |
1113 // status in UI in cases when there are no new changes coming (i.e. when the | 1114 // status in UI in cases when there are no new changes coming (i.e. when the |
1114 // last set of transfer operations completed). | 1115 // last set of transfer operations completed). |
1115 void RecheckGDataOperations() { | 1116 void RecheckGDataOperations() { |
1116 Profile* profile = ProfileManager::GetDefaultProfile(); | 1117 Profile* profile = ProfileManager::GetDefaultProfile(); |
1117 if (!gdata::util::IsGDataAvailable(profile)) | 1118 if (!gdata::util::IsGDataAvailable(profile)) |
1118 return; | 1119 return; |
1119 | 1120 |
1120 GDataSystemService* system_service = | 1121 GDataSystemService* system_service = |
1121 GDataSystemServiceFactory::FindForProfile(profile); | 1122 GDataSystemServiceFactory::FindForProfile(profile); |
1122 if (!system_service || !system_service->file_system()) | 1123 if (!system_service) |
1123 return; | 1124 return; |
1124 | 1125 |
1125 OnProgressUpdate(system_service->file_system()->GetOperationRegistry()-> | 1126 OnProgressUpdate(system_service->docs_service()->operation_registry()-> |
1126 GetProgressStatusList()); | 1127 GetProgressStatusList()); |
1127 } | 1128 } |
1128 | 1129 |
1129 // Overridden from system::TimezoneSettings::Observer. | 1130 // Overridden from system::TimezoneSettings::Observer. |
1130 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { | 1131 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { |
1131 NotifyRefreshClock(); | 1132 NotifyRefreshClock(); |
1132 } | 1133 } |
1133 | 1134 |
1134 // Overridden from BluetoothAdapter::Observer. | 1135 // Overridden from BluetoothAdapter::Observer. |
1135 virtual void AdapterPresentChanged(BluetoothAdapter* adapter, | 1136 virtual void AdapterPresentChanged(BluetoothAdapter* adapter, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1236 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1236 }; | 1237 }; |
1237 | 1238 |
1238 } // namespace | 1239 } // namespace |
1239 | 1240 |
1240 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 1241 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
1241 return new chromeos::SystemTrayDelegate(tray); | 1242 return new chromeos::SystemTrayDelegate(tray); |
1242 } | 1243 } |
1243 | 1244 |
1244 } // namespace chromeos | 1245 } // namespace chromeos |
OLD | NEW |