diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 21:43:01 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 21:43:01 +0000 |
commit | 5a3f62856d89817d4117de189e855a6dad16c2ee (patch) | |
tree | a7df5acea5b54ea8ca795b0ba5a1dc90316d450e /ppapi/c/dev | |
parent | 7631cf8806adf505db4fed53210e27d2d1dd2cd0 (diff) | |
download | chromium_src-5a3f62856d89817d4117de189e855a6dad16c2ee.zip chromium_src-5a3f62856d89817d4117de189e855a6dad16c2ee.tar.gz chromium_src-5a3f62856d89817d4117de189e855a6dad16c2ee.tar.bz2 |
Move URLLoader, URLRequestInfo, and URLResponseInfo out of the dev directory
and rename accordingly.
Rename URLResponseInfo.GetBody to GetBodyAsFileRef.
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/4747001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65705 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/dev')
-rw-r--r-- | ppapi/c/dev/ppb_url_loader_dev.h | 109 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_url_loader_trusted_dev.h | 45 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_url_request_info_dev.h | 87 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_url_response_info_dev.h | 43 |
4 files changed, 0 insertions, 284 deletions
diff --git a/ppapi/c/dev/ppb_url_loader_dev.h b/ppapi/c/dev/ppb_url_loader_dev.h deleted file mode 100644 index c0c5fff..0000000 --- a/ppapi/c/dev/ppb_url_loader_dev.h +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ -#define PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" - -struct PP_CompletionCallback; - -#define PPB_URLLOADER_DEV_INTERFACE "PPB_URLLoader(Dev);0.2" - -// The interface for loading URLs. -// -// Typical steps for loading an URL: -// 1- Create an URLLoader object. -// 2- Create an URLRequestInfo object and set properties on it. -// 3- Call URLLoader's Open method passing the URLRequestInfo. -// 4- When Open completes, call GetResponseInfo to examine the response headers. -// 5- Then call ReadResponseBody to stream the data for the response. -// -// Alternatively, if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the -// URLRequestInfo, then call FinishStreamingToFile at step #5 to wait for the -// downloaded file to be complete. The downloaded file may be accessed via the -// GetBody method of the URLResponseInfo returned in step #4. -// -struct PPB_URLLoader_Dev { - // Create a new URLLoader object. Returns 0 if the instance is invalid. The - // URLLoader is associated with a particular instance, so that any UI dialogs - // that need to be shown to the user can be positioned relative to the window - // containing the instance. It is also important for security reasons to - // know the origin of the URL request. - PP_Resource (*Create)(PP_Instance instance); - - // Returns PP_TRUE if the given resource is an URLLoader. Returns PP_FALSE if - // the resource is invalid or some type other than an URLLoader. - PP_Bool (*IsURLLoader)(PP_Resource resource); - - // Begins loading the URLRequestInfo. Completes when response headers are - // received or when an error occurs. Use the GetResponseInfo method to - // access the response headers. - int32_t (*Open)(PP_Resource loader, - PP_Resource request_info, - struct PP_CompletionCallback callback); - - // If the current URLResponseInfo object corresponds to a redirect, then call - // this method to follow the redirect. - int32_t (*FollowRedirect)(PP_Resource loader, - struct PP_CompletionCallback callback); - - // Returns the current upload progress, which is meaningful after Open has - // been called. Progress only refers to the request body and does not include - // the headers. - // - // This data is only available if the URLRequestInfo passed to Open() had the - // PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS flag set to PP_TRUE. - // - // This method returns PP_FALSE if upload progress is not available. - PP_Bool (*GetUploadProgress)(PP_Resource loader, - int64_t* bytes_sent, - int64_t* total_bytes_to_be_sent); - - // Returns the current download progress, which is meaningful after Open has - // been called. Progress only refers to the response body and does not - // include the headers. - // - // This data is only available if the URLRequestInfo passed to Open() had the - // PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS flag set to PP_TRUE. - // - // The total bytes to be received may be unknown, in which case - // total_bytes_to_be_received will be set to -1. This method returns PP_FALSE - // if download progress is not available. - PP_Bool (*GetDownloadProgress)(PP_Resource loader, - int64_t* bytes_received, - int64_t* total_bytes_to_be_received); - - // Returns the current URLResponseInfo object. - PP_Resource (*GetResponseInfo)(PP_Resource loader); - - // Call this method to read the response body. The size of the buffer must - // be large enough to hold the specified number of bytes to read. May - // perform a partial read. Returns the number of bytes read or an error - // code. - int32_t (*ReadResponseBody)(PP_Resource loader, - char* buffer, - int32_t bytes_to_read, - struct PP_CompletionCallback callback); - - // If PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the URLRequestInfo passed - // to the Open method, then this method may be used to wait for the response - // body to be completely downloaded to the file provided by URLResponseInfo's - // GetBody method. - int32_t (*FinishStreamingToFile)(PP_Resource loader, - struct PP_CompletionCallback callback); - - // Cancels any IO that may be pending, and closes the URLLoader object. Any - // pending callbacks will still run, reporting PP_ERROR_ABORTED if pending IO - // was interrupted. It is NOT valid to call Open again after a call to this - // method. Note: If the URLLoader object is destroyed, and it is still open, - // then it will be implicitly closed, so you are not required to call the - // Close method. - void (*Close)(PP_Resource loader); -}; - -#endif // PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ diff --git a/ppapi/c/dev/ppb_url_loader_trusted_dev.h b/ppapi/c/dev/ppb_url_loader_trusted_dev.h deleted file mode 100644 index 84aff0e..0000000 --- a/ppapi/c/dev/ppb_url_loader_trusted_dev.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PPAPI_C_DEV_PPB_URL_LOADER_TRUSTED_DEV_H_ -#define PPAPI_C_DEV_PPB_URL_LOADER_TRUSTED_DEV_H_ - -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" - -#define PPB_URLLOADERTRUSTED_DEV_INTERFACE "PPB_URLLoaderTrusted(Dev);0.2" - -// Callback that indicates the status of the download and upload for the -// given URLLoader resource. -typedef void (*PP_URLLoaderTrusted_StatusCallback)( - PP_Instance pp_instance, - PP_Resource pp_resource, - int64_t bytes_sent, - int64_t total_bytes_to_be_sent, - int64_t bytes_received, - int64_t total_bytes_to_be_received); - -// Available only to trusted implementations. -struct PPB_URLLoaderTrusted_Dev { - // Grant this URLLoader the capability to make unrestricted cross-origin - // requests. - void (*GrantUniversalAccess)(PP_Resource loader); - - // Registers that the given function will be called when the upload or - // downloaded byte count has changed. This is not exposed on the untrusted - // interface because it can be quite chatty and encourages people to write - // feedback UIs that update as frequently as the progress updates. - // - // The other serious gotcha with this callback is that the callback must not - // mutate the URL loader or cause it to be destroyed. - // - // However, the proxy layer needs this information to push to the other - // process, so we expose it here. Only one callback can be set per URL - // Loader. Setting to a NULL callback will disable it. - void (*RegisterStatusCallback)(PP_Resource loader, - PP_URLLoaderTrusted_StatusCallback cb); -}; - -#endif // PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ diff --git a/ppapi/c/dev/ppb_url_request_info_dev.h b/ppapi/c/dev/ppb_url_request_info_dev.h deleted file mode 100644 index 26c6b2e..0000000 --- a/ppapi/c/dev/ppb_url_request_info_dev.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PPAPI_C_DEV_PPB_URL_REQUEST_INFO_DEV_H_ -#define PPAPI_C_DEV_PPB_URL_REQUEST_INFO_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_module.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" -#include "ppapi/c/pp_time.h" - -struct PP_Var; - -typedef enum { - PP_URLREQUESTPROPERTY_URL, // string - PP_URLREQUESTPROPERTY_METHOD, // string - PP_URLREQUESTPROPERTY_HEADERS, // string, \n-delim - PP_URLREQUESTPROPERTY_STREAMTOFILE, // PP_Bool (default=PP_FALSE) - PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS, // PP_Bool (default=PP_TRUE) - - // Set to true if you want to be able to poll the download progress via the - // URLLoader.GetDownloadProgress function. - // - // Boolean (default = PP_FALSE). - PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS, - - // Set to true if you want to be able to pull the upload progress via the - // URLLoader.GetUploadProgress function. - // - // Boolean (default = PP_FALSE). - PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS - - // TODO(darin): Add security/privacy options? -} PP_URLRequestProperty_Dev; - -#define PPB_URLREQUESTINFO_DEV_INTERFACE "PPB_URLRequestInfo(Dev);0.2" - -struct PPB_URLRequestInfo_Dev { - // Create a new URLRequestInfo object. Returns 0 if the module is invalid. - PP_Resource (*Create)(PP_Module module); - - // Returns PP_TRUE if the given resource is an URLRequestInfo. Returns - // PP_FALSE if the resource is invalid or some type other than an - // URLRequestInfo. - PP_Bool (*IsURLRequestInfo)(PP_Resource resource); - - // Sets a request property. Returns PP_FALSE if any of the parameters are - // invalid, PP_TRUE on success. The value property must be the correct type - // according to the property being set. - PP_Bool (*SetProperty)(PP_Resource request, - PP_URLRequestProperty_Dev property, - struct PP_Var value); - - // Append data to the request body. - // - // A Content-Length request header will be automatically generated. - // - // Returns PP_FALSE if any of the parameters are invalid, PP_TRUE on success. - PP_Bool (*AppendDataToBody)(PP_Resource request, - const char* data, - uint32_t len); - - // Append a file reference to be uploaded. - // - // A sub-range of the file starting from start_offset may be specified. If - // number_of_bytes is -1, then the sub-range to upload extends to the end of - // the file. - // - // An optional (non-zero) last modified time stamp may be provided, which - // will be used to validate that the file was not modified since the given - // time before it is uploaded. The upload will fail with an error code of - // PP_Error_FileChanged if the file has been modified since the given time. - // If expected_last_modified_time is 0, then no validation is performed. - // - // A Content-Length request header will be automatically generated. - // - // Returns PP_FALSE if any of the parameters are invalid, PP_TRUE on success. - PP_Bool (*AppendFileToBody)(PP_Resource request, - PP_Resource file_ref, - int64_t start_offset, - int64_t number_of_bytes, - PP_Time expected_last_modified_time); -}; - -#endif // PPAPI_C_DEV_PPB_URL_REQUEST_INFO_DEV_H_ diff --git a/ppapi/c/dev/ppb_url_response_info_dev.h b/ppapi/c/dev/ppb_url_response_info_dev.h deleted file mode 100644 index e1307f5..0000000 --- a/ppapi/c/dev/ppb_url_response_info_dev.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PPAPI_C_DEV_PPB_URL_RESPONSE_INFO_DEV_H_ -#define PPAPI_C_DEV_PPB_URL_RESPONSE_INFO_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_var.h" - -typedef enum { - PP_URLRESPONSEPROPERTY_URL, // string - PP_URLRESPONSEPROPERTY_REDIRECTURL, // string - PP_URLRESPONSEPROPERTY_REDIRECTMETHOD, // string - PP_URLRESPONSEPROPERTY_STATUSCODE, // int32 - PP_URLRESPONSEPROPERTY_STATUSLINE, // string - PP_URLRESPONSEPROPERTY_HEADERS // string, \n-delim -} PP_URLResponseProperty_Dev; - -#define PPB_URLRESPONSEINFO_DEV_INTERFACE "PPB_URLResponseInfo(Dev);0.2" - -struct PPB_URLResponseInfo_Dev { - // Returns PP_TRUE if the given resource is an URLResponseInfo. Returns - // PP_FALSE if the resource is invalid or some type other than an - // URLResponseInfo. - PP_Bool (*IsURLResponseInfo)(PP_Resource resource); - - // Gets a response property. Return PP_VarType_Void if an input parameter is - // invalid. - struct PP_Var (*GetProperty)(PP_Resource response, - PP_URLResponseProperty_Dev property); - - // Returns a FileRef pointing to the file containing the response body. This - // is only valid if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the - // URLRequestInfo used to produce this response. This file remains valid - // until the URLLoader associated with this URLResponseInfo is closed or - // destroyed. Returns 0 if PP_URLREQUESTPROPERTY_STREAMTOFILE was not - // requested or if the URLLoader has not been opened yet. - PP_Resource (*GetBody)(PP_Resource response); -}; - -#endif // PPAPI_C_DEV_PPB_URL_RESPONSE_INFO_DEV_H_ |