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

Unified Diff: chrome/browser/chrome_to_mobile_service.cc

Issue 15580002: Make use of InvalidationService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 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
« no previous file with comments | « chrome/browser/chrome_to_mobile_service.h ('k') | chrome/browser/chrome_to_mobile_service_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4233625d0f4fc708c5ba72a70d05a4ad151ff384..7bd833f3b12fc32e3a00217988947dd98a67bf88 100644
--- a/chrome/browser/chrome_to_mobile_service.cc
+++ b/chrome/browser/chrome_to_mobile_service.cc
@@ -15,12 +15,12 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_to_mobile_service_factory.h"
+#include "chrome/browser/invalidation/invalidation_service.h"
+#include "chrome/browser/invalidation/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"
@@ -261,23 +261,24 @@ void ChromeToMobileService::RegisterUserPrefs(
ChromeToMobileService::ChromeToMobileService(Profile* profile)
: 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) {
+
+ invalidation::InvalidationService* invalidation_service = profile_ ?
+ invalidation::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);
}
}
@@ -292,7 +293,7 @@ bool ChromeToMobileService::HasMobiles() const {
}
const base::ListValue* ChromeToMobileService::GetMobiles() const {
- return sync_invalidation_enabled_ ?
+ return invalidation_enabled_ ?
profile_->GetPrefs()->GetList(prefs::kChromeToMobileDeviceList) : NULL;
}
@@ -384,10 +385,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);
+ invalidation::InvalidationService* invalidation_service = profile_ ?
+ invalidation::InvalidationServiceFactory::GetForProfile(profile_) : NULL;
+ if (invalidation_service)
+ invalidation_service->UnregisterInvalidationHandler(this);
}
void ChromeToMobileService::OnURLFetchComplete(const net::URLFetcher* source) {
@@ -472,7 +473,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(
@@ -482,12 +483,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) {
+ invalidation::InvalidationService* invalidation_service = profile_ ?
+ invalidation::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);
}
« no previous file with comments | « chrome/browser/chrome_to_mobile_service.h ('k') | chrome/browser/chrome_to_mobile_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698