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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "net/url_request/url_fetcher_delegate.h" | 17 #include "net/url_request/url_fetcher_delegate.h" |
18 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
19 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
20 #include "sync/base/sync_export.h" | 20 #include "sync/base/sync_export.h" |
21 #include "sync/internal_api/public/base/cancelation_observer.h" | 21 #include "sync/internal_api/public/base/cancelation_observer.h" |
22 #include "sync/internal_api/public/http_post_provider_factory.h" | 22 #include "sync/internal_api/public/http_post_provider_factory.h" |
23 #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" | 24 #include "sync/internal_api/public/network_time_update_callback.h" |
25 #include "third_party/zlib/zlib.h" | |
25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
26 | 27 |
27 class HttpBridgeTest; | 28 class HttpBridgeTest; |
28 | 29 |
29 namespace base { | 30 namespace base { |
30 class MessageLoop; | 31 class MessageLoop; |
31 } | 32 } |
32 | 33 |
33 namespace net { | 34 namespace net { |
34 class HttpResponseHeaders; | 35 class HttpResponseHeaders; |
35 class HttpUserAgentSettings; | 36 class HttpUserAgentSettings; |
36 class URLFetcher; | 37 class URLFetcher; |
37 class URLRequestJobFactory; | 38 class URLRequestJobFactory; |
38 } | 39 } |
39 | 40 |
40 namespace syncer { | 41 namespace syncer { |
41 | 42 |
43 // TODO: This two functions are copied from | |
Nicolas Zea
2015/07/30 19:59:44
TODO's should have an owner, and ideally reference
Gang Wu
2015/07/31 00:39:45
Done.
| |
44 // components/metrics/compression_utils.h, we copied them because if we | |
45 // reference them, we will get cycle dependency warning. so once the functions | |
Nicolas Zea
2015/07/30 19:59:44
nit: ". so once the" -> ". Once the"
Gang Wu
2015/07/31 00:39:45
Done.
| |
46 // have been moved from //component to //base, we can remove the following | |
47 // functions. | |
48 SYNC_EXPORT_PRIVATE bool GzipCompress(const std::string& input, | |
49 std::string* output); | |
50 | |
51 SYNC_EXPORT_PRIVATE bool GzipUncompress(const std::string& input, | |
Nicolas Zea
2015/07/30 19:59:44
Given this isn't actually used in HttpBridge, and
Gang Wu
2015/07/31 00:39:45
Done.
| |
52 std::string* output); | |
53 | |
42 class CancelationSignal; | 54 class CancelationSignal; |
43 | 55 |
44 // A bridge between the syncer and Chromium HTTP layers. | 56 // A bridge between the syncer and Chromium HTTP layers. |
45 // Provides a way for the sync backend to use Chromium directly for HTTP | 57 // Provides a way for the sync backend to use Chromium directly for HTTP |
46 // requests rather than depending on a third party provider (e.g libcurl). | 58 // requests rather than depending on a third party provider (e.g libcurl). |
47 // This is a one-time use bridge. Create one for each request you want to make. | 59 // This is a one-time use bridge. Create one for each request you want to make. |
48 // It is RefCountedThreadSafe because it can PostTask to the io loop, and thus | 60 // It is RefCountedThreadSafe because it can PostTask to the io loop, and thus |
49 // needs to stick around across context switches, etc. | 61 // needs to stick around across context switches, etc. |
50 class SYNC_EXPORT_PRIVATE HttpBridge | 62 class SYNC_EXPORT_PRIVATE HttpBridge |
51 : public base::RefCountedThreadSafe<HttpBridge>, | 63 : public base::RefCountedThreadSafe<HttpBridge>, |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 NetworkTimeUpdateCallback network_time_update_callback_; | 227 NetworkTimeUpdateCallback network_time_update_callback_; |
216 | 228 |
217 CancelationSignal* const cancelation_signal_; | 229 CancelationSignal* const cancelation_signal_; |
218 | 230 |
219 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); | 231 DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); |
220 }; | 232 }; |
221 | 233 |
222 } // namespace syncer | 234 } // namespace syncer |
223 | 235 |
224 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ | 236 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_H_ |
OLD | NEW |