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 COMPONENTS_SYNC_CORE_HTTP_POST_PROVIDER_FACTORY_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_HTTP_POST_PROVIDER_FACTORY_H_ |
6 #define COMPONENTS_SYNC_CORE_HTTP_POST_PROVIDER_FACTORY_H_ | 6 #define COMPONENTS_SYNC_CORE_HTTP_POST_PROVIDER_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "components/sync/base/sync_export.h" | |
12 | 11 |
13 namespace net { | 12 namespace net { |
14 class URLFetcher; | 13 class URLFetcher; |
15 } | 14 } |
16 | 15 |
17 namespace syncer { | 16 namespace syncer { |
18 | 17 |
19 typedef base::Callback<void(net::URLFetcher*)> BindToTrackerCallback; | 18 typedef base::Callback<void(net::URLFetcher*)> BindToTrackerCallback; |
20 | 19 |
21 class HttpPostProviderInterface; | 20 class HttpPostProviderInterface; |
22 | 21 |
23 // A factory to create HttpPostProviders to hide details about the | 22 // A factory to create HttpPostProviders to hide details about the |
24 // implementations and dependencies. | 23 // implementations and dependencies. |
25 // A factory instance itself should be owned by whomever uses it to create | 24 // A factory instance itself should be owned by whomever uses it to create |
26 // HttpPostProviders. | 25 // HttpPostProviders. |
27 class SYNC_EXPORT HttpPostProviderFactory { | 26 class HttpPostProviderFactory { |
28 public: | 27 public: |
29 virtual ~HttpPostProviderFactory() {} | 28 virtual ~HttpPostProviderFactory() {} |
30 | 29 |
31 virtual void Init(const std::string& user_agent, | 30 virtual void Init(const std::string& user_agent, |
32 const BindToTrackerCallback& bind_to_tracker_callback) = 0; | 31 const BindToTrackerCallback& bind_to_tracker_callback) = 0; |
33 | 32 |
34 // Obtain a new HttpPostProviderInterface instance, owned by caller. | 33 // Obtain a new HttpPostProviderInterface instance, owned by caller. |
35 virtual HttpPostProviderInterface* Create() = 0; | 34 virtual HttpPostProviderInterface* Create() = 0; |
36 | 35 |
37 // When the interface is no longer needed (ready to be cleaned up), clients | 36 // When the interface is no longer needed (ready to be cleaned up), clients |
38 // must call Destroy(). | 37 // must call Destroy(). |
39 // This allows actual HttpPostProvider subclass implementations to be | 38 // This allows actual HttpPostProvider subclass implementations to be |
40 // reference counted, which is useful if a particular implementation uses | 39 // reference counted, which is useful if a particular implementation uses |
41 // multiple threads to serve network requests. | 40 // multiple threads to serve network requests. |
42 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 41 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
43 }; | 42 }; |
44 | 43 |
45 } // namespace syncer | 44 } // namespace syncer |
46 | 45 |
47 #endif // COMPONENTS_SYNC_CORE_HTTP_POST_PROVIDER_FACTORY_H_ | 46 #endif // COMPONENTS_SYNC_CORE_HTTP_POST_PROVIDER_FACTORY_H_ |
OLD | NEW |