Commit b01edb05 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

[unity] Add unified_consent namespace

This CL adds namespace unified_consent to all c++ files in folder
//components/unified_consent

Bug: NONE
Change-Id: I93dbfe89f97b69e23d4da3cc5f770c03a56b47c0
Reviewed-on: https://chromium-review.googlesource.com/1122861
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarThomas Tangl <tangltom@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572528}
parent afe786b9
......@@ -200,7 +200,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[::prefs::kSearchSuggestEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[::prefs::kUnifiedConsentGiven] =
(*s_whitelist)[::unified_consent::prefs::kUnifiedConsentGiven] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
// Languages page
......
......@@ -10,7 +10,8 @@
class PrefService;
class ChromeUnifiedConsentServiceClient : public UnifiedConsentServiceClient {
class ChromeUnifiedConsentServiceClient
: public unified_consent::UnifiedConsentServiceClient {
public:
explicit ChromeUnifiedConsentServiceClient(PrefService* pref_service);
~ChromeUnifiedConsentServiceClient() override = default;
......
......@@ -27,9 +27,9 @@ UnifiedConsentServiceFactory::UnifiedConsentServiceFactory()
UnifiedConsentServiceFactory::~UnifiedConsentServiceFactory() = default;
// static
UnifiedConsentService* UnifiedConsentServiceFactory::GetForProfile(
Profile* profile) {
return static_cast<UnifiedConsentService*>(
unified_consent::UnifiedConsentService*
UnifiedConsentServiceFactory::GetForProfile(Profile* profile) {
return static_cast<unified_consent::UnifiedConsentService*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
......@@ -40,7 +40,7 @@ UnifiedConsentServiceFactory* UnifiedConsentServiceFactory::GetInstance() {
void UnifiedConsentServiceFactory::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
UnifiedConsentService::RegisterPrefs(registry);
unified_consent::UnifiedConsentService::RegisterPrefs(registry);
}
KeyedService* UnifiedConsentServiceFactory::BuildServiceInstanceFor(
......@@ -50,7 +50,7 @@ KeyedService* UnifiedConsentServiceFactory::BuildServiceInstanceFor(
if (!IsUnifiedConsentEnabled(profile))
return nullptr;
return new UnifiedConsentService(
return new unified_consent::UnifiedConsentService(
new ChromeUnifiedConsentServiceClient(profile->GetPrefs()),
profile->GetPrefs(), IdentityManagerFactory::GetForProfile(profile),
ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(profile));
......
......@@ -10,7 +10,9 @@
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
class Profile;
namespace unified_consent {
class UnifiedConsentService;
}
class UnifiedConsentServiceFactory : public BrowserContextKeyedServiceFactory {
public:
......@@ -18,7 +20,8 @@ class UnifiedConsentServiceFactory : public BrowserContextKeyedServiceFactory {
// (creating one if none exists). Returns nullptr if this profile cannot have
// a UnifiedConsentService (e.g. UnifiedConsent is not enabled for |profile|
// or |profile| is incognito).
static UnifiedConsentService* GetForProfile(Profile* profile);
static unified_consent::UnifiedConsentService* GetForProfile(
Profile* profile);
// Returns an instance of the factory singleton.
static UnifiedConsentServiceFactory* GetInstance();
......
......@@ -4,6 +4,7 @@
#include "components/unified_consent/pref_names.h"
namespace unified_consent {
namespace prefs {
const char kUnifiedConsentGiven[] = "unified_consent_given";
......@@ -12,3 +13,4 @@ const char kUrlKeyedAnonymizedDataCollectionEnabled[] =
"url_keyed_anonymized_data_collection.enabled";
} // namespace prefs
} // namespace unified_consent
......@@ -5,11 +5,13 @@
#ifndef COMPONENTS_UNIFIED_CONSENT_PREF_NAMES_H_
#define COMPONENTS_UNIFIED_CONSENT_PREF_NAMES_H_
namespace unified_consent {
namespace prefs {
extern const char kUnifiedConsentGiven[];
extern const char kUrlKeyedAnonymizedDataCollectionEnabled[];
} // namespace prefs
} // namespace unified_consent
#endif // COMPONENTS_UNIFIED_CONSENT_PREF_NAMES_H_
......@@ -13,6 +13,8 @@
#include "components/unified_consent/pref_names.h"
#include "components/unified_consent/unified_consent_service_client.h"
namespace unified_consent {
UnifiedConsentService::UnifiedConsentService(
UnifiedConsentServiceClient* service_client,
PrefService* pref_service,
......@@ -92,3 +94,5 @@ void UnifiedConsentService::OnUnifiedConsentGivenPrefChanged() {
service_client_->SetSafeBrowsingExtendedReportingEnabled(true);
service_client_->SetNetworkPredictionEnabled(true);
}
} // namespace unified_consent
......@@ -24,6 +24,8 @@ namespace syncer {
class SyncService;
}
namespace unified_consent {
class UnifiedConsentServiceClient;
// A browser-context keyed service that is used to manage the user consent
......@@ -64,4 +66,6 @@ class UnifiedConsentService : public KeyedService,
DISALLOW_COPY_AND_ASSIGN(UnifiedConsentService);
};
} // namespace unified_consent
#endif // COMPONENTS_UNIFIED_CONSENT_UNIFIED_CONSENT_SERVICE_H_
......@@ -5,6 +5,8 @@
#ifndef COMPONENTS_UNIFIED_CONSENT_UNIFIED_CONSENT_SERVICE_CLIENT_H_
#define COMPONENTS_UNIFIED_CONSENT_UNIFIED_CONSENT_SERVICE_CLIENT_H_
namespace unified_consent {
class UnifiedConsentServiceClient {
public:
virtual ~UnifiedConsentServiceClient() {}
......@@ -23,4 +25,6 @@ class UnifiedConsentServiceClient {
virtual void SetNetworkPredictionEnabled(bool enabled) = 0;
};
} // namespace unified_consent
#endif // COMPONENTS_UNIFIED_CONSENT_UNIFIED_CONSENT_SERVICE_CLIENT_H_
......@@ -15,6 +15,7 @@
#include "services/identity/public/cpp/identity_test_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace unified_consent {
namespace {
class TestSyncService : public syncer::FakeSyncService {
......@@ -142,3 +143,4 @@ TEST_F(UnifiedConsentServiceTest, ClearPrimaryAccountDisablesSomeServices) {
#endif // !defined(OS_CHROMEOS)
} // namespace
} // namespace unified_consent
......@@ -12,9 +12,9 @@
#include "components/unified_consent/unified_consent_service.h"
#include "testing/gtest/include/gtest/gtest.h"
using unified_consent::UrlKeyedAnonymizedDataCollectionConsentHelper;
namespace unified_consent {
namespace {
class UrlKeyedDataCollectionConsentHelperTest
: public testing::Test,
public UrlKeyedAnonymizedDataCollectionConsentHelper::Observer {
......@@ -65,3 +65,4 @@ TEST_F(UrlKeyedDataCollectionConsentHelperTest, UnifiedConsentDisabled) {
}
} // namespace
} // namespace unified_consent
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