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

Side by Side Diff: chrome/browser/policy/device_management_service.h

Issue 10392192: Remove content::URLFetcherDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "chrome/browser/policy/cloud_policy_constants.h" 19 #include "chrome/browser/policy/cloud_policy_constants.h"
20 #include "chrome/browser/policy/proto/device_management_backend.pb.h" 20 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
21 #include "content/public/common/url_fetcher_delegate.h" 21 #include "net/url_request/url_fetcher_delegate.h"
22 22
23 namespace net { 23 namespace net {
24 class URLRequestContextGetter; 24 class URLRequestContextGetter;
25 } 25 }
26 26
27 namespace policy { 27 namespace policy {
28 28
29 class DeviceManagementRequestJobImpl; 29 class DeviceManagementRequestJobImpl;
30 class DeviceManagementService; 30 class DeviceManagementService;
31 31
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Callback callback_; 79 Callback callback_;
80 80
81 private: 81 private:
82 DISALLOW_COPY_AND_ASSIGN(DeviceManagementRequestJob); 82 DISALLOW_COPY_AND_ASSIGN(DeviceManagementRequestJob);
83 }; 83 };
84 84
85 // The device management service is responsible for everything related to 85 // The device management service is responsible for everything related to
86 // communication with the device management server. It creates the backends 86 // communication with the device management server. It creates the backends
87 // objects that the device management policy provider and friends use to issue 87 // objects that the device management policy provider and friends use to issue
88 // requests. 88 // requests.
89 class DeviceManagementService : public content::URLFetcherDelegate { 89 class DeviceManagementService : public net::URLFetcherDelegate {
90 public: 90 public:
91 explicit DeviceManagementService(const std::string& server_url); 91 explicit DeviceManagementService(const std::string& server_url);
92 virtual ~DeviceManagementService(); 92 virtual ~DeviceManagementService();
93 93
94 // Creates a new device management request job. Ownership is transferred to 94 // Creates a new device management request job. Ownership is transferred to
95 // the caller. 95 // the caller.
96 virtual DeviceManagementRequestJob* CreateJob( 96 virtual DeviceManagementRequestJob* CreateJob(
97 DeviceManagementRequestJob::JobType type); 97 DeviceManagementRequestJob::JobType type);
98 98
99 // Schedules a task to run |Initialize| after |delay_milliseconds| had passed. 99 // Schedules a task to run |Initialize| after |delay_milliseconds| had passed.
100 void ScheduleInitialization(int64 delay_milliseconds); 100 void ScheduleInitialization(int64 delay_milliseconds);
101 101
102 // Makes the service stop all requests and drop the reference to the request 102 // Makes the service stop all requests and drop the reference to the request
103 // context. 103 // context.
104 void Shutdown(); 104 void Shutdown();
105 105
106 private: 106 private:
107 typedef std::map<const net::URLFetcher*, 107 typedef std::map<const net::URLFetcher*,
108 DeviceManagementRequestJobImpl*> JobFetcherMap; 108 DeviceManagementRequestJobImpl*> JobFetcherMap;
109 typedef std::deque<DeviceManagementRequestJobImpl*> JobQueue; 109 typedef std::deque<DeviceManagementRequestJobImpl*> JobQueue;
110 110
111 friend class DeviceManagementRequestJobImpl; 111 friend class DeviceManagementRequestJobImpl;
112 112
113 // content::URLFetcherDelegate override. 113 // net::URLFetcherDelegate override.
114 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 114 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
115 115
116 // Does the actual initialization using the request context specified for 116 // Does the actual initialization using the request context specified for
117 // |PrepareInitialization|. This will also fire any pending network requests. 117 // |PrepareInitialization|. This will also fire any pending network requests.
118 void Initialize(); 118 void Initialize();
119 119
120 // Starts a job. 120 // Starts a job.
121 void StartJob(DeviceManagementRequestJobImpl* job, bool bypass_proxy); 121 void StartJob(DeviceManagementRequestJobImpl* job, bool bypass_proxy);
122 122
123 // Adds a job. Caller must make sure the job pointer stays valid until the job 123 // Adds a job. Caller must make sure the job pointer stays valid until the job
(...skipping 22 matching lines...) Expand all
146 146
147 // Used to create tasks to run |Initialize| delayed on the UI thread. 147 // Used to create tasks to run |Initialize| delayed on the UI thread.
148 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; 148 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_;
149 149
150 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); 150 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService);
151 }; 151 };
152 152
153 } // namespace policy 153 } // namespace policy
154 154
155 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_ 155 #endif // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/sdch_dictionary_fetcher.h ('k') | chrome/browser/policy/testing_policy_url_fetcher_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698