Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: chrome/browser/policy/browser_policy_connector.h

Issue 10823212: Relanding this as this did not fix the chromiumos breakage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 30 matching lines...) Expand all
41 // Builds an uninitialized BrowserPolicyConnector, suitable for testing. 41 // Builds an uninitialized BrowserPolicyConnector, suitable for testing.
42 // Init() should be called to create and start the policy machinery. 42 // Init() should be called to create and start the policy machinery.
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 UserCloudPolicyManager for the given profile, or returns NULL if
52 // it is not supported on this platform. Ownership is transferred to the
53 // caller.
54 scoped_ptr<UserCloudPolicyManager> CreateCloudPolicyManager(Profile* profile);
55
51 // Creates a new policy service for the given profile, or a global one if 56 // Creates a new policy service for the given profile, or a global one if
52 // it is NULL. Ownership is transferred to the caller. 57 // it is NULL. Ownership is transferred to the caller.
53 PolicyService* CreatePolicyService(Profile* profile); 58 scoped_ptr<PolicyService> CreatePolicyService(Profile* profile);
54 59
55 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the 60 // Returns a weak pointer to the CloudPolicySubsystem corresponding to the
56 // device policy managed by this policy connector, or NULL if no such 61 // device policy managed by this policy connector, or NULL if no such
57 // subsystem exists (i.e. when running outside ChromeOS). 62 // subsystem exists (i.e. when running outside ChromeOS).
58 CloudPolicySubsystem* device_cloud_policy_subsystem() { 63 CloudPolicySubsystem* device_cloud_policy_subsystem() {
59 #if defined(OS_CHROMEOS) 64 #if defined(OS_CHROMEOS)
60 return device_cloud_policy_subsystem_.get(); 65 return device_cloud_policy_subsystem_.get();
61 #else 66 #else
62 return NULL; 67 return NULL;
63 #endif 68 #endif
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 CloudPolicyDataStore* GetUserCloudPolicyDataStore(); 138 CloudPolicyDataStore* GetUserCloudPolicyDataStore();
134 139
135 const ConfigurationPolicyHandlerList* GetHandlerList() const; 140 const ConfigurationPolicyHandlerList* GetHandlerList() const;
136 141
137 // Works out the user affiliation by checking the given |user_name| against 142 // Works out the user affiliation by checking the given |user_name| against
138 // the installation attributes. 143 // the installation attributes.
139 UserAffiliation GetUserAffiliation(const std::string& user_name); 144 UserAffiliation GetUserAffiliation(const std::string& user_name);
140 145
141 AppPackUpdater* GetAppPackUpdater(); 146 AppPackUpdater* GetAppPackUpdater();
142 147
148 DeviceManagementService* device_management_service() {
149 return device_management_service_.get();
150 }
151
143 // Sets a |provider| that will be included in PolicyServices returned by 152 // Sets a |provider| that will be included in PolicyServices returned by
144 // CreatePolicyService. This is a static method because local state is 153 // CreatePolicyService. This is a static method because local state is
145 // created immediately after the connector, and tests don't have a chance to 154 // created immediately after the connector, and tests don't have a chance to
146 // inject the provider otherwise. |provider| must outlive the connector, and 155 // inject the provider otherwise. |provider| must outlive the connector, and
147 // its ownership is not taken. 156 // its ownership is not taken.
148 static void SetPolicyProviderForTesting( 157 static void SetPolicyProviderForTesting(
149 ConfigurationPolicyProvider* provider); 158 ConfigurationPolicyProvider* provider);
150 159
160 // Gets the URL of the DM server (either the default or a URL provided via the
161 // command line).
162 static std::string GetDeviceManagementUrl();
163
151 private: 164 private:
152 // content::NotificationObserver method overrides: 165 // content::NotificationObserver method overrides:
153 virtual void Observe(int type, 166 virtual void Observe(int type,
154 const content::NotificationSource& source, 167 const content::NotificationSource& source,
155 const content::NotificationDetails& details) OVERRIDE; 168 const content::NotificationDetails& details) OVERRIDE;
156 169
157 // Initializes the device cloud policy infrasturcture. 170 // Initializes the device cloud policy infrasturcture.
158 void InitializeDevicePolicy(); 171 void InitializeDevicePolicy();
159 172
160 // Complete initialization once the message loops are running and the 173 // Complete initialization once the message loops are running and the
(...skipping 22 matching lines...) Expand all
183 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_; 196 scoped_ptr<UserPolicyTokenCache> user_policy_token_cache_;
184 scoped_ptr<CloudPolicyDataStore> user_data_store_; 197 scoped_ptr<CloudPolicyDataStore> user_data_store_;
185 scoped_ptr<CloudPolicySubsystem> user_cloud_policy_subsystem_; 198 scoped_ptr<CloudPolicySubsystem> user_cloud_policy_subsystem_;
186 199
187 // Components of the new-style cloud policy implementation. 200 // Components of the new-style cloud policy implementation.
188 // TODO(mnissler): Remove the old-style components above once we have 201 // TODO(mnissler): Remove the old-style components above once we have
189 // completed the switch to the new cloud policy implementation. 202 // completed the switch to the new cloud policy implementation.
190 scoped_ptr<DeviceManagementService> device_management_service_; 203 scoped_ptr<DeviceManagementService> device_management_service_;
191 204
192 ProxyPolicyProvider user_cloud_policy_provider_; 205 ProxyPolicyProvider user_cloud_policy_provider_;
193 scoped_ptr<UserCloudPolicyManager> user_cloud_policy_manager_;
194 206
195 // Used to initialize the device policy subsystem once the message loops 207 // Used to initialize the device policy subsystem once the message loops
196 // are spinning. 208 // are spinning.
197 base::WeakPtrFactory<BrowserPolicyConnector> weak_ptr_factory_; 209 base::WeakPtrFactory<BrowserPolicyConnector> weak_ptr_factory_;
198 210
199 // Registers the provider for notification of successful Gaia logins. 211 // Registers the provider for notification of successful Gaia logins.
200 content::NotificationRegistrar registrar_; 212 content::NotificationRegistrar registrar_;
201 213
202 // Weak reference to the TokenService we are listening to for user cloud 214 // Weak reference to the TokenService we are listening to for user cloud
203 // policy authentication tokens. 215 // policy authentication tokens.
204 TokenService* token_service_; 216 TokenService* token_service_;
205 217
206 #if defined(OS_CHROMEOS) 218 #if defined(OS_CHROMEOS)
207 scoped_ptr<AppPackUpdater> app_pack_updater_; 219 scoped_ptr<AppPackUpdater> app_pack_updater_;
208 #endif 220 #endif
209 221
210 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector); 222 DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnector);
211 }; 223 };
212 224
213 } // namespace policy 225 } // namespace policy
214 226
215 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_ 227 #endif // CHROME_BROWSER_POLICY_BROWSER_POLICY_CONNECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/auto_enrollment_client.cc ('k') | chrome/browser/policy/browser_policy_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698