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 18 matching lines...) Expand all Loading... |
29 #include "base/memory/weak_ptr.h" | 29 #include "base/memory/weak_ptr.h" |
30 #include "base/utf_string_conversions.h" | 30 #include "base/utf_string_conversions.h" |
31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
32 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 32 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
33 #include "chrome/browser/chromeos/audio/audio_handler.h" | 33 #include "chrome/browser/chromeos/audio/audio_handler.h" |
34 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | 34 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
35 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" | 35 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
36 #include "chrome/browser/chromeos/cros/cros_library.h" | 36 #include "chrome/browser/chromeos/cros/cros_library.h" |
37 #include "chrome/browser/chromeos/cros/network_library.h" | 37 #include "chrome/browser/chromeos/cros/network_library.h" |
38 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" | 38 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" |
39 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 39 #include "chrome/browser/chromeos/gdata/drive_system_service.h" |
40 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 40 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
41 #include "chrome/browser/chromeos/gdata/operation_registry.h" | 41 #include "chrome/browser/chromeos/gdata/operation_registry.h" |
42 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 42 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
43 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 43 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
44 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 44 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
45 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 45 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
46 #include "chrome/browser/chromeos/login/base_login_display_host.h" | 46 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
47 #include "chrome/browser/chromeos/login/login_display_host.h" | 47 #include "chrome/browser/chromeos/login/login_display_host.h" |
48 #include "chrome/browser/chromeos/login/message_bubble.h" | 48 #include "chrome/browser/chromeos/login/message_bubble.h" |
49 #include "chrome/browser/chromeos/login/user.h" | 49 #include "chrome/browser/chromeos/login/user.h" |
(...skipping 19 matching lines...) Expand all Loading... |
69 #include "chromeos/dbus/dbus_thread_manager.h" | 69 #include "chromeos/dbus/dbus_thread_manager.h" |
70 #include "chromeos/dbus/power_manager_client.h" | 70 #include "chromeos/dbus/power_manager_client.h" |
71 #include "chromeos/dbus/session_manager_client.h" | 71 #include "chromeos/dbus/session_manager_client.h" |
72 #include "content/public/browser/browser_thread.h" | 72 #include "content/public/browser/browser_thread.h" |
73 #include "content/public/browser/notification_observer.h" | 73 #include "content/public/browser/notification_observer.h" |
74 #include "content/public/browser/notification_service.h" | 74 #include "content/public/browser/notification_service.h" |
75 #include "content/public/browser/user_metrics.h" | 75 #include "content/public/browser/user_metrics.h" |
76 #include "grit/generated_resources.h" | 76 #include "grit/generated_resources.h" |
77 #include "ui/base/l10n/l10n_util.h" | 77 #include "ui/base/l10n/l10n_util.h" |
78 | 78 |
79 using gdata::GDataSystemService; | 79 using gdata::DriveSystemService; |
80 using gdata::GDataSystemServiceFactory; | 80 using gdata::DriveSystemServiceFactory; |
81 using gdata::OperationRegistry; | 81 using gdata::OperationRegistry; |
82 | 82 |
83 namespace chromeos { | 83 namespace chromeos { |
84 | 84 |
85 namespace { | 85 namespace { |
86 | 86 |
87 // Time delay for rechecking gdata operation when we suspect that there will | 87 // Time delay for rechecking gdata operation when we suspect that there will |
88 // be no upcoming activity notifications that need to be pushed to UI. | 88 // be no upcoming activity notifications that need to be pushed to UI. |
89 const int kGDataOperationRecheckDelayMs = 5000; | 89 const int kGDataOperationRecheckDelayMs = 5000; |
90 | 90 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 input_method::InputMethodManager::GetInstance()->RemoveObserver(this); | 233 input_method::InputMethodManager::GetInstance()->RemoveObserver(this); |
234 system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 234 system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
235 if (SystemKeyEventListener::GetInstance()) | 235 if (SystemKeyEventListener::GetInstance()) |
236 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); | 236 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); |
237 bluetooth_adapter_->RemoveObserver(this); | 237 bluetooth_adapter_->RemoveObserver(this); |
238 | 238 |
239 // Stop observing gdata operations. | 239 // Stop observing gdata operations. |
240 Profile* profile = ProfileManager::GetDefaultProfile(); | 240 Profile* profile = ProfileManager::GetDefaultProfile(); |
241 if (gdata::util::IsGDataAvailable(profile)) { | 241 if (gdata::util::IsGDataAvailable(profile)) { |
242 GDataSystemService* system_service = | 242 DriveSystemService* system_service = |
243 GDataSystemServiceFactory::FindForProfile(profile); | 243 DriveSystemServiceFactory::FindForProfile(profile); |
244 if (system_service) { | 244 if (system_service) { |
245 system_service->drive_service()->operation_registry()-> | 245 system_service->drive_service()->operation_registry()-> |
246 RemoveObserver(this); | 246 RemoveObserver(this); |
247 } | 247 } |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 // Overridden from ash::SystemTrayDelegate: | 251 // Overridden from ash::SystemTrayDelegate: |
252 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { | 252 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { |
253 // In case of OOBE / sign in screen tray will be shown later. | 253 // In case of OOBE / sign in screen tray will be shown later. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 virtual void ActivateIMEProperty(const std::string& key) OVERRIDE { | 450 virtual void ActivateIMEProperty(const std::string& key) OVERRIDE { |
451 input_method::InputMethodManager::GetInstance()-> | 451 input_method::InputMethodManager::GetInstance()-> |
452 ActivateInputMethodProperty(key); | 452 ActivateInputMethodProperty(key); |
453 } | 453 } |
454 | 454 |
455 virtual void CancelDriveOperation(const FilePath& file_path) OVERRIDE { | 455 virtual void CancelDriveOperation(const FilePath& file_path) OVERRIDE { |
456 Profile* profile = ProfileManager::GetDefaultProfile(); | 456 Profile* profile = ProfileManager::GetDefaultProfile(); |
457 if (!gdata::util::IsGDataAvailable(profile)) | 457 if (!gdata::util::IsGDataAvailable(profile)) |
458 return; | 458 return; |
459 | 459 |
460 GDataSystemService* system_service = | 460 DriveSystemService* system_service = |
461 GDataSystemServiceFactory::FindForProfile(profile); | 461 DriveSystemServiceFactory::FindForProfile(profile); |
462 if (!system_service) | 462 if (!system_service) |
463 return; | 463 return; |
464 | 464 |
465 system_service->drive_service()->operation_registry()->CancelForFilePath( | 465 system_service->drive_service()->operation_registry()->CancelForFilePath( |
466 file_path); | 466 file_path); |
467 } | 467 } |
468 | 468 |
469 virtual void GetDriveOperationStatusList( | 469 virtual void GetDriveOperationStatusList( |
470 ash::DriveOperationStatusList* list) OVERRIDE { | 470 ash::DriveOperationStatusList* list) OVERRIDE { |
471 Profile* profile = ProfileManager::GetDefaultProfile(); | 471 Profile* profile = ProfileManager::GetDefaultProfile(); |
472 if (!gdata::util::IsGDataAvailable(profile)) | 472 if (!gdata::util::IsGDataAvailable(profile)) |
473 return; | 473 return; |
474 | 474 |
475 GDataSystemService* system_service = | 475 DriveSystemService* system_service = |
476 GDataSystemServiceFactory::FindForProfile(profile); | 476 DriveSystemServiceFactory::FindForProfile(profile); |
477 if (!system_service) | 477 if (!system_service) |
478 return; | 478 return; |
479 | 479 |
480 *list = GetDriveStatusList( | 480 *list = GetDriveStatusList( |
481 system_service->drive_service()->operation_registry()-> | 481 system_service->drive_service()->operation_registry()-> |
482 GetProgressStatusList()); | 482 GetProgressStatusList()); |
483 } | 483 } |
484 | 484 |
485 | 485 |
486 virtual void GetMostRelevantNetworkIcon(ash::NetworkIconInfo* info, | 486 virtual void GetMostRelevantNetworkIcon(ash::NetworkIconInfo* info, |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 void SetProfile(Profile* profile) { | 731 void SetProfile(Profile* profile) { |
732 pref_registrar_.reset(new PrefChangeRegistrar); | 732 pref_registrar_.reset(new PrefChangeRegistrar); |
733 pref_registrar_->Init(profile->GetPrefs()); | 733 pref_registrar_->Init(profile->GetPrefs()); |
734 pref_registrar_->Add(prefs::kUse24HourClock, this); | 734 pref_registrar_->Add(prefs::kUse24HourClock, this); |
735 pref_registrar_->Add(prefs::kLanguageXkbRemapSearchKeyTo, this); | 735 pref_registrar_->Add(prefs::kLanguageXkbRemapSearchKeyTo, this); |
736 UpdateClockType(profile->GetPrefs()); | 736 UpdateClockType(profile->GetPrefs()); |
737 search_key_mapped_to_ = | 737 search_key_mapped_to_ = |
738 profile->GetPrefs()->GetInteger(prefs::kLanguageXkbRemapSearchKeyTo); | 738 profile->GetPrefs()->GetInteger(prefs::kLanguageXkbRemapSearchKeyTo); |
739 | 739 |
740 if (gdata::util::IsGDataAvailable(profile)) { | 740 if (gdata::util::IsGDataAvailable(profile)) { |
741 GDataSystemService* system_service = | 741 DriveSystemService* system_service = |
742 GDataSystemServiceFactory::FindForProfile(profile); | 742 DriveSystemServiceFactory::FindForProfile(profile); |
743 if (!system_service) | 743 if (!system_service) |
744 return; | 744 return; |
745 | 745 |
746 system_service->drive_service()->operation_registry()->AddObserver(this); | 746 system_service->drive_service()->operation_registry()->AddObserver(this); |
747 } | 747 } |
748 } | 748 } |
749 | 749 |
750 void UpdateClockType(PrefService* service) { | 750 void UpdateClockType(PrefService* service) { |
751 clock_type_ = service->GetBoolean(prefs::kUse24HourClock) ? | 751 clock_type_ = service->GetBoolean(prefs::kUse24HourClock) ? |
752 base::k24HourClock : base::k12HourClock; | 752 base::k24HourClock : base::k12HourClock; |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 | 1127 |
1128 // Pulls the list of ongoing drive operations and initiates status update. | 1128 // Pulls the list of ongoing drive operations and initiates status update. |
1129 // This method is needed to ensure delayed cleanup of the latest reported | 1129 // This method is needed to ensure delayed cleanup of the latest reported |
1130 // status in UI in cases when there are no new changes coming (i.e. when the | 1130 // status in UI in cases when there are no new changes coming (i.e. when the |
1131 // last set of transfer operations completed). | 1131 // last set of transfer operations completed). |
1132 void RecheckGDataOperations() { | 1132 void RecheckGDataOperations() { |
1133 Profile* profile = ProfileManager::GetDefaultProfile(); | 1133 Profile* profile = ProfileManager::GetDefaultProfile(); |
1134 if (!gdata::util::IsGDataAvailable(profile)) | 1134 if (!gdata::util::IsGDataAvailable(profile)) |
1135 return; | 1135 return; |
1136 | 1136 |
1137 GDataSystemService* system_service = | 1137 DriveSystemService* system_service = |
1138 GDataSystemServiceFactory::FindForProfile(profile); | 1138 DriveSystemServiceFactory::FindForProfile(profile); |
1139 if (!system_service) | 1139 if (!system_service) |
1140 return; | 1140 return; |
1141 | 1141 |
1142 OnProgressUpdate(system_service->drive_service()->operation_registry()-> | 1142 OnProgressUpdate(system_service->drive_service()->operation_registry()-> |
1143 GetProgressStatusList()); | 1143 GetProgressStatusList()); |
1144 } | 1144 } |
1145 | 1145 |
1146 // Overridden from system::TimezoneSettings::Observer. | 1146 // Overridden from system::TimezoneSettings::Observer. |
1147 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { | 1147 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { |
1148 NotifyRefreshClock(); | 1148 NotifyRefreshClock(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1254 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1255 }; | 1255 }; |
1256 | 1256 |
1257 } // namespace | 1257 } // namespace |
1258 | 1258 |
1259 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 1259 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
1260 return new chromeos::SystemTrayDelegate(tray); | 1260 return new chromeos::SystemTrayDelegate(tray); |
1261 } | 1261 } |
1262 | 1262 |
1263 } // namespace chromeos | 1263 } // namespace chromeos |
OLD | NEW |