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