Commit b1428bf8 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

[SyncInvalidations] Move sender and app ID constants into the service

These constants used to be defined in the factory and passed into the
service. However, they're always the same, so might just as well be
defined directly in the service. This avoids having to duplicate them
in other factories (for iOS).

Bug: 1102314
Change-Id: I518dcd04524f5a7e7e9399d66a4adc775df2aaf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2400419
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805288}
parent e4c0a3fc
...@@ -13,10 +13,6 @@ ...@@ -13,10 +13,6 @@
#include "components/sync/invalidations/switches.h" #include "components/sync/invalidations/switches.h"
#include "components/sync/invalidations/sync_invalidations_service_impl.h" #include "components/sync/invalidations/sync_invalidations_service_impl.h"
// TODO(crbug.com/1082115): change to real sync sender id: 8181035976.
constexpr char kDefaultSenderId[] = "361488507004";
constexpr char kDefaultApplicationId[] = "com.google.chrome.sync.invalidations";
syncer::SyncInvalidationsService* syncer::SyncInvalidationsService*
SyncInvalidationsServiceFactory::GetForProfile(Profile* profile) { SyncInvalidationsServiceFactory::GetForProfile(Profile* profile) {
return static_cast<syncer::SyncInvalidationsService*>( return static_cast<syncer::SyncInvalidationsService*>(
...@@ -52,6 +48,6 @@ KeyedService* SyncInvalidationsServiceFactory::BuildServiceInstanceFor( ...@@ -52,6 +48,6 @@ KeyedService* SyncInvalidationsServiceFactory::BuildServiceInstanceFor(
instance_id::InstanceIDDriver* instance_id_driver = instance_id::InstanceIDDriver* instance_id_driver =
instance_id::InstanceIDProfileServiceFactory::GetForProfile(profile) instance_id::InstanceIDProfileServiceFactory::GetForProfile(profile)
->driver(); ->driver();
return new syncer::SyncInvalidationsServiceImpl( return new syncer::SyncInvalidationsServiceImpl(gcm_driver,
gcm_driver, instance_id_driver, kDefaultSenderId, kDefaultApplicationId); instance_id_driver);
} }
...@@ -8,13 +8,19 @@ ...@@ -8,13 +8,19 @@
namespace syncer { namespace syncer {
namespace {
// TODO(crbug.com/1082115): change to real sync sender id: 8181035976.
constexpr char kSenderId[] = "361488507004";
constexpr char kApplicationId[] = "com.google.chrome.sync.invalidations";
} // namespace
SyncInvalidationsServiceImpl::SyncInvalidationsServiceImpl( SyncInvalidationsServiceImpl::SyncInvalidationsServiceImpl(
gcm::GCMDriver* gcm_driver, gcm::GCMDriver* gcm_driver,
instance_id::InstanceIDDriver* instance_id_driver, instance_id::InstanceIDDriver* instance_id_driver) {
const std::string& sender_id,
const std::string& app_id) {
fcm_handler_ = std::make_unique<FCMHandler>(gcm_driver, instance_id_driver, fcm_handler_ = std::make_unique<FCMHandler>(gcm_driver, instance_id_driver,
sender_id, app_id); kSenderId, kApplicationId);
fcm_handler_->StartListening(); fcm_handler_->StartListening();
} }
......
...@@ -28,9 +28,7 @@ class SyncInvalidationsServiceImpl : public SyncInvalidationsService { ...@@ -28,9 +28,7 @@ class SyncInvalidationsServiceImpl : public SyncInvalidationsService {
public: public:
SyncInvalidationsServiceImpl( SyncInvalidationsServiceImpl(
gcm::GCMDriver* gcm_driver, gcm::GCMDriver* gcm_driver,
instance_id::InstanceIDDriver* instance_id_driver, instance_id::InstanceIDDriver* instance_id_driver);
const std::string& sender_id,
const std::string& app_id);
~SyncInvalidationsServiceImpl() override; ~SyncInvalidationsServiceImpl() override;
// SyncInvalidationsService implementation. // SyncInvalidationsService implementation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment