Index: chrome/browser/chromeos/system/ash_system_tray_delegate.cc |
=================================================================== |
--- chrome/browser/chromeos/system/ash_system_tray_delegate.cc (revision 152151) |
+++ chrome/browser/chromeos/system/ash_system_tray_delegate.cc (working copy) |
@@ -208,9 +208,6 @@ |
registrar_.Add(this, |
chrome::NOTIFICATION_PROFILE_CREATED, |
content::NotificationService::AllSources()); |
- registrar_.Add(this, |
- chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
- content::NotificationService::AllSources()); |
accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, |
g_browser_process->local_state(), this); |
@@ -240,10 +237,14 @@ |
bluetooth_adapter_->RemoveObserver(this); |
// Stop observing gdata operations. |
- GDataSystemService* system_service = FindGDataSystemService(); |
- if (system_service) { |
- system_service->docs_service()->operation_registry()-> |
- RemoveObserver(this); |
+ Profile* profile = ProfileManager::GetDefaultProfile(); |
+ if (gdata::util::IsGDataAvailable(profile)) { |
+ GDataSystemService* system_service = |
+ GDataSystemServiceFactory::FindForProfile(profile); |
+ if (system_service) { |
+ system_service->docs_service()->operation_registry()-> |
+ RemoveObserver(this); |
+ } |
} |
} |
@@ -452,7 +453,12 @@ |
} |
virtual void CancelDriveOperation(const FilePath& file_path) OVERRIDE { |
- GDataSystemService* system_service = FindGDataSystemService(); |
+ Profile* profile = ProfileManager::GetDefaultProfile(); |
+ if (!gdata::util::IsGDataAvailable(profile)) |
+ return; |
+ |
+ GDataSystemService* system_service = |
+ GDataSystemServiceFactory::FindForProfile(profile); |
if (!system_service) |
return; |
@@ -462,7 +468,12 @@ |
virtual void GetDriveOperationStatusList( |
ash::DriveOperationStatusList* list) OVERRIDE { |
- GDataSystemService* system_service = FindGDataSystemService(); |
+ Profile* profile = ProfileManager::GetDefaultProfile(); |
+ if (!gdata::util::IsGDataAvailable(profile)) |
+ return; |
+ |
+ GDataSystemService* system_service = |
+ GDataSystemServiceFactory::FindForProfile(profile); |
if (!system_service) |
return; |
@@ -725,14 +736,15 @@ |
UpdateClockType(profile->GetPrefs()); |
search_key_mapped_to_ = |
profile->GetPrefs()->GetInteger(prefs::kLanguageXkbRemapSearchKeyTo); |
- } |
- void ObserveGDataUpdates() { |
- GDataSystemService* system_service = FindGDataSystemService(); |
- if (!system_service) |
- return; |
+ if (gdata::util::IsGDataAvailable(profile)) { |
+ GDataSystemService* system_service = |
+ GDataSystemServiceFactory::FindForProfile(profile); |
+ if (!system_service) |
+ return; |
- system_service->docs_service()->operation_registry()->AddObserver(this); |
+ system_service->docs_service()->operation_registry()->AddObserver(this); |
+ } |
} |
void UpdateClockType(PrefService* service) { |
@@ -1027,11 +1039,6 @@ |
} |
break; |
} |
- case chrome::NOTIFICATION_LOGIN_USER_CHANGED: { |
- // GData system service exists by the time if enabled. |
- ObserveGDataUpdates(); |
- break; |
- } |
case chrome::NOTIFICATION_PREF_CHANGED: { |
std::string pref = *content::Details<std::string>(details).ptr(); |
PrefService* service = content::Source<PrefService>(source).ptr(); |
@@ -1123,7 +1130,12 @@ |
// status in UI in cases when there are no new changes coming (i.e. when the |
// last set of transfer operations completed). |
void RecheckGDataOperations() { |
- GDataSystemService* system_service = FindGDataSystemService(); |
+ Profile* profile = ProfileManager::GetDefaultProfile(); |
+ if (!gdata::util::IsGDataAvailable(profile)) |
+ return; |
+ |
+ GDataSystemService* system_service = |
+ GDataSystemServiceFactory::FindForProfile(profile); |
if (!system_service) |
return; |
@@ -1131,13 +1143,6 @@ |
GetProgressStatusList()); |
} |
- GDataSystemService* FindGDataSystemService() { |
- Profile* profile = ProfileManager::GetDefaultProfile(); |
- if (!gdata::util::IsGDataAvailable(profile)) |
- return NULL; |
- return GDataSystemServiceFactory::FindForProfile(profile); |
- } |
- |
// Overridden from system::TimezoneSettings::Observer. |
virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { |
NotifyRefreshClock(); |