Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_INTERNAL_API_HTTP_POST_PROVIDER_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_INTERNAL_API_HTTP_POST_PROVIDER_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_SYNC_INTERNAL_API_HTTP_POST_PROVIDER_INTERFACE_H_ | 6 #define CHROME_BROWSER_SYNC_INTERNAL_API_HTTP_POST_PROVIDER_INTERFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 // Set the type, length and content of the POST payload. | 31 // Set the type, length and content of the POST payload. |
| 32 // |content_type| is a null-terminated MIME type specifier. | 32 // |content_type| is a null-terminated MIME type specifier. |
| 33 // |content| is a data buffer; Do not interpret as a null-terminated string. | 33 // |content| is a data buffer; Do not interpret as a null-terminated string. |
| 34 // |content_length| is the total number of chars in |content|. It is used to | 34 // |content_length| is the total number of chars in |content|. It is used to |
| 35 // assign/copy |content| data. | 35 // assign/copy |content| data. |
| 36 virtual void SetPostPayload(const char* content_type, | 36 virtual void SetPostPayload(const char* content_type, |
| 37 int content_length, | 37 int content_length, |
| 38 const char* content) = 0; | 38 const char* content) = 0; |
| 39 | 39 |
| 40 // Returns true if the URL request succeeded. If the request failed, | 40 // Returns true if the URL request succeeded. If the request failed, |
| 41 // os_error() may be non-zero and hence contain more information. | 41 // error() may be non-zero and hence contain more information. |
|
cbentzel
2011/09/08 01:35:01
This is probably incorrect - I'm guessing os_error
tfarina
2011/09/08 11:19:27
Done.
| |
| 42 virtual bool MakeSynchronousPost(int* os_error_code, int* response_code) = 0; | 42 virtual bool MakeSynchronousPost(int* os_error_code, int* response_code) = 0; |
| 43 | 43 |
| 44 // Get the length of the content returned in the HTTP response. | 44 // Get the length of the content returned in the HTTP response. |
| 45 // This does not count the trailing null-terminating character returned | 45 // This does not count the trailing null-terminating character returned |
| 46 // by GetResponseContent, so it is analogous to calling string.length. | 46 // by GetResponseContent, so it is analogous to calling string.length. |
| 47 virtual int GetResponseContentLength() const = 0; | 47 virtual int GetResponseContentLength() const = 0; |
| 48 | 48 |
| 49 // Get the content returned in the HTTP response. | 49 // Get the content returned in the HTTP response. |
| 50 // This is a null terminated string of characters. | 50 // This is a null terminated string of characters. |
| 51 // Value should be copied. | 51 // Value should be copied. |
| 52 virtual const char* GetResponseContent() const = 0; | 52 virtual const char* GetResponseContent() const = 0; |
| 53 | 53 |
| 54 // Get the value of a header returned in the HTTP response. | 54 // Get the value of a header returned in the HTTP response. |
| 55 // If the header is not present, returns the empty string. | 55 // If the header is not present, returns the empty string. |
| 56 virtual const std::string GetResponseHeaderValue( | 56 virtual const std::string GetResponseHeaderValue( |
| 57 const std::string& name) const = 0; | 57 const std::string& name) const = 0; |
| 58 | 58 |
| 59 // Abandon any pending POST and unblock caller in MakeSynchronousPost. | 59 // Abandon any pending POST and unblock caller in MakeSynchronousPost. |
| 60 // This must be safe to call from any thread. | 60 // This must be safe to call from any thread. |
| 61 virtual void Abort() = 0; | 61 virtual void Abort() = 0; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace sync_api | 64 } // namespace sync_api |
| 65 | 65 |
| 66 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_HTTP_POST_PROVIDER_INTERFACE_H_ | 66 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_HTTP_POST_PROVIDER_INTERFACE_H_ |
| OLD | NEW |