/* Copyright (c) 2012 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. */ /** * This file defines the PPB_URLResponseInfo API for examining URL * responses. */ [generate_thunk] label Chrome { M14 = 1.0 }; /** * This enumeration contains properties set on a URL response. */ [assert_size(4)] enum PP_URLResponseProperty { /** * This corresponds to a string (PP_VARTYPE_STRING); an absolute URL formed by * resolving the relative request URL with the absolute document URL. Refer * to the * * HTTP Request URI and * * HTML Resolving Relative URIs documentation for further information. */ PP_URLRESPONSEPROPERTY_URL = 0, /** * This corresponds to a string (PP_VARTYPE_STRING); the absolute URL returned * in the response header's 'Location' field if this is a redirect response, * an empty string otherwise. Refer to the * * HTTP Status Codes - Redirection documentation for further information. */ PP_URLRESPONSEPROPERTY_REDIRECTURL = 1, /** * This corresponds to a string (PP_VARTYPE_STRING); the HTTP method to be * used in a new request if this is a redirect response, an empty string * otherwise. Refer to the * * HTTP Status Codes - Redirection documentation for further information. */ PP_URLRESPONSEPROPERTY_REDIRECTMETHOD = 2, /** * This corresponds to an int32 (PP_VARETYPE_INT32); the status code from the * response, e.g., 200 if the request was successful. Refer to the * * HTTP Status Code and Reason Phrase documentation for further * information. */ PP_URLRESPONSEPROPERTY_STATUSCODE = 3, /** * This corresponds to a string (PP_VARTYPE_STRING); the status line * from the response. Refer to the * * HTTP Response Status Line documentation for further information. */ PP_URLRESPONSEPROPERTY_STATUSLINE = 4, /** * This corresponds to a string(PP_VARTYPE_STRING), a \n-delimited list of * header field/value pairs of the form "field: value", returned by the * server. Refer to the * * HTTP Header Field Definitions documentation for further information. */ PP_URLRESPONSEPROPERTY_HEADERS = 5 }; /** * The PPB_URLResponseInfo interface contains APIs for * examining URL responses. Refer to PPB_URLLoader for further * information. */ interface PPB_URLResponseInfo { /** * IsURLResponseInfo() determines if a response is a * URLResponseInfo. * * @param[in] resource A PP_Resource corresponding to a * URLResponseInfo. * * @return PP_TRUE if the resource is a * URLResponseInfo, PP_FALSE if the resource is * invalid or some type other than URLResponseInfo. */ PP_Bool IsURLResponseInfo( [in] PP_Resource resource); /** * GetProperty() gets a response property. * * @param[in] request A PP_Resource corresponding to a * URLResponseInfo. * @param[in] property A PP_URLResponseProperty identifying * the type of property in the response. * * @return A PP_Var containing the response property value if * successful, PP_VARTYPE_VOID if an input parameter is invalid. */ PP_Var GetProperty( [in] PP_Resource response, [in] PP_URLResponseProperty property); /** * GetBodyAsFileRef() 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. * * @param[in] request A PP_Resource corresponding to a * URLResponseInfo. * * @return A PP_Resource corresponding to a FileRef * if successful, 0 if PP_URLREQUESTPROPERTY_STREAMTOFILE was * not requested or if the URLLoader has not been opened yet. */ PP_Resource GetBodyAsFileRef( [in] PP_Resource response); };