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

Side by Side Diff: components/policy/core/common/cloud/device_management_service.h

Issue 1902633006: Convert //components/policy from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and use namespace alias Created 4 years, 8 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
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 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <deque> 10 #include <deque>
11 #include <map> 11 #include <map>
12 #include <memory>
12 #include <string> 13 #include <string>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/callback.h" 16 #include "base/callback.h"
16 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/strings/string_split.h" 21 #include "base/strings/string_split.h"
22 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 22 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
23 #include "components/policy/policy_export.h" 23 #include "components/policy/policy_export.h"
24 #include "net/url_request/url_fetcher_delegate.h" 24 #include "net/url_request/url_fetcher_delegate.h"
25 #include "policy/proto/device_management_backend.pb.h" 25 #include "policy/proto/device_management_backend.pb.h"
26 26
27 27
28 namespace net { 28 namespace net {
29 class URLRequestContextGetter; 29 class URLRequestContextGetter;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // Server at which to contact the service. 123 // Server at which to contact the service.
124 virtual std::string GetServerUrl() = 0; 124 virtual std::string GetServerUrl() = 0;
125 125
126 // Agent reported in the "agent" query parameter. 126 // Agent reported in the "agent" query parameter.
127 virtual std::string GetAgentParameter() = 0; 127 virtual std::string GetAgentParameter() = 0;
128 128
129 // The platform reported in the "platform" query parameter. 129 // The platform reported in the "platform" query parameter.
130 virtual std::string GetPlatformParameter() = 0; 130 virtual std::string GetPlatformParameter() = 0;
131 }; 131 };
132 132
133 explicit DeviceManagementService(scoped_ptr<Configuration> configuration); 133 explicit DeviceManagementService(
134 std::unique_ptr<Configuration> configuration);
134 ~DeviceManagementService() override; 135 ~DeviceManagementService() override;
135 136
136 // The ID of URLFetchers created by the DeviceManagementService. This can be 137 // The ID of URLFetchers created by the DeviceManagementService. This can be
137 // used by tests that use a TestURLFetcherFactory to get the pending fetchers 138 // used by tests that use a TestURLFetcherFactory to get the pending fetchers
138 // created by the DeviceManagementService. 139 // created by the DeviceManagementService.
139 static const int kURLFetcherID; 140 static const int kURLFetcherID;
140 141
141 // Creates a new device management request job. Ownership is transferred to 142 // Creates a new device management request job. Ownership is transferred to
142 // the caller. 143 // the caller.
143 virtual DeviceManagementRequestJob* CreateJob( 144 virtual DeviceManagementRequestJob* CreateJob(
(...skipping 28 matching lines...) Expand all
172 // Adds a job. Caller must make sure the job pointer stays valid until the job 173 // Adds a job. Caller must make sure the job pointer stays valid until the job
173 // completes or gets canceled via RemoveJob(). 174 // completes or gets canceled via RemoveJob().
174 void AddJob(DeviceManagementRequestJobImpl* job); 175 void AddJob(DeviceManagementRequestJobImpl* job);
175 176
176 // Removes a job. The job will be removed and won't receive a completion 177 // Removes a job. The job will be removed and won't receive a completion
177 // callback. 178 // callback.
178 void RemoveJob(DeviceManagementRequestJobImpl* job); 179 void RemoveJob(DeviceManagementRequestJobImpl* job);
179 180
180 // A Configuration implementation that is used to obtain various parameters 181 // A Configuration implementation that is used to obtain various parameters
181 // used to talk to the device management server. 182 // used to talk to the device management server.
182 scoped_ptr<Configuration> configuration_; 183 std::unique_ptr<Configuration> configuration_;
183 184
184 // The jobs we currently have in flight. 185 // The jobs we currently have in flight.
185 JobFetcherMap pending_jobs_; 186 JobFetcherMap pending_jobs_;
186 187
187 // Jobs that are registered, but not started yet. 188 // Jobs that are registered, but not started yet.
188 JobQueue queued_jobs_; 189 JobQueue queued_jobs_;
189 190
190 // If this service is initialized, incoming requests get fired instantly. 191 // If this service is initialized, incoming requests get fired instantly.
191 // If it is not initialized, incoming requests are queued. 192 // If it is not initialized, incoming requests are queued.
192 bool initialized_; 193 bool initialized_;
193 194
194 // Used to create tasks to run |Initialize| delayed on the UI thread. 195 // Used to create tasks to run |Initialize| delayed on the UI thread.
195 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_; 196 base::WeakPtrFactory<DeviceManagementService> weak_ptr_factory_;
196 197
197 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService); 198 DISALLOW_COPY_AND_ASSIGN(DeviceManagementService);
198 }; 199 };
199 200
200 } // namespace policy 201 } // namespace policy
201 202
202 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_ 203 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_DEVICE_MANAGEMENT_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698