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