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