Commit a499a384 authored by Glen Robertson's avatar Glen Robertson Committed by Commit Bot

Expose device_sync RegisterProfilePrefs separately from impl.

This allows us to stop depending on the impl in browser_prefs.cc.
Fixes `gn check` errors. Split out from crrev.com/c/2383400

Bug: 898837
Change-Id: I777200b6a49710e1496fb3189f8bbed80fb3cbb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2386437
Auto-Submit: Glen Robertson <glenrob@chromium.org>
Commit-Queue: Ryan Hansberry <hansberry@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Reviewed-by: default avatarRyan Hansberry <hansberry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803925}
parent 6e0046d0
......@@ -4065,6 +4065,7 @@ static_library("browser") {
"//chromeos/memory/userspace_swap:mojom",
"//chromeos/services/assistant/public/cpp",
"//chromeos/services/cellular_setup",
"//chromeos/services/device_sync/public/cpp:prefs",
"//chromeos/services/device_sync/public/mojom",
"//chromeos/services/multidevice_setup",
"//chromeos/services/multidevice_setup/public/cpp:first_run_field_trial",
......
......@@ -351,7 +351,7 @@
#include "chromeos/network/network_metadata_store.h"
#include "chromeos/network/proxy/proxy_config_handler.h"
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
#include "chromeos/services/device_sync/device_sync_impl.h"
#include "chromeos/services/device_sync/public/cpp/device_sync_prefs.h"
#include "chromeos/services/multidevice_setup/multidevice_setup_service.h"
#include "chromeos/timezone/timezone_resolver.h"
#include "components/arc/arc_prefs.h"
......@@ -1060,7 +1060,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
chromeos::bluetooth::DebugLogsManager::RegisterPrefs(registry);
chromeos::ClientAppMetadataProviderService::RegisterProfilePrefs(registry);
chromeos::CupsPrintersManager::RegisterProfilePrefs(registry);
chromeos::device_sync::DeviceSyncImpl::RegisterProfilePrefs(registry);
chromeos::device_sync::RegisterProfilePrefs(registry);
chromeos::FamilyUserMetricsService::RegisterProfilePrefs(registry);
chromeos::FamilyUserSessionMetrics::RegisterProfilePrefs(registry);
chromeos::first_run::RegisterProfilePrefs(registry);
......
......@@ -173,6 +173,7 @@ static_library("device_sync") {
visibility = [
":*",
"//chrome/browser/chromeos",
"//chromeos/services/device_sync/public/cpp:prefs",
"//chrome/test:test_support_ui",
"//chromeos/services/device_sync/public/cpp:unit_tests",
]
......@@ -300,6 +301,7 @@ source_set("unit_tests") {
"//chromeos/network:test_support",
"//chromeos/services/device_sync/proto:test_support",
"//chromeos/services/device_sync/proto:util",
"//chromeos/services/device_sync/public/cpp:prefs",
"//chromeos/services/device_sync/public/cpp:test_support",
"//chromeos/services/device_sync/public/cpp:unit_tests",
"//chromeos/services/device_sync/public/mojom",
......
......@@ -323,26 +323,6 @@ void DeviceSyncImpl::PendingSetSoftwareFeatureRequest::InvokeCallback(
std::move(callback_).Run(result);
}
// static
void DeviceSyncImpl::RegisterProfilePrefs(PrefRegistrySimple* registry) {
CryptAuthGCMManager::RegisterPrefs(registry);
CryptAuthDeviceManager::RegisterPrefs(registry);
if (base::FeatureList::IsEnabled(
chromeos::features::kCryptAuthV2Enrollment)) {
CryptAuthV2EnrollmentManagerImpl::RegisterPrefs(registry);
CryptAuthKeyRegistryImpl::RegisterPrefs(registry);
CryptAuthSchedulerImpl::RegisterPrefs(registry);
} else {
CryptAuthEnrollmentManagerImpl::RegisterPrefs(registry);
}
if (features::ShouldUseV2DeviceSync()) {
CryptAuthDeviceRegistryImpl::RegisterPrefs(registry);
CryptAuthMetadataSyncerImpl::RegisterPrefs(registry);
SyncedBluetoothAddressTrackerImpl::RegisterPrefs(registry);
}
}
DeviceSyncImpl::PendingSetFeatureStatusRequest::PendingSetFeatureStatusRequest(
const std::string& device_instance_id,
multidevice::SoftwareFeature software_feature,
......
......@@ -26,7 +26,6 @@
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
class PrefRegistrySimple;
class PrefService;
namespace base {
......@@ -102,8 +101,6 @@ class DeviceSyncImpl : public DeviceSyncBase,
static Factory* test_factory_instance_;
};
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
~DeviceSyncImpl() override;
protected:
......
......@@ -46,6 +46,7 @@
#include "chromeos/services/device_sync/proto/cryptauth_client_app_metadata.pb.h"
#include "chromeos/services/device_sync/proto/cryptauth_common.pb.h"
#include "chromeos/services/device_sync/proto/cryptauth_v2_test_util.h"
#include "chromeos/services/device_sync/public/cpp/device_sync_prefs.h"
#include "chromeos/services/device_sync/public/cpp/fake_client_app_metadata_provider.h"
#include "chromeos/services/device_sync/public/cpp/fake_gcm_device_info_provider.h"
#include "chromeos/services/device_sync/public/mojom/device_sync.mojom.h"
......@@ -747,7 +748,7 @@ class DeviceSyncServiceTest
fake_gcm_driver_ = std::make_unique<gcm::FakeGCMDriver>();
test_pref_service_ = std::make_unique<TestingPrefServiceSimple>();
DeviceSyncImpl::RegisterProfilePrefs(test_pref_service_->registry());
RegisterProfilePrefs(test_pref_service_->registry());
simple_test_clock_ = std::make_unique<base::SimpleTestClock>();
......
......@@ -27,6 +27,27 @@ source_set("cpp") {
deps = [ "//mojo/public/cpp/bindings" ]
}
source_set("prefs") {
sources = [
"device_sync_prefs.cc",
"device_sync_prefs.h",
]
public_deps = [
"//base",
"//chromeos/components/multidevice",
"//chromeos/components/multidevice/logging",
"//chromeos/constants",
"//chromeos/services/device_sync:feature_status_change",
"//chromeos/services/device_sync/public/mojom",
]
deps = [
"//chromeos/services/device_sync",
"//components/prefs",
]
}
static_library("test_support") {
testonly = true
......@@ -51,6 +72,7 @@ source_set("unit_tests") {
deps = [
":cpp",
":prefs",
":test_support",
"//base",
"//base/test:test_support",
......
......@@ -25,6 +25,7 @@
#include "chromeos/services/device_sync/fake_device_sync.h"
#include "chromeos/services/device_sync/feature_status_change.h"
#include "chromeos/services/device_sync/proto/cryptauth_common.pb.h"
#include "chromeos/services/device_sync/public/cpp/device_sync_prefs.h"
#include "chromeos/services/device_sync/public/cpp/fake_client_app_metadata_provider.h"
#include "chromeos/services/device_sync/public/cpp/fake_gcm_device_info_provider.h"
#include "chromeos/services/device_sync/public/mojom/device_sync.mojom.h"
......@@ -176,7 +177,7 @@ class DeviceSyncClientImplTest : public testing::Test {
}));
test_pref_service_ = std::make_unique<TestingPrefServiceSimple>();
DeviceSyncImpl::RegisterProfilePrefs(test_pref_service_->registry());
RegisterProfilePrefs(test_pref_service_->registry());
device_sync_ = DeviceSyncImpl::Factory::Create(
identity_test_environment_->identity_manager(), fake_gcm_driver_.get(),
......
// Copyright 2020 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 "chromeos/services/device_sync/public/cpp/device_sync_prefs.h"
#include "base/feature_list.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/device_sync/cryptauth_device_manager.h"
#include "chromeos/services/device_sync/cryptauth_device_registry_impl.h"
#include "chromeos/services/device_sync/cryptauth_enrollment_manager_impl.h"
#include "chromeos/services/device_sync/cryptauth_gcm_manager.h"
#include "chromeos/services/device_sync/cryptauth_key_registry_impl.h"
#include "chromeos/services/device_sync/cryptauth_metadata_syncer_impl.h"
#include "chromeos/services/device_sync/cryptauth_scheduler_impl.h"
#include "chromeos/services/device_sync/cryptauth_v2_enrollment_manager_impl.h"
#include "chromeos/services/device_sync/synced_bluetooth_address_tracker_impl.h"
#include "components/prefs/pref_registry_simple.h"
namespace chromeos {
namespace device_sync {
void RegisterProfilePrefs(PrefRegistrySimple* registry) {
CryptAuthGCMManager::RegisterPrefs(registry);
CryptAuthDeviceManager::RegisterPrefs(registry);
if (base::FeatureList::IsEnabled(
chromeos::features::kCryptAuthV2Enrollment)) {
CryptAuthV2EnrollmentManagerImpl::RegisterPrefs(registry);
CryptAuthKeyRegistryImpl::RegisterPrefs(registry);
CryptAuthSchedulerImpl::RegisterPrefs(registry);
} else {
CryptAuthEnrollmentManagerImpl::RegisterPrefs(registry);
}
if (features::ShouldUseV2DeviceSync()) {
CryptAuthDeviceRegistryImpl::RegisterPrefs(registry);
CryptAuthMetadataSyncerImpl::RegisterPrefs(registry);
SyncedBluetoothAddressTrackerImpl::RegisterPrefs(registry);
}
}
} // namespace device_sync
} // namespace chromeos
// Copyright 2020 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 CHROMEOS_SERVICES_DEVICE_SYNC_PUBLIC_CPP_DEVICE_SYNC_PREFS_H_
#define CHROMEOS_SERVICES_DEVICE_SYNC_PUBLIC_CPP_DEVICE_SYNC_PREFS_H_
class PrefRegistrySimple;
namespace chromeos {
namespace device_sync {
// Register's Device Sync's profile preferences for browser prefs.
void RegisterProfilePrefs(PrefRegistrySimple* registry);
} // namespace device_sync
} // namespace chromeos
#endif // CHROMEOS_SERVICES_DEVICE_SYNC_PUBLIC_CPP_DEVICE_SYNC_PREFS_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