| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ | 5 #ifndef CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
| 6 #define CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ | 6 #define CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 // Initiates a user policy fetch after a successful device registration. This | 92 // Initiates a user policy fetch after a successful device registration. This |
| 93 // is only safe to call when a user device token is available. | 93 // is only safe to call when a user device token is available. |
| 94 void FetchUserPolicy(); | 94 void FetchUserPolicy(); |
| 95 | 95 |
| 96 // Schedules initialization of the cloud policy backend services, if the | 96 // Schedules initialization of the cloud policy backend services, if the |
| 97 // services are already constructed. | 97 // services are already constructed. |
| 98 void ScheduleServiceInitialization(int64 delay_milliseconds); | 98 void ScheduleServiceInitialization(int64 delay_milliseconds); |
| 99 | 99 |
| 100 // Initializes the user cloud policy infrastructure. | 100 // Initializes the user cloud policy infrastructure. |
| 101 void InitializeUserPolicy(const std::string& user_name); | 101 // If |wait_for_policy_fetch| is true, the user policy will only become fully |
| 102 // initialized after a policy fetch is attempted. Note that Profile creation |
| 103 // is blocked until this initialization is complete. |
| 104 void InitializeUserPolicy(const std::string& user_name, |
| 105 bool wait_for_policy_fetch); |
| 102 | 106 |
| 103 // Installs a token service for user policy. | 107 // Installs a token service for user policy. |
| 104 void SetUserPolicyTokenService(TokenService* token_service); | 108 void SetUserPolicyTokenService(TokenService* token_service); |
| 105 | 109 |
| 106 // Registers for user policy (if not already registered), using the passed | 110 // Registers for user policy (if not already registered), using the passed |
| 107 // OAuth V2 token for authentication. | 111 // OAuth V2 token for authentication. |oauth_token| can be empty to signal |
| 112 // that an attempt to fetch the token was made but failed, or that oauth |
| 113 // isn't being used. |
| 108 void RegisterForUserPolicy(const std::string& oauth_token); | 114 void RegisterForUserPolicy(const std::string& oauth_token); |
| 109 | 115 |
| 110 const CloudPolicyDataStore* GetDeviceCloudPolicyDataStore() const; | 116 const CloudPolicyDataStore* GetDeviceCloudPolicyDataStore() const; |
| 111 const CloudPolicyDataStore* GetUserCloudPolicyDataStore() const; | 117 const CloudPolicyDataStore* GetUserCloudPolicyDataStore() const; |
| 112 | 118 |
| 113 const ConfigurationPolicyHandlerList* GetHandlerList() const; | 119 const ConfigurationPolicyHandlerList* GetHandlerList() const; |
| 114 | 120 |
| 121 // Works out the user affiliation by checking the given |user_name| against |
| 122 // the installation attributes. |
| 123 policy::CloudPolicyDataStore::UserAffiliation GetUserAffiliation( |
| 124 const std::string& user_name); |
| 125 |
| 115 private: | 126 private: |
| 116 friend class ::TestingBrowserProcess; | 127 friend class ::TestingBrowserProcess; |
| 117 | 128 |
| 118 BrowserPolicyConnector(); | 129 BrowserPolicyConnector(); |
| 119 | 130 |
| 120 // Constructor for tests that allows tests to use fake platform and cloud | 131 // Constructor for tests that allows tests to use fake platform and cloud |
| 121 // policy providers instead of using the actual ones. | 132 // policy providers instead of using the actual ones. |
| 122 BrowserPolicyConnector( | 133 BrowserPolicyConnector( |
| 123 ConfigurationPolicyProvider* managed_platform_provider, | 134 ConfigurationPolicyProvider* managed_platform_provider, |
| 124 ConfigurationPolicyProvider* recommended_platform_provider, | 135 ConfigurationPolicyProvider* recommended_platform_provider, |
| 125 CloudPolicyProvider* managed_cloud_provider, | 136 CloudPolicyProvider* managed_cloud_provider, |
| 126 CloudPolicyProvider* recommended_cloud_provider); | 137 CloudPolicyProvider* recommended_cloud_provider); |
| 127 | 138 |
| 128 // content::NotificationObserver method overrides: | 139 // content::NotificationObserver method overrides: |
| 129 virtual void Observe(int type, | 140 virtual void Observe(int type, |
| 130 const content::NotificationSource& source, | 141 const content::NotificationSource& source, |
| 131 const content::NotificationDetails& details) OVERRIDE; | 142 const content::NotificationDetails& details) OVERRIDE; |
| 132 | 143 |
| 133 // Initializes the device cloud policy infrasturcture. | 144 // Initializes the device cloud policy infrasturcture. |
| 134 void InitializeDevicePolicy(); | 145 void InitializeDevicePolicy(); |
| 135 | 146 |
| 136 // Activates the device cloud policy subsystem. This will be posted as a task | 147 // Activates the device cloud policy subsystem. This will be posted as a task |
| 137 // from InitializeDevicePolicy since it needs to wait for the message loops to | 148 // from InitializeDevicePolicy since it needs to wait for the message loops to |
| 138 // be running. | 149 // be running. |
| 139 void InitializeDevicePolicySubsystem(); | 150 void InitializeDevicePolicySubsystem(); |
| 140 | 151 |
| 141 // Works out the user affiliation by checking the given |user_name| against | |
| 142 // the installation attributes. | |
| 143 policy::CloudPolicyDataStore::UserAffiliation GetUserAffiliation( | |
| 144 const std::string& user_name); | |
| 145 | |
| 146 static BrowserPolicyConnector* CreateForTests(); | 152 static BrowserPolicyConnector* CreateForTests(); |
| 147 static ConfigurationPolicyProvider* CreateManagedPlatformProvider(); | 153 static ConfigurationPolicyProvider* CreateManagedPlatformProvider(); |
| 148 static ConfigurationPolicyProvider* CreateRecommendedPlatformProvider(); | 154 static ConfigurationPolicyProvider* CreateRecommendedPlatformProvider(); |
| 149 | 155 |
| 150 scoped_ptr<ConfigurationPolicyProvider> managed_platform_provider_; | 156 scoped_ptr<ConfigurationPolicyProvider> managed_platform_provider_; |
| 151 scoped_ptr<ConfigurationPolicyProvider> recommended_platform_provider_; | 157 scoped_ptr<ConfigurationPolicyProvider> recommended_platform_provider_; |
| 152 | 158 |
| 153 scoped_ptr<CloudPolicyProvider> managed_cloud_provider_; | 159 scoped_ptr<CloudPolicyProvider> managed_cloud_provider_; |
| 154 scoped_ptr<CloudPolicyProvider> recommended_cloud_provider_; | 160 scoped_ptr<CloudPolicyProvider> recommended_cloud_provider_; |
| 155 | 161 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 178 | 184 |
| 179 // Used to convert policies to preferences. | 185 // Used to convert policies to preferences. |
| 180 ConfigurationPolicyHandlerList handler_list_; | 186 ConfigurationPolicyHandlerList handler_list_; |
| 181 | 187 |
| 182 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); | 188 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); |
| 183 }; | 189 }; |
| 184 | 190 |
| 185 } // namespace policy | 191 } // namespace policy |
| 186 | 192 |
| 187 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ | 193 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
| OLD | NEW |