Commit 5f33818a authored by Paula Vidas's avatar Paula Vidas Committed by Commit Bot

[SyncInvalidations] Introduce UseSyncInvalidationsForWalletAndOffer flag

When SyncSendInterestedDataTypes, UseSyncInvalidations and this flag are
enabled, new invalidations will be used for Wallet and Offer-related types.
Otherwise, those types are excluded from interested data types (even if
they are enabled).

Unsubscribing from old invalidations for these types will be added in a
separate CL.

Bug: 1082115
Change-Id: Ia9dc759580095129ad04d455c8162b2324c81856
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2431426Reviewed-by: default avatarRushan Suleymanov <rushans@google.com>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Paula Vidas <paulavidas@google.com>
Cr-Commit-Position: refs/heads/master@{#811185}
parent 4cb9efe6
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "components/sync/engine/net/http_post_provider_factory.h" #include "components/sync/engine/net/http_post_provider_factory.h"
#include "components/sync/engine/polling_constants.h" #include "components/sync/engine/polling_constants.h"
#include "components/sync/engine/sync_encryption_handler.h" #include "components/sync/engine/sync_encryption_handler.h"
#include "components/sync/invalidations/switches.h"
#include "components/sync/invalidations/sync_invalidations_service.h" #include "components/sync/invalidations/sync_invalidations_service.h"
#include "components/sync/model/sync_error.h" #include "components/sync/model/sync_error.h"
#include "components/version_info/version_info_values.h" #include "components/version_info/version_info_values.h"
...@@ -1463,6 +1464,11 @@ void ProfileSyncService::UpdateDataTypesForInvalidations() { ...@@ -1463,6 +1464,11 @@ void ProfileSyncService::UpdateDataTypesForInvalidations() {
if (!sessions_invalidations_enabled_) { if (!sessions_invalidations_enabled_) {
types.Remove(SESSIONS); types.Remove(SESSIONS);
} }
if (!(base::FeatureList::IsEnabled(switches::kUseSyncInvalidations) &&
base::FeatureList::IsEnabled(
switches::kUseSyncInvalidationsForWalletAndOffer))) {
types.RemoveAll({AUTOFILL_WALLET_DATA, AUTOFILL_WALLET_OFFER});
}
invalidations_service->SetInterestedDataTypes( invalidations_service->SetInterestedDataTypes(
types, base::BindRepeating(&ProfileSyncService::TriggerRefresh, types, base::BindRepeating(&ProfileSyncService::TriggerRefresh,
sync_enabled_weak_factory_.GetWeakPtr())); sync_enabled_weak_factory_.GetWeakPtr()));
......
...@@ -12,4 +12,7 @@ const base::Feature kSyncSendInterestedDataTypes = { ...@@ -12,4 +12,7 @@ const base::Feature kSyncSendInterestedDataTypes = {
const base::Feature kUseSyncInvalidations = {"UseSyncInvalidations", const base::Feature kUseSyncInvalidations = {"UseSyncInvalidations",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kUseSyncInvalidationsForWalletAndOffer = {
"UseSyncInvalidationsForWalletAndOffer", base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace switches } // namespace switches
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
namespace switches { namespace switches {
// If enabled, interested data types will be sent to the Sync Server as part of // If enabled, interested data types, excluding Wallet and Offer, will be sent
// DeviceInfo. // to the Sync Server as part of DeviceInfo.
extern const base::Feature kSyncSendInterestedDataTypes; extern const base::Feature kSyncSendInterestedDataTypes;
// If enabled, the device will register with FCM and listen to new // If enabled, the device will register with FCM and listen to new
...@@ -19,6 +19,12 @@ extern const base::Feature kSyncSendInterestedDataTypes; ...@@ -19,6 +19,12 @@ extern const base::Feature kSyncSendInterestedDataTypes;
// SyncSendInterestedDataTypes must be enabled for this to take effect. // SyncSendInterestedDataTypes must be enabled for this to take effect.
extern const base::Feature kUseSyncInvalidations; extern const base::Feature kUseSyncInvalidations;
// If enabled, types related to Wallet and Offer will be included in interested
// data types, and the device will listen to new invalidations for those types
// (if they are enabled).
// UseSyncInvalidations must be enabled for this to take effect.
extern const base::Feature kUseSyncInvalidationsForWalletAndOffer;
} // namespace switches } // namespace switches
#endif // COMPONENTS_SYNC_INVALIDATIONS_SWITCHES_H_ #endif // COMPONENTS_SYNC_INVALIDATIONS_SWITCHES_H_
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