Chromium Code Reviews| Index: chrome/browser/policy/profile_policy_connector.h |
| diff --git a/chrome/browser/policy/profile_policy_connector.h b/chrome/browser/policy/profile_policy_connector.h |
| index 8ef8f22cd343a4dadfa5e98c7447467a5635f6d4..e2304b4e6f94d88d4c3244eed0c6a860703a8aad 100644 |
| --- a/chrome/browser/policy/profile_policy_connector.h |
| +++ b/chrome/browser/policy/profile_policy_connector.h |
| @@ -9,6 +9,7 @@ |
| #include <string> |
| #include <vector> |
| +#include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| #include "build/build_config.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| @@ -19,24 +20,23 @@ class User; |
| namespace policy { |
| -class CloudPolicyManager; |
| +class CloudPolicyStore; |
| class ConfigurationPolicyProvider; |
| class PolicyService; |
| class SchemaRegistry; |
| -// A KeyedService that creates and manages the per-Profile policy |
| -// components. |
| +// A KeyedService that creates and manages the per-Profile policy components. |
| class ProfilePolicyConnector : public KeyedService { |
| public: |
| ProfilePolicyConnector(); |
| ~ProfilePolicyConnector() override; |
| - void Init( |
| -#if defined(OS_CHROMEOS) |
| - const user_manager::User* user, |
| -#endif |
| - SchemaRegistry* schema_registry, |
| - CloudPolicyManager* user_cloud_policy_manager); |
| + // |user| is only used in Chrome OS builds and should be set to nullptr |
| + // otherwise. |
| + void Init(const user_manager::User* user, |
| + SchemaRegistry* schema_registry, |
| + ConfigurationPolicyProvider* configuration_policy_provider, |
| + const CloudPolicyStore* policy_store); |
|
emaxx
2016/12/28 19:09:20
nit: Document that policy_store may be null? (and
Thiemo Nagel
2016/12/29 15:08:27
Done.
|
| void InitForTesting(std::unique_ptr<PolicyService> service); |
| void OverrideIsManagedForTesting(bool is_managed); |
| @@ -47,20 +47,31 @@ class ProfilePolicyConnector : public KeyedService { |
| // This is never NULL. |
| PolicyService* policy_service() const { return policy_service_.get(); } |
| - // Returns true if this Profile is under cloud policy management. You must |
| - // call this method only when the policies system is fully initialized. |
| + // Returns true if this Profile is under any kind of policy management. You |
| + // must call this method only when the policies system is fully initialized. |
| bool IsManaged() const; |
| - // Returns the cloud policy management domain, if this Profile is under |
| - // cloud policy management. Otherwise returns an empty string. You must call |
| - // this method only when the policies system is fully initialized. |
| + // If |configuration_policy_provider_| contains kManagedBookmarks the cloud |
| + // policy management domain or the Active Directory realm that this Profile is |
| + // managed by is returned. Otherwise and for unmanaged Profiles an empty |
| + // string is returned. You must call this method only when the policies system |
| + // is fully initialized. |
| + std::string GetDisplayDomainForManagedBookmarks() const; |
|
emaxx
2016/12/28 19:09:20
This method looks alien to this class.
I don't fee
Thiemo Nagel
2016/12/29 15:08:27
OK, reverting this part. (I don't understand the
|
| + |
| + private: |
| + FRIEND_TEST_ALL_PREFIXES(ProfilePolicyConnectorTest, |
| + IsManagedForManagedUsers); |
| + FRIEND_TEST_ALL_PREFIXES(ProfilePolicyConnectorTest, IsProfilePolicy); |
| + |
| + // Returns the cloud policy management domain or the Active Directory realm |
| + // for managed Profiles or an empty string for unmanaged Profiles. You must |
| + // call this method only when the policies system is fully initialized. |
| std::string GetManagementDomain() const; |
| - // Returns true if the |name| Chrome user policy is currently set via the |
| - // CloudPolicyManager and isn't being overridden by a higher-level provider. |
| - bool IsPolicyFromCloudPolicy(const char* name) const; |
| + // Returns true if this Profile is under policy management. You must call this |
| + // method only when the policies system is fully initialized. |
| + bool IsProfilePolicy(const char* name) const; |
| - private: |
| // Find the policy provider that provides the |name| Chrome policy, if any. In |
| // case of multiple providers sharing the same policy, the one with the |
| // highest priority will be returned. |
| @@ -73,14 +84,15 @@ class ProfilePolicyConnector : public KeyedService { |
| // connector belongs to the first signed-in Profile, and in that case that |
| // Profile's policy is the one that affects global policy settings in |
| // local state. |
| - bool is_primary_user_; |
| + bool is_primary_user_ = false; |
| std::unique_ptr<ConfigurationPolicyProvider> special_user_policy_provider_; |
| #endif // defined(OS_CHROMEOS) |
| std::unique_ptr<ConfigurationPolicyProvider> |
| wrapped_platform_policy_provider_; |
| - CloudPolicyManager* user_cloud_policy_manager_; |
| + const ConfigurationPolicyProvider* configuration_policy_provider_ = nullptr; |
| + const CloudPolicyStore* policy_store_ = nullptr; |
| // |policy_providers_| contains a list of the policy providers available for |
| // the PolicyService of this connector, in decreasing order of priority. |