Skip to content

Commit

Permalink
Hide Profile::GetUserCloudPolicyManager() in Chrome OS.
Browse files Browse the repository at this point in the history
This always returns null in Chrome OS and should not be used. The API
that should be used instead is currently
UserPolicyManagerFactoryChromeOS::GetCloudPolicyManager() and will be
soon changed to a Profile method like in other platforms.

Bug: 937770
Change-Id: I1e5befd2d2a23a076c7182511c86b4b8a8c04aaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1588479
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#655359}
  • Loading branch information
Henrique Nakashima authored and Commit Bot committed Apr 30, 2019
1 parent 334e5dd commit 2baf2a1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chrome/browser/profiles/off_the_record_profile_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,12 @@ OffTheRecordProfileImpl::GetPolicySchemaRegistryService() {
return nullptr;
}

#if !defined(OS_CHROMEOS)
policy::UserCloudPolicyManager*
OffTheRecordProfileImpl::GetUserCloudPolicyManager() {
return GetOriginalProfile()->GetUserCloudPolicyManager();
}
#endif

net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() {
return GetDefaultStoragePartition(this)->GetURLRequestContext();
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/profiles/off_the_record_profile_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class OffTheRecordProfileImpl : public Profile {
const PrefService* GetPrefs() const override;
PrefService* GetOffTheRecordPrefs() override;
policy::SchemaRegistryService* GetPolicySchemaRegistryService() override;
#if !defined(OS_CHROMEOS)
policy::UserCloudPolicyManager* GetUserCloudPolicyManager() override;
#endif
net::URLRequestContextGetter* GetRequestContext() override;
base::OnceCallback<net::CookieStore*()> GetExtensionsCookieStoreGetter()
override;
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/profiles/profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,12 @@ class Profile : public content::BrowserContext {
// Returns the SchemaRegistryService.
virtual policy::SchemaRegistryService* GetPolicySchemaRegistryService() = 0;

// In Chrome OS, use UserPolicyManagerFactoryChromeOS::GetCloudPolicyManager()
// instead.
#if !defined(OS_CHROMEOS)
// Returns the UserCloudPolicyManager.
virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() = 0;
#endif

virtual policy::ProfilePolicyConnector* GetProfilePolicyConnector() = 0;
virtual const policy::ProfilePolicyConnector* GetProfilePolicyConnector()
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/profiles/profile_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1118,9 +1118,11 @@ policy::SchemaRegistryService* ProfileImpl::GetPolicySchemaRegistryService() {
return schema_registry_service_.get();
}

#if !defined(OS_CHROMEOS)
policy::UserCloudPolicyManager* ProfileImpl::GetUserCloudPolicyManager() {
return user_cloud_policy_manager_;
}
#endif

policy::ProfilePolicyConnector* ProfileImpl::GetProfilePolicyConnector() {
return profile_policy_connector_.get();
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/profiles/profile_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ class ProfileImpl : public Profile {
PrefService* GetOffTheRecordPrefs() override;
PrefService* GetReadOnlyOffTheRecordPrefs() override;
policy::SchemaRegistryService* GetPolicySchemaRegistryService() override;
#if !defined(OS_CHROMEOS)
policy::UserCloudPolicyManager* GetUserCloudPolicyManager() override;
#endif
policy::ProfilePolicyConnector* GetProfilePolicyConnector() override;
const policy::ProfilePolicyConnector* GetProfilePolicyConnector()
const override;
Expand Down
2 changes: 2 additions & 0 deletions chrome/test/base/testing_profile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -933,9 +933,11 @@ TestingProfile::GetPolicySchemaRegistryService() {
return schema_registry_service_.get();
}

#if !defined(OS_CHROMEOS)
policy::UserCloudPolicyManager* TestingProfile::GetUserCloudPolicyManager() {
return user_cloud_policy_manager_.get();
}
#endif

policy::ProfilePolicyConnector* TestingProfile::GetProfilePolicyConnector() {
return profile_policy_connector_.get();
Expand Down
2 changes: 2 additions & 0 deletions chrome/test/base/testing_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ class TestingProfile : public Profile {
base::Time GetStartTime() const override;
ProfileKey* GetProfileKey() const override;
policy::SchemaRegistryService* GetPolicySchemaRegistryService() override;
#if !defined(OS_CHROMEOS)
policy::UserCloudPolicyManager* GetUserCloudPolicyManager() override;
#endif
policy::ProfilePolicyConnector* GetProfilePolicyConnector() override;
const policy::ProfilePolicyConnector* GetProfilePolicyConnector()
const override;
Expand Down

0 comments on commit 2baf2a1

Please sign in to comment.