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 /*
      7  * This file defines the trusted file IO interface
      8  */
      9 
     10 label Chrome {
     11   M14= 0.4
     12 };
     13 
     14 // Available only to trusted implementations.
     15 interface PPB_FileIOTrusted {
     16   /**
     17    * Returns a file descriptor corresponding to the given FileIO object. On
     18    * Windows, returns a HANDLE; on all other platforms, returns a POSIX file
     19    * descriptor. The FileIO object must have been opened with a successful
     20    * call to FileIO::Open.  The file descriptor will be closed automatically
     21    * when the FileIO object is closed or destroyed.
     22    *
     23    * TODO(hamaji): Remove this and use RequestOSFileHandle instead.
     24    */
     25   int32_t GetOSFileDescriptor([in] PP_Resource file_io);
     26 
     27   /**
     28    * Notifies the browser that underlying file will be modified.  This gives
     29    * the browser the opportunity to apply quota restrictions and possibly
     30    * return an error to indicate that the write is not allowed.
     31    */
     32   int32_t WillWrite([in] PP_Resource file_io,
     33                     [in] int64_t offset,
     34                     [in] int32_t bytes_to_write,
     35                     [in] PP_CompletionCallback callback);
     36 
     37   /**
     38    * Notifies the browser that underlying file will be modified.  This gives
     39    * the browser the opportunity to apply quota restrictions and possibly
     40    * return an error to indicate that the write is not allowed.
     41    *
     42    * TODO(darin): Maybe unify the above into a single WillChangeFileSize
     43    * method?  The above methods have the advantage of mapping to PPB_FileIO
     44    * Write and SetLength calls.  WillChangeFileSize would require the caller to
     45    * compute the file size resulting from a Write call, which may be
     46    * undesirable.
     47    */
     48   int32_t WillSetLength([in] PP_Resource file_io,
     49                         [in] int64_t length,
     50                         [in] PP_CompletionCallback callback);
     51 
     52 };
     53 
     54