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

Unified Diff: chrome/browser/policy/cloud/device_management_service.h

Issue 25690003: Refactored the DeviceManagementService to get its parameters from a delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/cloud/device_management_service.h
diff --git a/chrome/browser/policy/cloud/device_management_service.h b/chrome/browser/policy/cloud/device_management_service.h
index da43b12fbc5c7a7c81045763f768152540af1bcf..bba9369d1a53b55502cd5c8e4e17b3c8082a08dd 100644
--- a/chrome/browser/policy/cloud/device_management_service.h
+++ b/chrome/browser/policy/cloud/device_management_service.h
@@ -101,12 +101,30 @@ class DeviceManagementRequestJob {
// requests.
class DeviceManagementService : public net::URLFetcherDelegate {
public:
+ // Obtains the parameters used to contact the server.
+ // This allows creating the DeviceManagementService early and getting these
+ // parameters later. Passing the parameters directly in the ctor isn't
+ // possible because some aren't ready during startup. http://crbug.com/302798
+ class Configuration {
+ public:
+ virtual ~Configuration() {}
+
+ // Server at which to contact the service.
+ virtual std::string GetServerUrl() = 0;
+
+ // Value for the User-Agent header.
+ virtual std::string GetUserAgent() = 0;
+
+ // Agent reported in the "agent" query parameter.
+ virtual std::string GetAgentParameter() = 0;
+
+ // The platform reported in the "platform" query parameter.
+ virtual std::string GetPlatformParameter() = 0;
+ };
+
DeviceManagementService(
- scoped_refptr<net::URLRequestContextGetter> request_context,
- const std::string& server_url,
- const std::string& user_agent,
- const std::string& agent_parameter,
- const std::string& platform_parameter);
+ scoped_ptr<Configuration> configuration,
+ scoped_refptr<net::URLRequestContextGetter> request_context);
virtual ~DeviceManagementService();
// The ID of URLFetchers created by the DeviceManagementService. This can be
@@ -151,21 +169,13 @@ class DeviceManagementService : public net::URLFetcherDelegate {
// callback.
void RemoveJob(DeviceManagementRequestJobImpl* job);
+ // A Configuration implementation that is used to obtain various parameters
+ // used to talk to the device management server.
+ scoped_ptr<Configuration> configuration_;
+
// The request context is wrapped by the |request_context_getter_|.
scoped_refptr<net::URLRequestContextGetter> request_context_;
- // Server at which to contact the service.
- const std::string server_url_;
-
- // Value for the User-Agent header.
- const std::string user_agent_;
-
- // Agent reported in the "agent" query parameter.
- const std::string agent_parameter_;
-
- // The platform reported in the "platform" query parameter.
- const std::string platform_parameter_;
-
// The request context we use. This is a wrapper of |request_context_|.
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.cc ('k') | chrome/browser/policy/cloud/device_management_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698