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> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Handles the URL request response. | 42 // Handles the URL request response. |
43 virtual void HandleResponse(const net::URLRequestStatus& status, | 43 virtual void HandleResponse(const net::URLRequestStatus& status, |
44 int response_code, | 44 int response_code, |
45 const net::ResponseCookies& cookies, | 45 const net::ResponseCookies& cookies, |
46 const std::string& data) = 0; | 46 const std::string& data) = 0; |
47 | 47 |
48 // Gets the URL to contact. | 48 // Gets the URL to contact. |
49 virtual GURL GetURL(const std::string& server_url) = 0; | 49 virtual GURL GetURL(const std::string& server_url) = 0; |
50 | 50 |
51 // Configures the fetcher, setting up payload and headers. | 51 // Configures the fetcher, setting up payload and headers. |
52 virtual void ConfigureRequest(URLFetcher* fetcher) = 0; | 52 virtual void ConfigureRequest(content::URLFetcher* fetcher) = 0; |
53 }; | 53 }; |
54 | 54 |
55 explicit DeviceManagementService(const std::string& server_url); | 55 explicit DeviceManagementService(const std::string& server_url); |
56 virtual ~DeviceManagementService(); | 56 virtual ~DeviceManagementService(); |
57 | 57 |
58 // Constructs a device management backend for use by client code. Ownership of | 58 // Constructs a device management backend for use by client code. Ownership of |
59 // the returned backend object is transferred to the caller. | 59 // the returned backend object is transferred to the caller. |
60 // Marked virtual for the benefit of tests. | 60 // Marked virtual for the benefit of tests. |
61 virtual DeviceManagementBackend* CreateBackend(); | 61 virtual DeviceManagementBackend* CreateBackend(); |
62 | 62 |
(...skipping 10 matching lines...) Expand all Loading... |
73 | 73 |
74 // Removes a job. The job will be removed and won't receive a completion | 74 // Removes a job. The job will be removed and won't receive a completion |
75 // callback. | 75 // callback. |
76 void RemoveJob(DeviceManagementJob* job); | 76 void RemoveJob(DeviceManagementJob* job); |
77 | 77 |
78 protected: | 78 protected: |
79 // Starts the given job. | 79 // Starts the given job. |
80 virtual void StartJob(DeviceManagementJob* job, bool bypass_proxy); | 80 virtual void StartJob(DeviceManagementJob* job, bool bypass_proxy); |
81 | 81 |
82 private: | 82 private: |
83 typedef std::map<const URLFetcher*, DeviceManagementJob*> JobFetcherMap; | 83 typedef std::map<const content::URLFetcher*, DeviceManagementJob*> |
| 84 JobFetcherMap; |
84 typedef std::deque<DeviceManagementJob*> JobQueue; | 85 typedef std::deque<DeviceManagementJob*> JobQueue; |
85 | 86 |
86 // content::URLFetcherDelegate override. | 87 // content::URLFetcherDelegate override. |
87 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 88 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
88 | 89 |
89 // Does the actual initialization using the request context specified for | 90 // Does the actual initialization using the request context specified for |
90 // |PrepareInitialization|. This will also fire any pending network requests. | 91 // |PrepareInitialization|. This will also fire any pending network requests. |
91 void Initialize(); | 92 void Initialize(); |
92 | 93 |
93 // Server at which to contact the service. | 94 // Server at which to contact the service. |
94 const std::string server_url_; | 95 const std::string server_url_; |
95 | 96 |
96 // The request context we use. | 97 // The request context we use. |
97 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 98 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
(...skipping 10 matching lines...) Expand all Loading... |
108 | 109 |
109 // Used to create tasks to run |Initialize| delayed on the UI thread. | 110 // Used to create tasks to run |Initialize| delayed on the UI thread. |
110 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; | 111 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; |
111 | 112 |
112 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); | 113 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); |
113 }; | 114 }; |
114 | 115 |
115 } // namespace policy | 116 } // namespace policy |
116 | 117 |
117 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ | 118 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ |
OLD | NEW |