Commit 053be24d authored by Jeffrey Cohen's avatar Jeffrey Cohen Committed by Commit Bot

[SendTabToSelf] add pref storage of previous device cache_guids

Send Tab To Self shares a url with a specific syncing machine, in order
to determine if the shared tab is meant for the local device, there needs
to be some persistence in storing previously used cache guids locally.

So that a local machine will not "miss" a tab sent to its previous guid.

Bug: 981850
Change-Id: Ibe99baae9d336a4e737935f4e7ce874496e604a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1694147
Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680215}
parent ba8870a3
......@@ -131,6 +131,7 @@
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
#include "components/subresource_filter/content/browser/ruleset_service.h"
#include "components/sync/base/sync_prefs.h"
#include "components/sync_device_info/device_info_prefs.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "components/sync_sessions/session_sync_prefs.h"
#include "components/translate/core/browser/translate_prefs.h"
......@@ -743,6 +744,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
SessionStartupPref::RegisterProfilePrefs(registry);
SharingSyncPreference::RegisterProfilePrefs(registry);
sync_sessions::SessionSyncPrefs::RegisterProfilePrefs(registry);
syncer::DeviceInfoPrefs::RegisterProfilePrefs(registry);
syncer::SyncPrefs::RegisterProfilePrefs(registry);
syncer::PerUserTopicRegistrationManager::RegisterProfilePrefs(registry);
syncer::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry);
......
......@@ -22,6 +22,7 @@
#include "components/send_tab_to_self/features.h"
#include "components/sync/base/sync_prefs.h"
#include "components/sync/model/model_type_store_service.h"
#include "components/sync_device_info/device_info_prefs.h"
#include "components/sync_device_info/device_info_sync_service_impl.h"
#include "components/sync_device_info/local_device_info_provider_impl.h"
......@@ -101,7 +102,11 @@ KeyedService* DeviceInfoSyncServiceFactory::BuildServiceInstanceFor(
chrome::GetChannel(), chrome::GetVersionString(),
signin_scoped_device_id_callback,
send_tab_to_self_receiving_enabled_callback);
auto device_prefs =
std::make_unique<syncer::DeviceInfoPrefs>(profile->GetPrefs());
return new syncer::DeviceInfoSyncServiceImpl(
ModelTypeStoreServiceFactory::GetForProfile(profile)->GetStoreFactory(),
std::move(local_device_info_provider));
std::move(local_device_info_provider), std::move(device_prefs));
}
......@@ -553,16 +553,17 @@ void SendTabToSelfBridge::NotifyRemoteSendTabToSelfEntryAdded(
if (base::FeatureList::IsEnabled(kSendTabToSelfBroadcast)) {
new_local_entries = new_entries;
} else {
// Only pass along entries that are targeted at this device, and not
// dismissed or opened.
// Only pass along entries that are not dismissed or opened, and are
// targeted at this device, which is determined by comparing the cache guid
// associated with the entry to each device's local list of recently used
// cache_guids
DCHECK(!change_processor()->TrackedCacheGuid().empty());
for (const SendTabToSelfEntry* entry : new_entries) {
if (entry->GetTargetDeviceSyncCacheGuid() ==
change_processor()->TrackedCacheGuid() &&
if (device_info_tracker_->IsRecentLocalCacheGuid(
entry->GetTargetDeviceSyncCacheGuid()) &&
!entry->GetNotificationDismissed() && !entry->IsOpened()) {
new_local_entries.push_back(entry);
LogLocalDeviceNotified(UMANotifyLocalDevice::LOCAL);
} else {
LogLocalDeviceNotified(UMANotifyLocalDevice::REMOTE);
}
......
......@@ -94,6 +94,12 @@ class SendTabToSelfBridgeTest : public testing::Test {
: store_(syncer::ModelTypeStoreTestUtil::CreateInMemoryStoreForTest()) {
scoped_feature_list_.InitAndEnableFeature(kSendTabToSelfShowSendingUI);
SetLocalDeviceCacheGuid(kLocalDeviceCacheGuid);
local_device_ = std::make_unique<syncer::DeviceInfo>(
kLocalDeviceCacheGuid, "device", "72", "agent",
sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "scoped_is",
clock()->Now() - base::TimeDelta::FromDays(1),
/*send_tab_to_self_receiving_enabled=*/true);
AddTestDevice(local_device_.get());
}
// Initialized the bridge based on the current local device and store. Can
......@@ -203,6 +209,8 @@ class SendTabToSelfBridgeTest : public testing::Test {
base::test::ScopedFeatureList scoped_feature_list_;
std::unique_ptr<syncer::DeviceInfo> local_device_;
DISALLOW_COPY_AND_ASSIGN(SendTabToSelfBridgeTest);
};
......@@ -253,6 +261,7 @@ TEST_F(SendTabToSelfBridgeTest, ApplySyncChangesAddTwoSpecifics) {
TEST_F(SendTabToSelfBridgeTest, ApplySyncChangesOneAdd) {
InitializeBridge();
SendTabToSelfEntry entry("guid1", GURL("http://www.example.com/"), "title",
AdvanceAndGetTime(), AdvanceAndGetTime(), "device",
kLocalDeviceCacheGuid);
......@@ -273,6 +282,7 @@ TEST_F(SendTabToSelfBridgeTest, ApplySyncChangesOneAdd) {
// Tests that the send tab to self entry is correctly removed.
TEST_F(SendTabToSelfBridgeTest, ApplySyncChangesOneDeletion) {
InitializeBridge();
SendTabToSelfEntry entry("guid1", GURL("http://www.example.com/"), "title",
AdvanceAndGetTime(), AdvanceAndGetTime(), "device",
kLocalDeviceCacheGuid);
......@@ -565,17 +575,17 @@ TEST_F(SendTabToSelfBridgeTest,
/*enabled_features=*/{kSendTabToSelfShowSendingUI},
/*disabled_features=*/{kSendTabToSelfBroadcast});
const std::string kRemoteGuid = "RemoteDevice";
InitializeBridge();
SetLocalDeviceCacheGuid("Device1");
// Add on entry targeting this device and another targeting another device.
syncer::EntityChangeList remote_input;
SendTabToSelfEntry entry1("guid1", GURL("http://www.example.com/"), "title",
AdvanceAndGetTime(), AdvanceAndGetTime(), "device",
"Device1");
kLocalDeviceCacheGuid);
SendTabToSelfEntry entry2("guid2", GURL("http://www.example.com/"), "title",
AdvanceAndGetTime(), AdvanceAndGetTime(), "device",
"Device2");
kRemoteGuid);
remote_input.push_back(
syncer::EntityChange::CreateAdd("guid1", MakeEntityData(entry1)));
remote_input.push_back(
......
......@@ -12,6 +12,8 @@ jumbo_static_library("sync_device_info") {
"device_count_metrics_provider.h",
"device_info.cc",
"device_info.h",
"device_info_prefs.cc",
"device_info_prefs.h",
"device_info_sync_bridge.cc",
"device_info_sync_bridge.h",
"device_info_sync_service.cc",
......@@ -43,6 +45,7 @@ jumbo_static_library("sync_device_info") {
deps = [
"//components/keyed_service/core",
"//components/metrics",
"//components/prefs",
"//components/version_info",
"//ui/base",
]
......@@ -91,6 +94,7 @@ source_set("unit_tests") {
":test_support",
"//base",
"//base/test:test_support",
"//components/prefs:test_support",
"//components/sync:test_support",
"//components/version_info:version_string",
"//testing/gmock",
......
......@@ -2,6 +2,7 @@ include_rules = [
"+chromeos",
"+components/keyed_service",
"+components/metrics",
"+components/prefs",
"+components/sync/base",
"+components/sync/driver",
"+components/sync/model",
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/sync_device_info/device_info_prefs.h"
#include <algorithm>
#include <vector>
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
namespace syncer {
namespace {
// The GUID device info will use to to remember the most recently used past
// cache GUIDs in order starting with the current cache GUID.
const char kDeviceInfoRecentGUIDs[] = "sync.local_device_guids";
// The max number of local device most recent cached GUIDSs that will be stored.
const int kMaxLocalCacheGuidsStored = 30;
} // namespace
// static
void DeviceInfoPrefs::RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterListPref(kDeviceInfoRecentGUIDs);
}
DeviceInfoPrefs::DeviceInfoPrefs(PrefService* pref_service)
: pref_service_(pref_service) {
DCHECK(pref_service);
}
DeviceInfoPrefs::~DeviceInfoPrefs() {}
bool DeviceInfoPrefs::IsRecentLocalCacheGuid(
const std::string& cache_guid) const {
const base::Value::ListStorage& recent_local_cache_guids =
pref_service_->GetList(kDeviceInfoRecentGUIDs)->GetList();
return std::find(recent_local_cache_guids.begin(),
recent_local_cache_guids.end(),
base::Value(cache_guid)) != recent_local_cache_guids.end();
}
void DeviceInfoPrefs::AddLocalCacheGuid(const std::string& cache_guid) {
ListPrefUpdate update(pref_service_, kDeviceInfoRecentGUIDs);
base::ListValue* pref_data = update.Get();
base::Value::ListStorage* recent_local_cache_guids = &pref_data->GetList();
if (std::find(recent_local_cache_guids->begin(),
recent_local_cache_guids->end(),
base::Value(cache_guid)) != recent_local_cache_guids->end()) {
// Local cache GUID already known.
return;
}
recent_local_cache_guids->emplace(recent_local_cache_guids->begin(),
base::Value(cache_guid));
if (recent_local_cache_guids->size() > kMaxLocalCacheGuidsStored) {
recent_local_cache_guids->pop_back();
}
}
} // namespace syncer
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_PREFS_H_
#define COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_PREFS_H_
#include <string>
#include <vector>
#include "base/macros.h"
class PrefService;
class PrefRegistrySimple;
namespace syncer {
// Use this for determining if a cache guid was recently used by this device.
class DeviceInfoPrefs {
public:
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
explicit DeviceInfoPrefs(PrefService* pref_service);
~DeviceInfoPrefs();
bool IsRecentLocalCacheGuid(const std::string& cache_guid) const;
void AddLocalCacheGuid(const std::string& cache_guid);
private:
PrefService* const pref_service_;
DISALLOW_COPY_AND_ASSIGN(DeviceInfoPrefs);
};
} // namespace syncer
#endif // COMPONENTS_SYNC_DEVICE_INFO_DEVICE_INFO_PREFS_H_
......@@ -22,6 +22,7 @@
#include "components/sync/model/mutable_data_batch.h"
#include "components/sync/protocol/model_type_state.pb.h"
#include "components/sync/protocol/sync.pb.h"
#include "components/sync_device_info/device_info_prefs.h"
#include "components/sync_device_info/device_info_util.h"
#include "components/sync_device_info/local_device_info_util.h"
......@@ -127,10 +128,13 @@ base::Optional<ModelError> ParseSpecificsOnBackendSequence(
DeviceInfoSyncBridge::DeviceInfoSyncBridge(
std::unique_ptr<MutableLocalDeviceInfoProvider> local_device_info_provider,
OnceModelTypeStoreFactory store_factory,
std::unique_ptr<ModelTypeChangeProcessor> change_processor)
std::unique_ptr<ModelTypeChangeProcessor> change_processor,
std::unique_ptr<DeviceInfoPrefs> device_info_prefs)
: ModelTypeSyncBridge(std::move(change_processor)),
local_device_info_provider_(std::move(local_device_info_provider)) {
local_device_info_provider_(std::move(local_device_info_provider)),
device_info_prefs_(std::move(device_info_prefs)) {
DCHECK(local_device_info_provider_);
DCHECK(device_info_prefs_);
// Provider must not be initialized, the bridge takes care.
DCHECK(!local_device_info_provider_->GetLocalDeviceInfo());
......@@ -150,6 +154,8 @@ void DeviceInfoSyncBridge::OnSyncStarting(
const DataTypeActivationRequest& request) {
// Store the cache GUID, mainly in case MergeSyncData() is executed later.
local_cache_guid_ = request.cache_guid;
// Add the cache guid to the local prefs.
device_info_prefs_->AddLocalCacheGuid(local_cache_guid_);
}
std::unique_ptr<MetadataChangeList>
......@@ -174,8 +180,8 @@ base::Optional<ModelError> DeviceInfoSyncBridge::MergeSyncData(
DCHECK_EQ(change->storage_key(), specifics.cache_guid());
// Each device is the authoritative source for itself, ignore any remote
// changes that have our local cache guid.
if (change->storage_key() == local_cache_guid_) {
// changes that have a cache guid that is or was this local device.
if (device_info_prefs_->IsRecentLocalCacheGuid(change->storage_key())) {
continue;
}
......@@ -197,8 +203,8 @@ base::Optional<ModelError> DeviceInfoSyncBridge::ApplySyncChanges(
for (const std::unique_ptr<EntityChange>& change : entity_changes) {
const std::string guid = change->storage_key();
// Each device is the authoritative source for itself, ignore any remote
// changes that have our local cache guid.
if (guid == local_cache_guid_) {
// changes that have a cache guid that is or was this local device.
if (device_info_prefs_->IsRecentLocalCacheGuid(guid)) {
continue;
}
......@@ -305,6 +311,11 @@ int DeviceInfoSyncBridge::CountActiveDevices() const {
return CountActiveDevices(Time::Now());
}
bool DeviceInfoSyncBridge::IsRecentLocalCacheGuid(
const std::string& cache_guid) const {
return device_info_prefs_->IsRecentLocalCacheGuid(cache_guid);
}
bool DeviceInfoSyncBridge::IsPulseTimerRunningForTest() const {
return pulse_timer_.IsRunning();
}
......@@ -429,6 +440,10 @@ void DeviceInfoSyncBridge::OnReadAllMetadata(
local_cache_guid_ = local_cache_guid_in_metadata;
local_device_info_provider_->Initialize(local_cache_guid_,
local_session_name_);
// This probably isn't strictly needed, but in case the cache_guid has changed
// we save the new one to prefs.
device_info_prefs_->AddLocalCacheGuid(local_cache_guid_);
ReconcileLocalAndStored();
}
......
......@@ -28,6 +28,8 @@ class DeviceInfoSpecifics;
namespace syncer {
class DeviceInfoPrefs;
// Sync bridge implementation for DEVICE_INFO model type. Handles storage of
// device info and associated sync metadata, applying/merging foreign changes,
// and allows public read access.
......@@ -38,7 +40,8 @@ class DeviceInfoSyncBridge : public ModelTypeSyncBridge,
std::unique_ptr<MutableLocalDeviceInfoProvider>
local_device_info_provider,
OnceModelTypeStoreFactory store_factory,
std::unique_ptr<ModelTypeChangeProcessor> change_processor);
std::unique_ptr<ModelTypeChangeProcessor> change_processor,
std::unique_ptr<DeviceInfoPrefs> device_info_prefs);
~DeviceInfoSyncBridge() override;
LocalDeviceInfoProvider* GetLocalDeviceInfoProvider();
......@@ -67,6 +70,7 @@ class DeviceInfoSyncBridge : public ModelTypeSyncBridge,
void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override;
int CountActiveDevices() const override;
bool IsRecentLocalCacheGuid(const std::string& cache_guid) const override;
// For testing only.
bool IsPulseTimerRunningForTest() const;
......@@ -139,6 +143,8 @@ class DeviceInfoSyncBridge : public ModelTypeSyncBridge,
// Used to update our local device info once every pulse interval.
base::OneShotTimer pulse_timer_;
const std::unique_ptr<DeviceInfoPrefs> device_info_prefs_;
base::WeakPtrFactory<DeviceInfoSyncBridge> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DeviceInfoSyncBridge);
......
......@@ -12,6 +12,7 @@
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_task_environment.h"
#include "components/prefs/testing_pref_service.h"
#include "components/sync/base/time.h"
#include "components/sync/model/data_batch.h"
#include "components/sync/model/data_type_activation_request.h"
......@@ -22,6 +23,7 @@
#include "components/sync/model/model_type_store_test_util.h"
#include "components/sync/protocol/model_type_state.pb.h"
#include "components/sync/test/test_matchers.h"
#include "components/sync_device_info/device_info_prefs.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
......@@ -220,6 +222,7 @@ class DeviceInfoSyncBridgeTest : public testing::Test,
protected:
DeviceInfoSyncBridgeTest()
: store_(ModelTypeStoreTestUtil::CreateInMemoryStoreForTest()) {
DeviceInfoPrefs::RegisterProfilePrefs(pref_service_.registry());
ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true));
}
......@@ -239,7 +242,8 @@ class DeviceInfoSyncBridgeTest : public testing::Test,
bridge_ = std::make_unique<DeviceInfoSyncBridge>(
std::make_unique<TestLocalDeviceInfoProvider>(),
ModelTypeStoreTestUtil::FactoryForForwardingStore(store_.get()),
mock_processor_.CreateForwardingProcessor());
mock_processor_.CreateForwardingProcessor(),
std::make_unique<DeviceInfoPrefs>(&pref_service_));
bridge_->AddObserver(this);
}
......@@ -402,6 +406,7 @@ class DeviceInfoSyncBridgeTest : public testing::Test,
// Holds the store.
const std::unique_ptr<ModelTypeStore> store_;
TestingPrefServiceSimple pref_service_;
// Not initialized immediately (upon test's constructor). This allows each
// test case to modify the dependencies the bridge will be constructed with.
std::unique_ptr<DeviceInfoSyncBridge> bridge_;
......
......@@ -10,6 +10,7 @@
#include "components/sync/base/report_unrecoverable_error.h"
#include "components/sync/model_impl/client_tag_based_model_type_processor.h"
#include "components/sync_device_info/device_info.h"
#include "components/sync_device_info/device_info_prefs.h"
#include "components/sync_device_info/device_info_sync_bridge.h"
#include "components/sync_device_info/device_info_tracker.h"
#include "components/sync_device_info/local_device_info_provider.h"
......@@ -18,9 +19,10 @@ namespace syncer {
DeviceInfoSyncServiceImpl::DeviceInfoSyncServiceImpl(
OnceModelTypeStoreFactory model_type_store_factory,
std::unique_ptr<MutableLocalDeviceInfoProvider>
local_device_info_provider) {
std::unique_ptr<MutableLocalDeviceInfoProvider> local_device_info_provider,
std::unique_ptr<DeviceInfoPrefs> device_info_prefs) {
DCHECK(local_device_info_provider);
DCHECK(device_info_prefs);
// Make a copy of the channel to avoid relying on argument evaluation order.
const version_info::Channel channel =
......@@ -32,7 +34,8 @@ DeviceInfoSyncServiceImpl::DeviceInfoSyncServiceImpl(
std::make_unique<ClientTagBasedModelTypeProcessor>(
DEVICE_INFO,
/*dump_stack=*/base::BindRepeating(&ReportUnrecoverableError,
channel)));
channel)),
std::move(device_info_prefs));
}
DeviceInfoSyncServiceImpl::~DeviceInfoSyncServiceImpl() {}
......
......@@ -13,15 +13,18 @@
namespace syncer {
class DeviceInfoPrefs;
class DeviceInfoSyncBridge;
class MutableLocalDeviceInfoProvider;
class DeviceInfoSyncServiceImpl : public DeviceInfoSyncService {
public:
// |local_device_info_provider| must not be null.
// |device_info_prefs| must not be null.
DeviceInfoSyncServiceImpl(OnceModelTypeStoreFactory model_type_store_factory,
std::unique_ptr<MutableLocalDeviceInfoProvider>
local_device_info_provider);
local_device_info_provider,
std::unique_ptr<DeviceInfoPrefs> device_info_prefs);
~DeviceInfoSyncServiceImpl() override;
// DeviceInfoSyncService implementation.
......
......@@ -44,6 +44,9 @@ class DeviceInfoTracker {
// A temporary function to to allow tests to ensure active devices.
// TODO(crbug/948784) remove this function after architecture work.
virtual void ForcePulseForTest() = 0;
// Returns if the provided |cache_guid| is the current device cache_guid for
// the current device or was of the recently used.
virtual bool IsRecentLocalCacheGuid(const std::string& cache_guid) const = 0;
};
} // namespace syncer
......
......@@ -64,6 +64,16 @@ void FakeDeviceInfoTracker::ForcePulseForTest() {
NOTREACHED();
}
bool FakeDeviceInfoTracker::IsRecentLocalCacheGuid(
const std::string& cache_guid) const {
for (const DeviceInfo* device : devices_) {
if (device->guid() == cache_guid) {
return true;
}
}
return false;
}
void FakeDeviceInfoTracker::Add(const DeviceInfo* device) {
devices_.push_back(device);
}
......
......@@ -32,6 +32,7 @@ class FakeDeviceInfoTracker : public DeviceInfoTracker {
void RemoveObserver(Observer* observer) override;
int CountActiveDevices() const override;
void ForcePulseForTest() override;
bool IsRecentLocalCacheGuid(const std::string& cache_guid) const override;
// Adds a new DeviceInfo entry to |devices_|.
void Add(const DeviceInfo* device);
......
......@@ -39,6 +39,7 @@
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/strings/grit/components_locale_settings.h"
#include "components/sync/base/sync_prefs.h"
#include "components/sync_device_info/device_info_prefs.h"
#include "components/sync_sessions/session_sync_prefs.h"
#include "components/translate/core/browser/translate_pref_names.h"
#include "components/translate/core/browser/translate_prefs.h"
......@@ -131,6 +132,7 @@ void RegisterBrowserStatePrefs(user_prefs::PrefRegistrySyncable* registry) {
PrefProxyConfigTrackerImpl::RegisterProfilePrefs(registry);
RegisterVoiceSearchBrowserStatePrefs(registry);
sync_sessions::SessionSyncPrefs::RegisterProfilePrefs(registry);
syncer::DeviceInfoPrefs::RegisterProfilePrefs(registry);
syncer::SyncPrefs::RegisterProfilePrefs(registry);
syncer::PerUserTopicRegistrationManager::RegisterProfilePrefs(registry);
syncer::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry);
......
......@@ -13,6 +13,7 @@
#include "components/send_tab_to_self/features.h"
#include "components/signin/public/base/device_id_helper.h"
#include "components/sync/model/model_type_store_service.h"
#include "components/sync_device_info/device_info_prefs.h"
#include "components/sync_device_info/device_info_sync_service_impl.h"
#include "components/sync_device_info/local_device_info_provider_impl.h"
#include "ios/chrome/browser/application_context.h"
......@@ -83,9 +84,11 @@ DeviceInfoSyncServiceFactory::BuildServiceInstanceFor(
base::BindRepeating(
&send_tab_to_self::IsReceivingEnabledByUserOnThisDevice,
browser_state->GetPrefs()));
auto device_prefs =
std::make_unique<syncer::DeviceInfoPrefs>(browser_state->GetPrefs());
return std::make_unique<syncer::DeviceInfoSyncServiceImpl>(
ModelTypeStoreServiceFactory::GetForBrowserState(browser_state)
->GetStoreFactory(),
std::move(local_device_info_provider));
std::move(local_device_info_provider), std::move(device_prefs));
}
......@@ -11,6 +11,7 @@
#include "components/keyed_service/ios/browser_state_dependency_manager.h"
#include "components/signin/public/base/device_id_helper.h"
#include "components/sync/model/model_type_store_service.h"
#include "components/sync_device_info/device_info_prefs.h"
#include "components/sync_device_info/device_info_sync_service_impl.h"
#include "components/sync_device_info/local_device_info_provider_impl.h"
#include "components/version_info/version_info.h"
......@@ -60,10 +61,13 @@ WebViewDeviceInfoSyncServiceFactory::BuildServiceInstanceFor(
/*send_tab_to_self_receiving_enabled_callback=*/
base::BindRepeating([]() { return false; }));
auto device_prefs =
std::make_unique<syncer::DeviceInfoPrefs>(browser_state->GetPrefs());
return std::make_unique<syncer::DeviceInfoSyncServiceImpl>(
WebViewModelTypeStoreServiceFactory::GetForBrowserState(browser_state)
->GetStoreFactory(),
std::move(local_device_info_provider));
std::move(local_device_info_provider), std::move(device_prefs));
}
} // namespace ios_web_view
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