Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4615)

Unified Diff: chrome/browser/chrome_to_mobile_service.cc

Issue 13197004: Draft: InvalidationService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Passes tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_to_mobile_service.cc
diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc
index 4d5504f184dacb0c8ef100933bc7466adf862bfc..8b189fe571bd338c61d3bb4977c11bdc63dc7ec4 100644
--- a/chrome/browser/chrome_to_mobile_service.cc
+++ b/chrome/browser/chrome_to_mobile_service.cc
@@ -15,12 +15,12 @@
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_to_mobile_service_factory.h"
+#include "chrome/browser/invalidation_service.h"
+#include "chrome/browser/invalidation_service_factory.h"
#include "chrome/browser/printing/cloud_print/cloud_print_url.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/token_service.h"
#include "chrome/browser/signin/token_service_factory.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -259,23 +259,23 @@ void ChromeToMobileService::RegisterUserPrefs(PrefRegistrySyncable* registry) {
ChromeToMobileService::ChromeToMobileService(Profile* profile)
: ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
profile_(profile),
- sync_invalidation_enabled_(false) {
+ invalidation_enabled_(false) {
// TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183
- ProfileSyncService* profile_sync_service =
- profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL;
- if (profile_sync_service) {
+ InvalidationService* invalidation_service =
+ profile_ ? InvalidationServiceFactory::GetForProfile(profile_) : NULL;
+ if (invalidation_service) {
CloudPrintURL cloud_print_url(profile_);
cloud_print_url_ = cloud_print_url.GetCloudPrintServiceURL();
- sync_invalidation_enabled_ =
- (profile_sync_service->GetInvalidatorState() ==
+ invalidation_enabled_ =
+ (invalidation_service->GetInvalidatorState() ==
syncer::INVALIDATIONS_ENABLED);
// Register for cloud print device list invalidation notifications.
- profile_sync_service->RegisterInvalidationHandler(this);
+ invalidation_service->RegisterInvalidationHandler(this);
syncer::ObjectIdSet ids;
ids.insert(invalidation::ObjectId(
ipc::invalidation::ObjectSource::CHROME_COMPONENTS,
kSyncInvalidationObjectIdChromeToMobileDeviceList));
- profile_sync_service->UpdateRegisteredInvalidationIds(this, ids);
+ invalidation_service->UpdateRegisteredInvalidationIds(this, ids);
}
}
@@ -290,7 +290,7 @@ bool ChromeToMobileService::HasMobiles() const {
}
const base::ListValue* ChromeToMobileService::GetMobiles() const {
- return sync_invalidation_enabled_ ?
+ return invalidation_enabled_ ?
profile_->GetPrefs()->GetList(prefs::kChromeToMobileDeviceList) : NULL;
}
@@ -382,10 +382,10 @@ void ChromeToMobileService::LearnMore(Browser* browser) const {
void ChromeToMobileService::Shutdown() {
// TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183
// Unregister for cloud print device list invalidation notifications.
- ProfileSyncService* profile_sync_service =
- profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL;
- if (profile_sync_service)
- profile_sync_service->UnregisterInvalidationHandler(this);
+ InvalidationService* invalidation_service =
+ profile_ ? InvalidationServiceFactory::GetForProfile(profile_) : NULL;
+ if (invalidation_service)
+ invalidation_service->UnregisterInvalidationHandler(this);
}
void ChromeToMobileService::OnURLFetchComplete(const net::URLFetcher* source) {
@@ -470,7 +470,7 @@ void ChromeToMobileService::OnGetTokenFailure(
void ChromeToMobileService::OnInvalidatorStateChange(
syncer::InvalidatorState state) {
- sync_invalidation_enabled_ = (state == syncer::INVALIDATIONS_ENABLED);
+ invalidation_enabled_ = (state == syncer::INVALIDATIONS_ENABLED);
}
void ChromeToMobileService::OnIncomingInvalidation(
@@ -480,12 +480,12 @@ void ChromeToMobileService::OnIncomingInvalidation(
ipc::invalidation::ObjectSource::CHROME_COMPONENTS,
kSyncInvalidationObjectIdChromeToMobileDeviceList)));
// TODO(msw): Unit tests do not provide profiles; see http://crbug.com/122183
- ProfileSyncService* profile_sync_service =
- profile_ ? ProfileSyncServiceFactory::GetForProfile(profile_) : NULL;
- if (profile_sync_service) {
+ InvalidationService* invalidation_service =
+ profile_ ? InvalidationServiceFactory::GetForProfile(profile_) : NULL;
+ if (invalidation_service) {
// TODO(dcheng): Only acknowledge the invalidation once the device search
// has finished. http://crbug.com/156843.
- profile_sync_service->AcknowledgeInvalidation(
+ invalidation_service->AcknowledgeInvalidation(
invalidation_map.begin()->first,
invalidation_map.begin()->second.ack_handle);
}

Powered by Google App Engine
This is Rietveld 408576698