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

Side by Side Diff: sync/internal_api/public/http_bridge.h

Issue 73723006: Allow customization of HttpPostProviderFactory via ProfileSyncService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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 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"
11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
14 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
15 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
16 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
17 #include "net/base/network_time_notifier.h" 16 #include "net/base/network_time_notifier.h"
18 #include "net/url_request/url_fetcher_delegate.h" 17 #include "net/url_request/url_fetcher_delegate.h"
19 #include "net/url_request/url_request_context.h" 18 #include "net/url_request/url_request_context.h"
20 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
21 #include "sync/base/sync_export.h" 20 #include "sync/base/sync_export.h"
22 #include "sync/internal_api/public/base/cancelation_observer.h" 21 #include "sync/internal_api/public/base/cancelation_observer.h"
23 #include "sync/internal_api/public/http_post_provider_factory.h" 22 #include "sync/internal_api/public/http_post_provider_factory.h"
24 #include "sync/internal_api/public/http_post_provider_interface.h" 23 #include "sync/internal_api/public/http_post_provider_interface.h"
24 #include "sync/internal_api/public/network_time_update_callback.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 class HttpBridgeTest; 27 class HttpBridgeTest;
28 28
29 namespace base { 29 namespace base {
30 class MessageLoop; 30 class MessageLoop;
31 } 31 }
32 32
33 namespace net { 33 namespace net {
34 class HttpResponseHeaders; 34 class HttpResponseHeaders;
35 class HttpUserAgentSettings; 35 class HttpUserAgentSettings;
36 class URLFetcher; 36 class URLFetcher;
37 } 37 }
38 38
39 namespace syncer { 39 namespace syncer {
40 40
41 class CancelationSignal; 41 class CancelationSignal;
42 42
43 // Callback for updating the network time.
44 // Params:
45 // const base::Time& network_time - the new network time.
46 // const base::TimeDelta& resolution - how precise the reading is.
47 // const base::TimeDelta& latency - the http request's latency.
48 typedef base::Callback<void(const base::Time&,
49 const base::TimeDelta&,
50 const base::TimeDelta&)> NetworkTimeUpdateCallback;
51
52 // A bridge between the syncer and Chromium HTTP layers. 43 // A bridge between the syncer and Chromium HTTP layers.
53 // Provides a way for the sync backend to use Chromium directly for HTTP 44 // Provides a way for the sync backend to use Chromium directly for HTTP
54 // requests rather than depending on a third party provider (e.g libcurl). 45 // requests rather than depending on a third party provider (e.g libcurl).
55 // This is a one-time use bridge. Create one for each request you want to make. 46 // This is a one-time use bridge. Create one for each request you want to make.
56 // It is RefCountedThreadSafe because it can PostTask to the io loop, and thus 47 // It is RefCountedThreadSafe because it can PostTask to the io loop, and thus
57 // needs to stick around across context switches, etc. 48 // needs to stick around across context switches, etc.
58 class SYNC_EXPORT_PRIVATE HttpBridge 49 class SYNC_EXPORT_PRIVATE HttpBridge
59 : public base::RefCountedThreadSafe<HttpBridge>, 50 : public base::RefCountedThreadSafe<HttpBridge>,
60 public HttpPostProviderInterface, 51 public HttpPostProviderInterface,
61 public net::URLFetcherDelegate { 52 public net::URLFetcherDelegate {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 NetworkTimeUpdateCallback network_time_update_callback_; 260 NetworkTimeUpdateCallback network_time_update_callback_;
270 261
271 CancelationSignal* const cancelation_signal_; 262 CancelationSignal* const cancelation_signal_;
272 263
273 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); 264 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory);
274 }; 265 };
275 266
276 } // namespace syncer 267 } // namespace syncer
277 268
278 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ 269 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698