Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Side by Side Diff: ppapi/c/dev/ppb_url_loader_dev.h

Issue 4310002: Make PPAPI headers compile with C compilers (gcc on Linux & Mac and MSVS on W... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/c/dev/ppb_transport_dev.h ('k') | ppapi/c/dev/ppb_url_request_info_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_C_DEV_PPB_URL_LOADER_DEV_H_ 5 #ifndef PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_
6 #define PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ 6 #define PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_
7 7
8 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/c/pp_instance.h" 9 #include "ppapi/c/pp_instance.h"
9 #include "ppapi/c/pp_resource.h" 10 #include "ppapi/c/pp_resource.h"
10 #include "ppapi/c/pp_stdint.h" 11 #include "ppapi/c/pp_stdint.h"
11 12
12 struct PP_CompletionCallback; 13 struct PP_CompletionCallback;
13 14
14 #define PPB_URLLOADER_DEV_INTERFACE "PPB_URLLoader(Dev);0.1" 15 #define PPB_URLLOADER_DEV_INTERFACE "PPB_URLLoader(Dev);0.2"
15 16
16 // The interface for loading URLs. 17 // The interface for loading URLs.
17 // 18 //
18 // Typical steps for loading an URL: 19 // Typical steps for loading an URL:
19 // 1- Create an URLLoader object. 20 // 1- Create an URLLoader object.
20 // 2- Create an URLRequestInfo object and set properties on it. 21 // 2- Create an URLRequestInfo object and set properties on it.
21 // 3- Call URLLoader's Open method passing the URLRequestInfo. 22 // 3- Call URLLoader's Open method passing the URLRequestInfo.
22 // 4- When Open completes, call GetResponseInfo to examine the response headers. 23 // 4- When Open completes, call GetResponseInfo to examine the response headers.
23 // 5- Then call ReadResponseBody to stream the data for the response. 24 // 5- Then call ReadResponseBody to stream the data for the response.
24 // 25 //
25 // Alternatively, if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the 26 // Alternatively, if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the
26 // URLRequestInfo, then call FinishStreamingToFile at step #5 to wait for the 27 // URLRequestInfo, then call FinishStreamingToFile at step #5 to wait for the
27 // downloaded file to be complete. The downloaded file may be accessed via the 28 // downloaded file to be complete. The downloaded file may be accessed via the
28 // GetBody method of the URLResponseInfo returned in step #4. 29 // GetBody method of the URLResponseInfo returned in step #4.
29 // 30 //
30 struct PPB_URLLoader_Dev { 31 struct PPB_URLLoader_Dev {
31 // Create a new URLLoader object. Returns 0 if the instance is invalid. The 32 // Create a new URLLoader object. Returns 0 if the instance is invalid. The
32 // URLLoader is associated with a particular instance, so that any UI dialogs 33 // URLLoader is associated with a particular instance, so that any UI dialogs
33 // that need to be shown to the user can be positioned relative to the window 34 // that need to be shown to the user can be positioned relative to the window
34 // containing the instance. It is also important for security reasons to 35 // containing the instance. It is also important for security reasons to
35 // know the origin of the URL request. 36 // know the origin of the URL request.
36 PP_Resource (*Create)(PP_Instance instance); 37 PP_Resource (*Create)(PP_Instance instance);
37 38
38 // Returns true if the given resource is an URLLoader. Returns false if the 39 // Returns PP_TRUE if the given resource is an URLLoader. Returns PP_FALSE if
39 // resource is invalid or some type other than an URLLoader. 40 // the resource is invalid or some type other than an URLLoader.
40 bool (*IsURLLoader)(PP_Resource resource); 41 PP_Bool (*IsURLLoader)(PP_Resource resource);
41 42
42 // Begins loading the URLRequestInfo. Completes when response headers are 43 // Begins loading the URLRequestInfo. Completes when response headers are
43 // received or when an error occurs. Use the GetResponseInfo method to 44 // received or when an error occurs. Use the GetResponseInfo method to
44 // access the response headers. 45 // access the response headers.
45 int32_t (*Open)(PP_Resource loader, 46 int32_t (*Open)(PP_Resource loader,
46 PP_Resource request_info, 47 PP_Resource request_info,
47 struct PP_CompletionCallback callback); 48 struct PP_CompletionCallback callback);
48 49
49 // If the current URLResponseInfo object corresponds to a redirect, then call 50 // If the current URLResponseInfo object corresponds to a redirect, then call
50 // this method to follow the redirect. 51 // this method to follow the redirect.
51 int32_t (*FollowRedirect)(PP_Resource loader, 52 int32_t (*FollowRedirect)(PP_Resource loader,
52 struct PP_CompletionCallback callback); 53 struct PP_CompletionCallback callback);
53 54
54 // Returns the current upload progress, which is meaningful after Open has 55 // Returns the current upload progress, which is meaningful after Open has
55 // been called. Progress only refers to the request body and does not include 56 // been called. Progress only refers to the request body and does not include
56 // the headers. 57 // the headers.
57 // 58 //
58 // This data is only available if the URLRequestInfo passed to Open() had the 59 // This data is only available if the URLRequestInfo passed to Open() had the
59 // PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS flag set to true. 60 // PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS flag set to PP_TRUE.
60 // 61 //
61 // This method returns false if upload progress is not available. 62 // This method returns PP_FALSE if upload progress is not available.
62 bool (*GetUploadProgress)(PP_Resource loader, 63 PP_Bool (*GetUploadProgress)(PP_Resource loader,
63 int64_t* bytes_sent, 64 int64_t* bytes_sent,
64 int64_t* total_bytes_to_be_sent); 65 int64_t* total_bytes_to_be_sent);
65 66
66 // Returns the current download progress, which is meaningful after Open has 67 // Returns the current download progress, which is meaningful after Open has
67 // been called. Progress only refers to the response body and does not 68 // been called. Progress only refers to the response body and does not
68 // include the headers. 69 // include the headers.
69 // 70 //
70 // This data is only available if the URLRequestInfo passed to Open() had the 71 // This data is only available if the URLRequestInfo passed to Open() had the
71 // PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS flag set to true. 72 // PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS flag set to PP_TRUE.
72 // 73 //
73 // The total bytes to be received may be unknown, in which case 74 // The total bytes to be received may be unknown, in which case
74 // total_bytes_to_be_received will be set to -1. This method returns false if 75 // total_bytes_to_be_received will be set to -1. This method returns PP_FALSE
75 // download progress is not available. 76 // if download progress is not available.
76 bool (*GetDownloadProgress)(PP_Resource loader, 77 PP_Bool (*GetDownloadProgress)(PP_Resource loader,
77 int64_t* bytes_received, 78 int64_t* bytes_received,
78 int64_t* total_bytes_to_be_received); 79 int64_t* total_bytes_to_be_received);
79 80
80 // Returns the current URLResponseInfo object. 81 // Returns the current URLResponseInfo object.
81 PP_Resource (*GetResponseInfo)(PP_Resource loader); 82 PP_Resource (*GetResponseInfo)(PP_Resource loader);
82 83
83 // Call this method to read the response body. The size of the buffer must 84 // Call this method to read the response body. The size of the buffer must
84 // be large enough to hold the specified number of bytes to read. May 85 // be large enough to hold the specified number of bytes to read. May
85 // perform a partial read. Returns the number of bytes read or an error 86 // perform a partial read. Returns the number of bytes read or an error
86 // code. 87 // code.
87 int32_t (*ReadResponseBody)(PP_Resource loader, 88 int32_t (*ReadResponseBody)(PP_Resource loader,
88 char* buffer, 89 char* buffer,
(...skipping 10 matching lines...) Expand all
99 // Cancels any IO that may be pending, and closes the URLLoader object. Any 100 // Cancels any IO that may be pending, and closes the URLLoader object. Any
100 // pending callbacks will still run, reporting PP_ERROR_ABORTED if pending IO 101 // pending callbacks will still run, reporting PP_ERROR_ABORTED if pending IO
101 // was interrupted. It is NOT valid to call Open again after a call to this 102 // was interrupted. It is NOT valid to call Open again after a call to this
102 // method. Note: If the URLLoader object is destroyed, and it is still open, 103 // method. Note: If the URLLoader object is destroyed, and it is still open,
103 // then it will be implicitly closed, so you are not required to call the 104 // then it will be implicitly closed, so you are not required to call the
104 // Close method. 105 // Close method.
105 void (*Close)(PP_Resource loader); 106 void (*Close)(PP_Resource loader);
106 }; 107 };
107 108
108 #endif // PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ 109 #endif // PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_
OLDNEW
« no previous file with comments | « ppapi/c/dev/ppb_transport_dev.h ('k') | ppapi/c/dev/ppb_url_request_info_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698