OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 NetworkTimeUpdateCallback network_time_update_callback_; | 230 NetworkTimeUpdateCallback network_time_update_callback_; |
231 | 231 |
232 DISALLOW_COPY_AND_ASSIGN(HttpBridge); | 232 DISALLOW_COPY_AND_ASSIGN(HttpBridge); |
233 }; | 233 }; |
234 | 234 |
235 class SYNC_EXPORT HttpBridgeFactory : public HttpPostProviderFactory, | 235 class SYNC_EXPORT HttpBridgeFactory : public HttpPostProviderFactory, |
236 public CancelationObserver { | 236 public CancelationObserver { |
237 public: | 237 public: |
238 HttpBridgeFactory( | 238 HttpBridgeFactory( |
239 net::URLRequestContextGetter* baseline_context_getter, | 239 net::URLRequestContextGetter* baseline_context_getter, |
240 const NetworkTimeUpdateCallback& network_time_update_callback, | 240 const NetworkTimeUpdateCallback& network_time_update_callback); |
241 CancelationSignal* cancelation_signal); | |
242 virtual ~HttpBridgeFactory(); | 241 virtual ~HttpBridgeFactory(); |
243 | 242 |
244 // HttpPostProviderFactory: | 243 // HttpPostProviderFactory: |
245 virtual void Init(const std::string& user_agent) OVERRIDE; | 244 virtual void Init(const std::string& user_agent) OVERRIDE; |
| 245 virtual void RegisterCancelationSignal( |
| 246 CancelationSignal* cancelation_signal) OVERRIDE; |
246 virtual HttpPostProviderInterface* Create() OVERRIDE; | 247 virtual HttpPostProviderInterface* Create() OVERRIDE; |
247 virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE; | 248 virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE; |
248 | 249 |
249 // CancelationObserver implementation: | 250 // CancelationObserver implementation: |
250 virtual void OnSignalReceived() OVERRIDE; | 251 virtual void OnSignalReceived() OVERRIDE; |
251 | 252 |
252 private: | 253 private: |
253 // Protects |request_context_getter_| and |baseline_request_context_getter_|. | 254 // Protects |request_context_getter_| and |baseline_request_context_getter_|. |
254 base::Lock context_getter_lock_; | 255 base::Lock context_getter_lock_; |
255 | 256 |
256 // This request context is the starting point for the request_context_getter_ | 257 // This request context is the starting point for the request_context_getter_ |
257 // that we eventually use to make requests. During shutdown we must drop all | 258 // that we eventually use to make requests. During shutdown we must drop all |
258 // references to it before the ProfileSyncService's Shutdown() call is | 259 // references to it before the ProfileSyncService's Shutdown() call is |
259 // complete. | 260 // complete. |
260 scoped_refptr<net::URLRequestContextGetter> baseline_request_context_getter_; | 261 scoped_refptr<net::URLRequestContextGetter> baseline_request_context_getter_; |
261 | 262 |
262 // This request context is built on top of the baseline context and shares | 263 // This request context is built on top of the baseline context and shares |
263 // common components. Takes a reference to the | 264 // common components. Takes a reference to the |
264 // baseline_request_context_getter_. It's mostly used on sync thread when | 265 // baseline_request_context_getter_. It's mostly used on sync thread when |
265 // creating connection but is released as soon as possible during shutdown. | 266 // creating connection but is released as soon as possible during shutdown. |
266 // Protected by |context_getter_lock_|. | 267 // Protected by |context_getter_lock_|. |
267 scoped_refptr<HttpBridge::RequestContextGetter> request_context_getter_; | 268 scoped_refptr<HttpBridge::RequestContextGetter> request_context_getter_; |
268 | 269 |
269 NetworkTimeUpdateCallback network_time_update_callback_; | 270 NetworkTimeUpdateCallback network_time_update_callback_; |
270 | 271 |
271 CancelationSignal* const cancelation_signal_; | 272 CancelationSignal* cancelation_signal_; |
272 | 273 |
273 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); | 274 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); |
274 }; | 275 }; |
275 | 276 |
276 } // namespace syncer | 277 } // namespace syncer |
277 | 278 |
278 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ | 279 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ |
OLD | NEW |