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