OLD | NEW |
1 // Copyright (c) 2011 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 "ppapi/c/ppb_url_loader.h" | 9 #include "ppapi/c/ppb_url_loader.h" |
9 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" | 10 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" |
10 | 11 |
11 namespace ppapi { | 12 namespace ppapi { |
| 13 |
| 14 class TrackedCallback; |
| 15 |
12 namespace thunk { | 16 namespace thunk { |
13 | 17 |
14 class PPB_URLLoader_API { | 18 class PPB_URLLoader_API { |
15 public: | 19 public: |
16 virtual ~PPB_URLLoader_API() {} | 20 virtual ~PPB_URLLoader_API() {} |
17 | 21 |
18 virtual int32_t Open(PP_Resource request_id, | 22 virtual int32_t Open(PP_Resource request_id, |
19 PP_CompletionCallback callback) = 0; | 23 scoped_refptr<TrackedCallback> callback) = 0; |
20 virtual int32_t FollowRedirect(PP_CompletionCallback callback) = 0; | 24 virtual int32_t FollowRedirect(scoped_refptr<TrackedCallback> callback) = 0; |
21 virtual PP_Bool GetUploadProgress(int64_t* bytes_sent, | 25 virtual PP_Bool GetUploadProgress(int64_t* bytes_sent, |
22 int64_t* total_bytes_to_be_sent) = 0; | 26 int64_t* total_bytes_to_be_sent) = 0; |
23 virtual PP_Bool GetDownloadProgress(int64_t* bytes_received, | 27 virtual PP_Bool GetDownloadProgress(int64_t* bytes_received, |
24 int64_t* total_bytes_to_be_received) = 0; | 28 int64_t* total_bytes_to_be_received) = 0; |
25 virtual PP_Resource GetResponseInfo() = 0; | 29 virtual PP_Resource GetResponseInfo() = 0; |
26 virtual int32_t ReadResponseBody(void* buffer, | 30 virtual int32_t ReadResponseBody(void* buffer, |
27 int32_t bytes_to_read, | 31 int32_t bytes_to_read, |
28 PP_CompletionCallback callback) = 0; | 32 scoped_refptr<TrackedCallback> callback) = 0; |
29 virtual int32_t FinishStreamingToFile(PP_CompletionCallback callback) = 0; | 33 virtual int32_t FinishStreamingToFile( |
| 34 scoped_refptr<TrackedCallback> callback) = 0; |
30 virtual void Close() = 0; | 35 virtual void Close() = 0; |
31 | 36 |
32 // Trusted API. | 37 // Trusted API. |
33 virtual void GrantUniversalAccess() = 0; | 38 virtual void GrantUniversalAccess() = 0; |
34 virtual void SetStatusCallback(PP_URLLoaderTrusted_StatusCallback cb) = 0; | 39 virtual void SetStatusCallback(PP_URLLoaderTrusted_StatusCallback cb) = 0; |
35 }; | 40 }; |
36 | 41 |
37 } // namespace thunk | 42 } // namespace thunk |
38 } // namespace ppapi | 43 } // namespace ppapi |
39 | 44 |
40 #endif // PPAPI_THUNK_URL_LOADER_API_H_ | 45 #endif // PPAPI_THUNK_URL_LOADER_API_H_ |
OLD | NEW |