summaryrefslogtreecommitdiffstats
path: root/ppapi/c/ppb_url_response_info.h
blob: 48ab33e10fd4508a48fa7b9880849f01712eecfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* 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_PPB_URL_RESPONSE_INFO_H_
#define PPAPI_C_PPB_URL_RESPONSE_INFO_H_

#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"

/**
 *
 * @addtogroup Enums
 * @{
 */
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;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLResponseProperty, 4);
/**
 * @}
 */

#define PPB_URLRESPONSEINFO_INTERFACE "PPB_URLResponseInfo;0.1"

/**
 * @file
 * Defines the API ...
 */

/**
 *
 * @addtogroup Interfaces
 * @{
 */
struct PPB_URLResponseInfo {
  // 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 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 (*GetBodyAsFileRef)(PP_Resource response);
};
/**
 * @}
 */

#endif  /* PPAPI_C_PPB_URL_RESPONSE_INFO_H_ */