OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DEVICE_MANAGEMENT_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ |
6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ | 6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "chrome/browser/policy/device_management_backend.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/task.h" |
15 #include "content/common/net/url_fetcher.h" | 16 #include "content/common/net/url_fetcher.h" |
16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
17 | 18 |
18 class Profile; | |
19 | |
20 namespace net { | 19 namespace net { |
21 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
22 } | 21 } |
23 | 22 |
24 namespace policy { | 23 namespace policy { |
25 | 24 |
26 class DeviceManagementBackendImpl; | 25 class DeviceManagementBackend; |
27 | 26 |
28 // The device management service is responsible for everything related to | 27 // The device management service is responsible for everything related to |
29 // communication with the device management server. It creates the backends | 28 // communication with the device management server. It creates the backends |
30 // objects that the device management policy provider and friends use to issue | 29 // objects that the device management policy provider and friends use to issue |
31 // requests. | 30 // requests. |
32 class DeviceManagementService : public URLFetcher::Delegate { | 31 class DeviceManagementService : public URLFetcher::Delegate { |
33 public: | 32 public: |
34 // Describes a device management job handled by the service. | 33 // Describes a device management job handled by the service. |
35 class DeviceManagementJob { | 34 class DeviceManagementJob { |
36 public: | 35 public: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 private: | 78 private: |
80 typedef std::map<const URLFetcher*, DeviceManagementJob*> JobFetcherMap; | 79 typedef std::map<const URLFetcher*, DeviceManagementJob*> JobFetcherMap; |
81 typedef std::deque<DeviceManagementJob*> JobQueue; | 80 typedef std::deque<DeviceManagementJob*> JobQueue; |
82 | 81 |
83 // URLFetcher::Delegate override. | 82 // URLFetcher::Delegate override. |
84 virtual void OnURLFetchComplete(const URLFetcher* source, | 83 virtual void OnURLFetchComplete(const URLFetcher* source, |
85 const GURL& url, | 84 const GURL& url, |
86 const net::URLRequestStatus& status, | 85 const net::URLRequestStatus& status, |
87 int response_code, | 86 int response_code, |
88 const net::ResponseCookies& cookies, | 87 const net::ResponseCookies& cookies, |
89 const std::string& data); | 88 const std::string& data) OVERRIDE; |
90 | 89 |
91 // Does the actual initialization using the request context specified for | 90 // Does the actual initialization using the request context specified for |
92 // |PrepareInitialization|. This will also fire any pending network requests. | 91 // |PrepareInitialization|. This will also fire any pending network requests. |
93 void Initialize(); | 92 void Initialize(); |
94 | 93 |
95 // Server at which to contact the service. | 94 // Server at which to contact the service. |
96 const std::string server_url_; | 95 const std::string server_url_; |
97 | 96 |
98 // The request context we use. | 97 // The request context we use. |
99 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 98 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
(...skipping 10 matching lines...) Expand all Loading... |
110 | 109 |
111 // Creates tasks used for running |Initialize| delayed on the UI thread. | 110 // Creates tasks used for running |Initialize| delayed on the UI thread. |
112 ScopedRunnableMethodFactory<DeviceManagementService> method_factory_; | 111 ScopedRunnableMethodFactory<DeviceManagementService> method_factory_; |
113 | 112 |
114 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); | 113 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); |
115 }; | 114 }; |
116 | 115 |
117 } // namespace policy | 116 } // namespace policy |
118 | 117 |
119 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ | 118 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ |
OLD | NEW |