[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / sync / internal_api / public / http_post_provider_factory.h
blobef6af9bbfc8e5b3039e2da253282588b67db8412
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.
5 #ifndef SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_FACTORY_H_
6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_FACTORY_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "sync/base/sync_export.h"
13 namespace net {
14 class URLFetcher;
17 namespace syncer {
19 typedef base::Callback<void(net::URLFetcher*)> BindToTrackerCallback;
21 class HttpPostProviderInterface;
23 // A factory to create HttpPostProviders to hide details about the
24 // implementations and dependencies.
25 // A factory instance itself should be owned by whomever uses it to create
26 // HttpPostProviders.
27 class SYNC_EXPORT HttpPostProviderFactory {
28 public:
29 virtual ~HttpPostProviderFactory() {}
31 virtual void Init(const std::string& user_agent,
32 const BindToTrackerCallback& bind_to_tracker_callback) = 0;
34 // Obtain a new HttpPostProviderInterface instance, owned by caller.
35 virtual HttpPostProviderInterface* Create() = 0;
37 // When the interface is no longer needed (ready to be cleaned up), clients
38 // must call Destroy().
39 // This allows actual HttpPostProvider subclass implementations to be
40 // reference counted, which is useful if a particular implementation uses
41 // multiple threads to serve network requests.
42 virtual void Destroy(HttpPostProviderInterface* http) = 0;
45 } // namespace syncer
47 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_FACTORY_H_