Home | History | Annotate | Download | only in trusted
      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.
      4  */
      5 
      6 /* From trusted/ppb_url_loader_trusted.idl modified Wed Oct  5 14:06:02 2011. */
      7 
      8 #ifndef PPAPI_C_TRUSTED_PPB_URL_LOADER_TRUSTED_H_
      9 #define PPAPI_C_TRUSTED_PPB_URL_LOADER_TRUSTED_H_
     10 
     11 #include "ppapi/c/pp_instance.h"
     12 #include "ppapi/c/pp_macros.h"
     13 #include "ppapi/c/pp_resource.h"
     14 #include "ppapi/c/pp_stdint.h"
     15 
     16 #define PPB_URLLOADERTRUSTED_INTERFACE_0_3 "PPB_URLLoaderTrusted;0.3"
     17 #define PPB_URLLOADERTRUSTED_INTERFACE PPB_URLLOADERTRUSTED_INTERFACE_0_3
     18 
     19 /**
     20  * @file
     21  * URL loader trusted interfaces. */
     22 
     23 
     24 /**
     25  * @addtogroup Typedefs
     26  * @{
     27  */
     28 /**
     29  * Callback that indicates the status of the download and upload for the
     30  * given URLLoader resource.
     31  */
     32 typedef void (*PP_URLLoaderTrusted_StatusCallback)(
     33     PP_Instance pp_instance,
     34     PP_Resource pp_resource,
     35     int64_t bytes_sent,
     36     int64_t total_bytes_to_be_sent,
     37     int64_t bytes_received,
     38     int64_t total_bytes_to_be_received);
     39 /**
     40  * @}
     41  */
     42 
     43 /**
     44  * @addtogroup Interfaces
     45  * @{
     46  */
     47 /* Available only to trusted implementations. */
     48 struct PPB_URLLoaderTrusted_0_3 {
     49   /**
     50    * Grant this URLLoader the capability to make unrestricted cross-origin
     51    * requests.
     52    */
     53   void (*GrantUniversalAccess)(PP_Resource loader);
     54   /**
     55    * Registers that the given function will be called when the upload or
     56    * downloaded byte count has changed. This is not exposed on the untrusted
     57    * interface because it can be quite chatty and encourages people to write
     58    * feedback UIs that update as frequently as the progress updates.
     59    *
     60    * The other serious gotcha with this callback is that the callback must not
     61    * mutate the URL loader or cause it to be destroyed.
     62    *
     63    * However, the proxy layer needs this information to push to the other
     64    * process, so we expose it here. Only one callback can be set per URL
     65    * Loader. Setting to a NULL callback will disable it.
     66    */
     67   void (*RegisterStatusCallback)(PP_Resource loader,
     68                                  PP_URLLoaderTrusted_StatusCallback cb);
     69 };
     70 
     71 typedef struct PPB_URLLoaderTrusted_0_3 PPB_URLLoaderTrusted;
     72 /**
     73  * @}
     74  */
     75 
     76 #endif  /* PPAPI_C_TRUSTED_PPB_URL_LOADER_TRUSTED_H_ */
     77 
     78