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