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

Side by Side Diff: components/sync/core/http_bridge.h

Issue 2240613002: [Sync] Convert sync to a static library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try getting rid of sync_core source set. Created 4 years, 4 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 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 COMPONENTS_SYNC_CORE_HTTP_BRIDGE_H_ 5 #ifndef COMPONENTS_SYNC_CORE_HTTP_BRIDGE_H_
6 #define COMPONENTS_SYNC_CORE_HTTP_BRIDGE_H_ 6 #define COMPONENTS_SYNC_CORE_HTTP_BRIDGE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
20 #include "components/sync/base/cancelation_observer.h" 20 #include "components/sync/base/cancelation_observer.h"
21 #include "components/sync/base/sync_export.h"
22 #include "components/sync/core/http_post_provider_factory.h" 21 #include "components/sync/core/http_post_provider_factory.h"
23 #include "components/sync/core/http_post_provider_interface.h" 22 #include "components/sync/core/http_post_provider_interface.h"
24 #include "components/sync/core/network_time_update_callback.h" 23 #include "components/sync/core/network_time_update_callback.h"
25 #include "net/url_request/url_fetcher_delegate.h" 24 #include "net/url_request/url_fetcher_delegate.h"
26 #include "net/url_request/url_request_context.h" 25 #include "net/url_request/url_request_context.h"
27 #include "net/url_request/url_request_context_getter.h" 26 #include "net/url_request/url_request_context_getter.h"
28 #include "url/gurl.h" 27 #include "url/gurl.h"
29 28
30 class HttpBridgeTest; 29 class HttpBridgeTest;
31 30
32 namespace net { 31 namespace net {
33 class HttpResponseHeaders; 32 class HttpResponseHeaders;
34 class HttpUserAgentSettings; 33 class HttpUserAgentSettings;
35 class URLFetcher; 34 class URLFetcher;
36 class URLRequestJobFactory; 35 class URLRequestJobFactory;
37 } 36 }
38 37
39 namespace syncer { 38 namespace syncer {
40 39
41 class CancelationSignal; 40 class CancelationSignal;
42 41
43 // A bridge between the syncer and Chromium HTTP layers. 42 // A bridge between the syncer and Chromium HTTP layers.
44 // Provides a way for the sync backend to use Chromium directly for HTTP 43 // Provides a way for the sync backend to use Chromium directly for HTTP
45 // requests rather than depending on a third party provider (e.g libcurl). 44 // requests rather than depending on a third party provider (e.g libcurl).
46 // This is a one-time use bridge. Create one for each request you want to make. 45 // This is a one-time use bridge. Create one for each request you want to make.
47 // It is RefCountedThreadSafe because it can PostTask to the io loop, and thus 46 // It is RefCountedThreadSafe because it can PostTask to the io loop, and thus
48 // needs to stick around across context switches, etc. 47 // needs to stick around across context switches, etc.
49 class SYNC_EXPORT HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, 48 class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
50 public HttpPostProviderInterface, 49 public HttpPostProviderInterface,
51 public net::URLFetcherDelegate { 50 public net::URLFetcherDelegate {
52 public: 51 public:
53 HttpBridge(const std::string& user_agent, 52 HttpBridge(const std::string& user_agent,
54 const scoped_refptr<net::URLRequestContextGetter>& context, 53 const scoped_refptr<net::URLRequestContextGetter>& context,
55 const NetworkTimeUpdateCallback& network_time_update_callback, 54 const NetworkTimeUpdateCallback& network_time_update_callback,
56 const BindToTrackerCallback& bind_to_tracker_callback); 55 const BindToTrackerCallback& bind_to_tracker_callback);
57 56
58 // HttpPostProvider implementation. 57 // HttpPostProvider implementation.
59 void SetExtraRequestHeaders(const char* headers) override; 58 void SetExtraRequestHeaders(const char* headers) override;
60 void SetURL(const char* url, int port) override; 59 void SetURL(const char* url, int port) override;
61 void SetPostPayload(const char* content_type, 60 void SetPostPayload(const char* content_type,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Callback for updating network time. 179 // Callback for updating network time.
181 NetworkTimeUpdateCallback network_time_update_callback_; 180 NetworkTimeUpdateCallback network_time_update_callback_;
182 181
183 // A callback to tag Sync request to be able to record data use of this 182 // A callback to tag Sync request to be able to record data use of this
184 // service by data_use_measurement component. 183 // service by data_use_measurement component.
185 BindToTrackerCallback bind_to_tracker_callback_; 184 BindToTrackerCallback bind_to_tracker_callback_;
186 185
187 DISALLOW_COPY_AND_ASSIGN(HttpBridge); 186 DISALLOW_COPY_AND_ASSIGN(HttpBridge);
188 }; 187 };
189 188
190 class SYNC_EXPORT HttpBridgeFactory : public HttpPostProviderFactory, 189 class HttpBridgeFactory : public HttpPostProviderFactory,
191 public CancelationObserver { 190 public CancelationObserver {
192 public: 191 public:
193 HttpBridgeFactory( 192 HttpBridgeFactory(
194 const scoped_refptr<net::URLRequestContextGetter>& 193 const scoped_refptr<net::URLRequestContextGetter>&
195 baseline_context_getter, 194 baseline_context_getter,
196 const NetworkTimeUpdateCallback& network_time_update_callback, 195 const NetworkTimeUpdateCallback& network_time_update_callback,
197 CancelationSignal* cancelation_signal); 196 CancelationSignal* cancelation_signal);
198 ~HttpBridgeFactory() override; 197 ~HttpBridgeFactory() override;
199 198
200 // HttpPostProviderFactory: 199 // HttpPostProviderFactory:
201 void Init(const std::string& user_agent, 200 void Init(const std::string& user_agent,
(...skipping 22 matching lines...) Expand all
224 // A callback to tag Sync request to be able to record data use of this 223 // A callback to tag Sync request to be able to record data use of this
225 // service by data_use_measurement component. 224 // service by data_use_measurement component.
226 BindToTrackerCallback bind_to_tracker_callback_; 225 BindToTrackerCallback bind_to_tracker_callback_;
227 226
228 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); 227 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory);
229 }; 228 };
230 229
231 } // namespace syncer 230 } // namespace syncer
232 231
233 #endif // COMPONENTS_SYNC_CORE_HTTP_BRIDGE_H_ 232 #endif // COMPONENTS_SYNC_CORE_HTTP_BRIDGE_H_
OLDNEW
« no previous file with comments | « components/sync/core/delete_journal.h ('k') | components/sync/core/http_bridge_network_resources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698