| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 BrowserPolicyConnector(); | 43 BrowserPolicyConnector(); |
| 44 virtual ~BrowserPolicyConnector(); | 44 virtual ~BrowserPolicyConnector(); |
| 45 | 45 |
| 46 // Creates the policy providers and finalizes the initialization of the | 46 // Creates the policy providers and finalizes the initialization of the |
| 47 // connector. This call can be skipped on tests that don't require the full | 47 // connector. This call can be skipped on tests that don't require the full |
| 48 // policy system running. | 48 // policy system running. |
| 49 void Init(); | 49 void Init(); |
| 50 | 50 |
| 51 // Creates a new policy service for the given profile, or a global one if | 51 // Creates a new policy service for the given profile, or a global one if |
| 52 // it is NULL. Ownership is transferred to the caller. | 52 // it is NULL. Ownership is transferred to the caller. |
| 53 PolicyService* CreatePolicyService(Profile* profile); | 53 scoped_ptr<PolicyService> CreatePolicyService(Profile* profile); |
| 54 | 54 |
| 55 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the | 55 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the |
| 56 // device policy managed by this policy connector, or NULL if no such | 56 // device policy managed by this policy connector, or NULL if no such |
| 57 // subsystem exists (i.e. when running outside ChromeOS). | 57 // subsystem exists (i.e. when running outside ChromeOS). |
| 58 CloudPolicySubsystem* device_cloud_policy_subsystem() { | 58 CloudPolicySubsystem* device_cloud_policy_subsystem() { |
| 59 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
| 60 return device_cloud_policy_subsystem_.get(); | 60 return device_cloud_policy_subsystem_.get(); |
| 61 #else | 61 #else |
| 62 return NULL; | 62 return NULL; |
| 63 #endif | 63 #endif |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 CloudPolicyDataStore* GetUserCloudPolicyDataStore(); | 133 CloudPolicyDataStore* GetUserCloudPolicyDataStore(); |
| 134 | 134 |
| 135 const ConfigurationPolicyHandlerList* GetHandlerList() const; | 135 const ConfigurationPolicyHandlerList* GetHandlerList() const; |
| 136 | 136 |
| 137 // Works out the user affiliation by checking the given |user_name| against | 137 // Works out the user affiliation by checking the given |user_name| against |
| 138 // the installation attributes. | 138 // the installation attributes. |
| 139 UserAffiliation GetUserAffiliation(const std::string& user_name); | 139 UserAffiliation GetUserAffiliation(const std::string& user_name); |
| 140 | 140 |
| 141 AppPackUpdater* GetAppPackUpdater(); | 141 AppPackUpdater* GetAppPackUpdater(); |
| 142 | 142 |
| 143 DeviceManagementService* device_management_service() { |
| 144 return device_management_service_.get(); |
| 145 } |
| 146 |
| 143 // Sets a |provider| that will be included in PolicyServices returned by | 147 // Sets a |provider| that will be included in PolicyServices returned by |
| 144 // CreatePolicyService. This is a static method because local state is | 148 // CreatePolicyService. This is a static method because local state is |
| 145 // created immediately after the connector, and tests don't have a chance to | 149 // created immediately after the connector, and tests don't have a chance to |
| 146 // inject the provider otherwise. |provider| must outlive the connector, and | 150 // inject the provider otherwise. |provider| must outlive the connector, and |
| 147 // its ownership is not taken. | 151 // its ownership is not taken. |
| 148 static void SetPolicyProviderForTesting( | 152 static void SetPolicyProviderForTesting( |
| 149 ConfigurationPolicyProvider* provider); | 153 ConfigurationPolicyProvider* provider); |
| 150 | 154 |
| 155 // Gets the URL of the DM server (either the default or a URL provided via the |
| 156 // command line). |
| 157 static std::string GetDeviceManagementUrl(); |
| 158 |
| 151 private: | 159 private: |
| 152 // content::NotificationObserver method overrides: | 160 // content::NotificationObserver method overrides: |
| 153 virtual void Observe(int type, | 161 virtual void Observe(int type, |
| 154 const content::NotificationSource& source, | 162 const content::NotificationSource& source, |
| 155 const content::NotificationDetails& details) OVERRIDE; | 163 const content::NotificationDetails& details) OVERRIDE; |
| 156 | 164 |
| 157 // Initializes the device cloud policy infrasturcture. | 165 // Initializes the device cloud policy infrasturcture. |
| 158 void InitializeDevicePolicy(); | 166 void InitializeDevicePolicy(); |
| 159 | 167 |
| 160 // Complete initialization once the message loops are running and the | 168 // Complete initialization once the message loops are running and the |
| (...skipping 22 matching lines...) Expand all Loading... |
| 183 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_; | 191 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_; |
| 184 scoped_ptr<CloudPolicyDataStore> user_data_store_; | 192 scoped_ptr<CloudPolicyDataStore> user_data_store_; |
| 185 scoped_ptr<CloudPolicySubsystem> user_cloud_policy_subsystem_; | 193 scoped_ptr<CloudPolicySubsystem> user_cloud_policy_subsystem_; |
| 186 | 194 |
| 187 // Components of the new-style cloud policy implementation. | 195 // Components of the new-style cloud policy implementation. |
| 188 // TODO(mnissler): Remove the old-style components above once we have | 196 // TODO(mnissler): Remove the old-style components above once we have |
| 189 // completed the switch to the new cloud policy implementation. | 197 // completed the switch to the new cloud policy implementation. |
| 190 scoped_ptr<DeviceManagementService> device_management_service_; | 198 scoped_ptr<DeviceManagementService> device_management_service_; |
| 191 | 199 |
| 192 ProxyPolicyProvider user_cloud_policy_provider_; | 200 ProxyPolicyProvider user_cloud_policy_provider_; |
| 193 scoped_ptr<UserCloudPolicyManager> user_cloud_policy_manager_; | |
| 194 | 201 |
| 195 // Used to initialize the device policy subsystem once the message loops | 202 // Used to initialize the device policy subsystem once the message loops |
| 196 // are spinning. | 203 // are spinning. |
| 197 base::WeakPtrFactory<BrowserPolicyConnector> weak_ptr_factory_; | 204 base::WeakPtrFactory<BrowserPolicyConnector> weak_ptr_factory_; |
| 198 | 205 |
| 199 // Registers the provider for notification of successful Gaia logins. | 206 // Registers the provider for notification of successful Gaia logins. |
| 200 content::NotificationRegistrar registrar_; | 207 content::NotificationRegistrar registrar_; |
| 201 | 208 |
| 202 // Weak reference to the TokenService we are listening to for user cloud | 209 // Weak reference to the TokenService we are listening to for user cloud |
| 203 // policy authentication tokens. | 210 // policy authentication tokens. |
| 204 TokenService* token_service_; | 211 TokenService* token_service_; |
| 205 | 212 |
| 206 #if defined(OS_CHROMEOS) | 213 #if defined(OS_CHROMEOS) |
| 207 scoped_ptr<AppPackUpdater> app_pack_updater_; | 214 scoped_ptr<AppPackUpdater> app_pack_updater_; |
| 208 #endif | 215 #endif |
| 209 | 216 |
| 210 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); | 217 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); |
| 211 }; | 218 }; |
| 212 | 219 |
| 213 } // namespace policy | 220 } // namespace policy |
| 214 | 221 |
| 215 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ | 222 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ |
| OLD | NEW |