Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: components/sync/core/http_post_provider_interface.h

Issue 2408463002: [Sync] Move network-related code from core/ to engine/net/. (Closed)
Patch Set: Use SyncServerConnectionManager instead of ServerConnectionManagerImpl. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_INTERFACE_H_
6 #define COMPONENTS_SYNC_CORE_HTTP_POST_PROVIDER_INTERFACE_H_
7
8 #include <string>
9
10 namespace syncer {
11
12 // An interface the embedding application (e.g. Chromium) implements to provide
13 // required HTTP POST functionality to the syncer backend. This interface is
14 // designed for one-time use. You create one, use it, and create another if you
15 // want to make a subsequent POST.
16 class HttpPostProviderInterface {
17 public:
18 // Add additional headers to the request.
19 virtual void SetExtraRequestHeaders(const char* headers) = 0;
20
21 // Set the URL to POST to.
22 virtual void SetURL(const char* url, int port) = 0;
23
24 // Set the type, length and content of the POST payload.
25 // |content_type| is a null-terminated MIME type specifier.
26 // |content| is a data buffer; Do not interpret as a null-terminated string.
27 // |content_length| is the total number of chars in |content|. It is used to
28 // assign/copy |content| data.
29 virtual void SetPostPayload(const char* content_type,
30 int content_length,
31 const char* content) = 0;
32
33 // Returns true if the URL request succeeded. If the request failed,
34 // error() may be non-zero and hence contain more information.
35 virtual bool MakeSynchronousPost(int* error_code, int* response_code) = 0;
36
37 // Get the length of the content returned in the HTTP response.
38 // This does not count the trailing null-terminating character returned
39 // by GetResponseContent, so it is analogous to calling string.length.
40 virtual int GetResponseContentLength() const = 0;
41
42 // Get the content returned in the HTTP response.
43 // This is a null terminated string of characters.
44 // Value should be copied.
45 virtual const char* GetResponseContent() const = 0;
46
47 // Get the value of a header returned in the HTTP response.
48 // If the header is not present, returns the empty string.
49 virtual const std::string GetResponseHeaderValue(
50 const std::string& name) const = 0;
51
52 // Abandon any pending POST and unblock caller in MakeSynchronousPost.
53 // This must be safe to call from any thread.
54 virtual void Abort() = 0;
55
56 protected:
57 virtual ~HttpPostProviderInterface() {}
58 };
59
60 } // namespace syncer
61
62 #endif // COMPONENTS_SYNC_CORE_HTTP_POST_PROVIDER_INTERFACE_H_
OLDNEW
« no previous file with comments | « components/sync/core/http_post_provider_factory.h ('k') | components/sync/core/network_resources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698