| 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_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // The device management service is responsible for everything related to | 98 // The device management service is responsible for everything related to |
| 99 // communication with the device management server. It creates the backends | 99 // communication with the device management server. It creates the backends |
| 100 // objects that the device management policy provider and friends use to issue | 100 // objects that the device management policy provider and friends use to issue |
| 101 // requests. | 101 // requests. |
| 102 class DeviceManagementService : public net::URLFetcherDelegate { | 102 class DeviceManagementService : public net::URLFetcherDelegate { |
| 103 public: | 103 public: |
| 104 DeviceManagementService( | 104 DeviceManagementService( |
| 105 scoped_refptr<net::URLRequestContextGetter> request_context, | 105 scoped_refptr<net::URLRequestContextGetter> request_context, |
| 106 const std::string& server_url, | 106 const std::string& server_url, |
| 107 const std::string& user_agent, | 107 const std::string& user_agent, |
| 108 const std::string& agent_parameter, | 108 const std::string& agent_parameter); |
| 109 const std::string& platform_parameter); | |
| 110 virtual ~DeviceManagementService(); | 109 virtual ~DeviceManagementService(); |
| 111 | 110 |
| 112 // The ID of URLFetchers created by the DeviceManagementService. This can be | 111 // The ID of URLFetchers created by the DeviceManagementService. This can be |
| 113 // used by tests that use a TestURLFetcherFactory to get the pending fetchers | 112 // used by tests that use a TestURLFetcherFactory to get the pending fetchers |
| 114 // created by the DeviceManagementService. | 113 // created by the DeviceManagementService. |
| 115 static const int kURLFetcherID; | 114 static const int kURLFetcherID; |
| 116 | 115 |
| 117 // Creates a new device management request job. Ownership is transferred to | 116 // Creates a new device management request job. Ownership is transferred to |
| 118 // the caller. | 117 // the caller. |
| 119 virtual DeviceManagementRequestJob* CreateJob( | 118 virtual DeviceManagementRequestJob* CreateJob( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 155 |
| 157 // Server at which to contact the service. | 156 // Server at which to contact the service. |
| 158 const std::string server_url_; | 157 const std::string server_url_; |
| 159 | 158 |
| 160 // Value for the User-Agent header. | 159 // Value for the User-Agent header. |
| 161 const std::string user_agent_; | 160 const std::string user_agent_; |
| 162 | 161 |
| 163 // Agent reported in the "agent" query parameter. | 162 // Agent reported in the "agent" query parameter. |
| 164 const std::string agent_parameter_; | 163 const std::string agent_parameter_; |
| 165 | 164 |
| 166 // The platform reported in the "platform" query parameter. | 165 // The cached platform reported in the "platform" query parameter. |
| 167 const std::string platform_parameter_; | 166 std::string platform_parameter_; |
| 168 | 167 |
| 169 // The request context we use. This is a wrapper of |request_context_|. | 168 // The request context we use. This is a wrapper of |request_context_|. |
| 170 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 169 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 171 | 170 |
| 172 // The jobs we currently have in flight. | 171 // The jobs we currently have in flight. |
| 173 JobFetcherMap pending_jobs_; | 172 JobFetcherMap pending_jobs_; |
| 174 | 173 |
| 175 // Jobs that are registered, but not started yet. | 174 // Jobs that are registered, but not started yet. |
| 176 JobQueue queued_jobs_; | 175 JobQueue queued_jobs_; |
| 177 | 176 |
| 178 // If this service is initialized, incoming requests get fired instantly. | 177 // If this service is initialized, incoming requests get fired instantly. |
| 179 // If it is not initialized, incoming requests are queued. | 178 // If it is not initialized, incoming requests are queued. |
| 180 bool initialized_; | 179 bool initialized_; |
| 181 | 180 |
| 182 // Used to create tasks to run |Initialize| delayed on the UI thread. | 181 // Used to create tasks to run |Initialize| delayed on the UI thread. |
| 183 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; | 182 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; |
| 184 | 183 |
| 185 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); | 184 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); |
| 186 }; | 185 }; |
| 187 | 186 |
| 188 } // namespace policy | 187 } // namespace policy |
| 189 | 188 |
| 190 #endif // CHROME_BROWSER_POLICY_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ | 189 #endif // CHROME_BROWSER_POLICY_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ |
| OLD | NEW |