| 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 PPAPI_THUNK_URL_LOADER_API_H_ | 5 #ifndef PPAPI_THUNK_URL_LOADER_API_H_ |
| 6 #define PPAPI_THUNK_URL_LOADER_API_H_ | 6 #define PPAPI_THUNK_URL_LOADER_API_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "ppapi/c/ppb_url_loader.h" | 9 #include "ppapi/c/ppb_url_loader.h" |
| 10 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" | 10 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" |
| 11 | 11 |
| 12 namespace ppapi { | 12 namespace ppapi { |
| 13 | 13 |
| 14 class TrackedCallback; | 14 class TrackedCallback; |
| 15 struct URLRequestInfoData; |
| 15 | 16 |
| 16 namespace thunk { | 17 namespace thunk { |
| 17 | 18 |
| 18 class PPB_URLLoader_API { | 19 class PPB_URLLoader_API { |
| 19 public: | 20 public: |
| 20 virtual ~PPB_URLLoader_API() {} | 21 virtual ~PPB_URLLoader_API() {} |
| 21 | 22 |
| 23 // Open given the resource ID of a PPB_URLRequestInfo resource. |
| 22 virtual int32_t Open(PP_Resource request_id, | 24 virtual int32_t Open(PP_Resource request_id, |
| 23 scoped_refptr<TrackedCallback> callback) = 0; | 25 scoped_refptr<TrackedCallback> callback) = 0; |
| 26 |
| 27 // Internal open given a URLRequestInfoData. |
| 28 virtual int32_t Open(const URLRequestInfoData& data, |
| 29 scoped_refptr<TrackedCallback> callback) = 0; |
| 30 |
| 24 virtual int32_t FollowRedirect(scoped_refptr<TrackedCallback> callback) = 0; | 31 virtual int32_t FollowRedirect(scoped_refptr<TrackedCallback> callback) = 0; |
| 25 virtual PP_Bool GetUploadProgress(int64_t* bytes_sent, | 32 virtual PP_Bool GetUploadProgress(int64_t* bytes_sent, |
| 26 int64_t* total_bytes_to_be_sent) = 0; | 33 int64_t* total_bytes_to_be_sent) = 0; |
| 27 virtual PP_Bool GetDownloadProgress(int64_t* bytes_received, | 34 virtual PP_Bool GetDownloadProgress(int64_t* bytes_received, |
| 28 int64_t* total_bytes_to_be_received) = 0; | 35 int64_t* total_bytes_to_be_received) = 0; |
| 29 virtual PP_Resource GetResponseInfo() = 0; | 36 virtual PP_Resource GetResponseInfo() = 0; |
| 30 virtual int32_t ReadResponseBody(void* buffer, | 37 virtual int32_t ReadResponseBody(void* buffer, |
| 31 int32_t bytes_to_read, | 38 int32_t bytes_to_read, |
| 32 scoped_refptr<TrackedCallback> callback) = 0; | 39 scoped_refptr<TrackedCallback> callback) = 0; |
| 33 virtual int32_t FinishStreamingToFile( | 40 virtual int32_t FinishStreamingToFile( |
| 34 scoped_refptr<TrackedCallback> callback) = 0; | 41 scoped_refptr<TrackedCallback> callback) = 0; |
| 35 virtual void Close() = 0; | 42 virtual void Close() = 0; |
| 36 | 43 |
| 37 // Trusted API. | 44 // Trusted API. |
| 38 virtual void GrantUniversalAccess() = 0; | 45 virtual void GrantUniversalAccess() = 0; |
| 39 virtual void SetStatusCallback(PP_URLLoaderTrusted_StatusCallback cb) = 0; | 46 virtual void SetStatusCallback(PP_URLLoaderTrusted_StatusCallback cb) = 0; |
| 40 }; | 47 }; |
| 41 | 48 |
| 42 } // namespace thunk | 49 } // namespace thunk |
| 43 } // namespace ppapi | 50 } // namespace ppapi |
| 44 | 51 |
| 45 #endif // PPAPI_THUNK_URL_LOADER_API_H_ | 52 #endif // PPAPI_THUNK_URL_LOADER_API_H_ |
| OLD | NEW |