Chromium Code Reviews| Index: chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h |
| diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h b/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h |
| index 2be1a0d73119b766f6686fc7f09290b99e08599c..778b2c40fe78825d7ff2bd387bc91e713fc1a47b 100644 |
| --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h |
| +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h |
| @@ -25,11 +25,13 @@ class BrowserContext; |
| namespace policy { |
| +class ConfigurationPolicyProvider; |
| +class UserActiveDirectoryPolicyManager; |
| class UserCloudPolicyManagerChromeOS; |
| // BrowserContextKeyedBaseFactory implementation |
| // for UserCloudPolicyManagerChromeOS instances that initialize per-profile |
| -// cloud policy settings on ChromeOS. |
| +// cloud policy settings on Chrome OS. |
| // |
| // UserCloudPolicyManagerChromeOS is handled different than other |
| // KeyedServices because it is a dependency of PrefService. |
| @@ -41,15 +43,30 @@ class UserCloudPolicyManagerChromeOS; |
| // PrefService directly depending on UserCloudPolicyManagerChromeOS once the |
| // former has been converted to a KeyedService. |
| // See also http://crbug.com/131843 and http://crbug.com/131844. |
| + |
| +// TODO(tnagel): Rename to make clear that the factory also provides AD |
|
emaxx
2016/12/28 19:09:19
Don't you want to do the renaming straight away?
Thiemo Nagel
2016/12/29 15:08:27
Done. (As discussed offline.)
|
| +// managers. |
| class UserCloudPolicyManagerFactoryChromeOS |
| : public BrowserContextKeyedBaseFactory { |
| public: |
| // Returns an instance of the UserCloudPolicyManagerFactoryChromeOS singleton. |
| static UserCloudPolicyManagerFactoryChromeOS* GetInstance(); |
| + // Get the ConfigurationPolicyProvider instance associated with |
| + // |profile|. Depending on the type of management either a |
|
emaxx
2016/12/28 19:09:19
nit: s/management either/management, either/
Thiemo Nagel
2016/12/29 15:08:27
Done.
|
| + // UserCloudPolicyManagerChromeOS or a UserActiveDirectoryPolicyManager or a |
|
emaxx
2016/12/28 19:09:19
nit: s/a nullptr/nullptr/
Thiemo Nagel
2016/12/29 15:08:27
Done.
|
| + // nullptr is returned. |
| + static ConfigurationPolicyProvider* GetForProfile(Profile* profile); |
| + |
| // Returns the UserCloudPolicyManagerChromeOS instance associated with |
| - // |profile|. |
| - static UserCloudPolicyManagerChromeOS* GetForProfile(Profile* profile); |
| + // |profile| or nullptr in case there is none. |
| + static UserCloudPolicyManagerChromeOS* GetCloudPolicyManagerForProfile( |
| + Profile* profile); |
| + |
| + // Returns the UserActiveDirectoryPolicyManager instance associated with |
| + // |profile| or nullptr in case there is none. |
| + static UserActiveDirectoryPolicyManager* |
| + GetActiveDirectoryPolicyManagerForProfile(Profile* profile); |
| // Creates an instance for |profile|. Note that the caller is responsible for |
| // managing the lifetime of the instance. Subsequent calls to GetForProfile() |
| @@ -57,7 +74,7 @@ class UserCloudPolicyManagerFactoryChromeOS |
| // |
| // If |force_immediate_load| is true, policy is loaded synchronously from |
| // UserCloudPolicyStore at startup. |
| - static std::unique_ptr<UserCloudPolicyManagerChromeOS> CreateForProfile( |
| + static std::unique_ptr<ConfigurationPolicyProvider> CreateForProfile( |
| Profile* profile, |
| bool force_immediate_load, |
| scoped_refptr<base::SequencedTaskRunner> background_task_runner); |
| @@ -70,8 +87,10 @@ class UserCloudPolicyManagerFactoryChromeOS |
| ~UserCloudPolicyManagerFactoryChromeOS() override; |
| // See comments for the static versions above. |
| - UserCloudPolicyManagerChromeOS* GetManagerForProfile(Profile* profile); |
| - std::unique_ptr<UserCloudPolicyManagerChromeOS> CreateManagerForProfile( |
| + UserCloudPolicyManagerChromeOS* GetCloudPolicyManager(Profile* profile); |
| + UserActiveDirectoryPolicyManager* GetActiveDirectoryPolicyManager( |
| + Profile* profile); |
| + std::unique_ptr<ConfigurationPolicyProvider> CreateManagerForProfile( |
| Profile* profile, |
| bool force_immediate_load, |
| scoped_refptr<base::SequencedTaskRunner> background_task_runner); |
| @@ -83,8 +102,9 @@ class UserCloudPolicyManagerFactoryChromeOS |
| bool HasTestingFactory(content::BrowserContext* context) override; |
| void CreateServiceNow(content::BrowserContext* context) override; |
| - typedef std::map<Profile*, UserCloudPolicyManagerChromeOS*> ManagerMap; |
| - ManagerMap managers_; |
| + std::map<Profile*, UserCloudPolicyManagerChromeOS*> cloud_managers_; |
| + std::map<Profile*, UserActiveDirectoryPolicyManager*> |
| + active_directory_managers_; |
| DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerFactoryChromeOS); |
| }; |