| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_INTERFACE_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_INTERFACE_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_INTERFACE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_INTERFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 namespace csync { | 11 namespace csync { |
| 12 | 12 |
| 13 // An interface the embedding application (e.g. Chromium) implements to provide | 13 // An interface the embedding application (e.g. Chromium) implements to provide |
| 14 // required HTTP POST functionality to the syncer backend. This interface is | 14 // required HTTP POST functionality to the syncer backend. This interface is |
| 15 // designed for one-time use. You create one, use it, and create another if you | 15 // designed for one-time use. You create one, use it, and create another if you |
| 16 // want to make a subsequent POST. | 16 // want to make a subsequent POST. |
| 17 class HttpPostProviderInterface { | 17 class HttpPostProviderInterface { |
| 18 public: | 18 public: |
| 19 // Use specified user agent string when POSTing. If not called a default UA | |
| 20 // may be used. | |
| 21 virtual void SetUserAgent(const char* user_agent) = 0; | |
| 22 | |
| 23 // Add additional headers to the request. | 19 // Add additional headers to the request. |
| 24 virtual void SetExtraRequestHeaders(const char* headers) = 0; | 20 virtual void SetExtraRequestHeaders(const char* headers) = 0; |
| 25 | 21 |
| 26 // Set the URL to POST to. | 22 // Set the URL to POST to. |
| 27 virtual void SetURL(const char* url, int port) = 0; | 23 virtual void SetURL(const char* url, int port) = 0; |
| 28 | 24 |
| 29 // Set the type, length and content of the POST payload. | 25 // Set the type, length and content of the POST payload. |
| 30 // |content_type| is a null-terminated MIME type specifier. | 26 // |content_type| is a null-terminated MIME type specifier. |
| 31 // |content| is a data buffer; Do not interpret as a null-terminated string. | 27 // |content| is a data buffer; Do not interpret as a null-terminated string. |
| 32 // |content_length| is the total number of chars in |content|. It is used to | 28 // |content_length| is the total number of chars in |content|. It is used to |
| (...skipping 25 matching lines...) Expand all Loading... |
| 58 // This must be safe to call from any thread. | 54 // This must be safe to call from any thread. |
| 59 virtual void Abort() = 0; | 55 virtual void Abort() = 0; |
| 60 | 56 |
| 61 protected: | 57 protected: |
| 62 virtual ~HttpPostProviderInterface() {} | 58 virtual ~HttpPostProviderInterface() {} |
| 63 }; | 59 }; |
| 64 | 60 |
| 65 } // namespace csync | 61 } // namespace csync |
| 66 | 62 |
| 67 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_INTERFACE_H_ | 63 #endif // SYNC_INTERNAL_API_PUBLIC_HTTP_POST_PROVIDER_INTERFACE_H_ |
| OLD | NEW |