Home | History | Annotate | Download | only in shared_impl
      1 // Copyright 2013 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 #ifndef PPAPI_SHARED_IMPL_FILE_REF_CREATE_INFO_H
      6 #define PPAPI_SHARED_IMPL_FILE_REF_CREATE_INFO_H
      7 
      8 #include <string>
      9 
     10 #include "base/files/file_path.h"
     11 #include "ppapi/c/pp_file_info.h"
     12 #include "ppapi/c/pp_resource.h"
     13 #include "ppapi/shared_impl/ppapi_shared_export.h"
     14 
     15 namespace ppapi {
     16 
     17 // FileRefs are created in a number of places and they include a number of
     18 // return values. This struct encapsulates everything in one place.
     19 struct FileRefCreateInfo {
     20   FileRefCreateInfo()
     21       : file_system_type(PP_FILESYSTEMTYPE_INVALID),
     22         browser_pending_host_resource_id(0),
     23         renderer_pending_host_resource_id(0),
     24         file_system_plugin_resource(0) {}
     25 
     26   PPAPI_SHARED_EXPORT bool IsValid() const;
     27 
     28   PP_FileSystemType file_system_type;
     29   std::string internal_path;
     30   std::string display_name;
     31 
     32   // Used when a FileRef is created in the Renderer.
     33   int browser_pending_host_resource_id;
     34   int renderer_pending_host_resource_id;
     35 
     36   // Since FileRef needs to hold a FileSystem reference, we need to pass the
     37   // resource in this CreateInfo. This struct doesn't hold any refrence on the
     38   // file_system_plugin_resource.
     39   PP_Resource file_system_plugin_resource;
     40 };
     41 
     42 // Used in the renderer when sending a FileRefCreateInfo to a plugin for a
     43 // FileRef on an external filesystem.
     44 PPAPI_SHARED_EXPORT FileRefCreateInfo
     45     MakeExternalFileRefCreateInfo(const base::FilePath& external_path,
     46                                   const std::string& display_name,
     47                                   int browser_pending_host_resource_id,
     48                                   int renderer_pending_host_resource_id);
     49 
     50 }  // namespace ppapi
     51 
     52 #endif  // PPAPI_SHARED_IMPL_FILE_REF_CREATE_INFO_H
     53