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 COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/strings/string_split.h" |
18 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
19 #include "components/policy/policy_export.h" | 20 #include "components/policy/policy_export.h" |
20 #include "net/url_request/url_fetcher_delegate.h" | 21 #include "net/url_request/url_fetcher_delegate.h" |
21 #include "policy/proto/device_management_backend.pb.h" | 22 #include "policy/proto/device_management_backend.pb.h" |
22 | 23 |
| 24 |
23 namespace net { | 25 namespace net { |
24 class URLRequestContextGetter; | 26 class URLRequestContextGetter; |
25 } | 27 } |
26 | 28 |
27 namespace policy { | 29 namespace policy { |
28 | 30 |
29 class DeviceManagementRequestJobImpl; | 31 class DeviceManagementRequestJobImpl; |
30 class DeviceManagementService; | 32 class DeviceManagementService; |
31 | 33 |
32 // DeviceManagementRequestJob describes a request to send to the device | 34 // DeviceManagementRequestJob describes a request to send to the device |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // due to proxy misconfigurations. If a |retry_callback| is set then it will | 68 // due to proxy misconfigurations. If a |retry_callback| is set then it will |
67 // be invoked with the DeviceManagementRequestJob as an argument when that | 69 // be invoked with the DeviceManagementRequestJob as an argument when that |
68 // happens, so that the job's owner can customize the retry request before | 70 // happens, so that the job's owner can customize the retry request before |
69 // it's sent. | 71 // it's sent. |
70 void SetRetryCallback(const RetryCallback& retry_callback); | 72 void SetRetryCallback(const RetryCallback& retry_callback); |
71 | 73 |
72 // Starts the job. |callback| will be invoked on completion. | 74 // Starts the job. |callback| will be invoked on completion. |
73 void Start(const Callback& callback); | 75 void Start(const Callback& callback); |
74 | 76 |
75 protected: | 77 protected: |
76 typedef std::vector<std::pair<std::string, std::string> > ParameterMap; | 78 typedef base::StringPairs ParameterMap; |
77 | 79 |
78 DeviceManagementRequestJob(JobType type, | 80 DeviceManagementRequestJob(JobType type, |
79 const std::string& agent_parameter, | 81 const std::string& agent_parameter, |
80 const std::string& platform_parameter); | 82 const std::string& platform_parameter); |
81 | 83 |
82 // Appends a parameter to |query_params|. | 84 // Appends a parameter to |query_params|. |
83 void AddParameter(const std::string& name, const std::string& value); | 85 void AddParameter(const std::string& name, const std::string& value); |
84 | 86 |
85 // Fires the job, to be filled in by implementations. | 87 // Fires the job, to be filled in by implementations. |
86 virtual void Run() = 0; | 88 virtual void Run() = 0; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 186 |
185 // Used to create tasks to run |Initialize| delayed on the UI thread. | 187 // Used to create tasks to run |Initialize| delayed on the UI thread. |
186 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; | 188 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; |
187 | 189 |
188 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); | 190 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); |
189 }; | 191 }; |
190 | 192 |
191 } // namespace policy | 193 } // namespace policy |
192 | 194 |
193 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ | 195 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ |
OLD | NEW |