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
3 // found in the LICENSE file.
5 #ifndef PPAPI_THUNK_URL_LOADER_API_H_
6 #define PPAPI_THUNK_URL_LOADER_API_H_
8 #include "base/memory/ref_counted.h"
9 #include "ppapi/c/ppb_url_loader.h"
10 #include "ppapi/c/trusted/ppb_url_loader_trusted.h"
14 class TrackedCallback
;
15 struct URLRequestInfoData
;
19 class PPB_URLLoader_API
{
21 virtual ~PPB_URLLoader_API() {}
23 // Open given the resource ID of a PPB_URLRequestInfo resource.
24 virtual int32_t Open(PP_Resource request_id
,
25 scoped_refptr
<TrackedCallback
> callback
) = 0;
27 // Internal open given a URLRequestInfoData and requestor_pid, which
28 // indicates the process that requested and will consume the data.
29 // Pass 0 for requestor_pid to indicate the current process.
30 virtual int32_t Open(const URLRequestInfoData
& data
,
32 scoped_refptr
<TrackedCallback
> callback
) = 0;
34 virtual int32_t FollowRedirect(scoped_refptr
<TrackedCallback
> callback
) = 0;
35 virtual PP_Bool
GetUploadProgress(int64_t* bytes_sent
,
36 int64_t* total_bytes_to_be_sent
) = 0;
37 virtual PP_Bool
GetDownloadProgress(int64_t* bytes_received
,
38 int64_t* total_bytes_to_be_received
) = 0;
39 virtual PP_Resource
GetResponseInfo() = 0;
40 virtual int32_t ReadResponseBody(void* buffer
,
41 int32_t bytes_to_read
,
42 scoped_refptr
<TrackedCallback
> callback
) = 0;
43 virtual int32_t FinishStreamingToFile(
44 scoped_refptr
<TrackedCallback
> callback
) = 0;
45 virtual void Close() = 0;
48 virtual void GrantUniversalAccess() = 0;
49 virtual void SetStatusCallback(PP_URLLoaderTrusted_StatusCallback cb
) = 0;
55 #endif // PPAPI_THUNK_URL_LOADER_API_H_