Home | History | Annotate | Download | only in fileapi
      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 // IPC messages for the file system.
      6 // Multiply-included message file, hence no include guard.
      7 
      8 #include "ipc/ipc_message_macros.h"
      9 #include "ipc/ipc_platform_file.h"
     10 #include "url/gurl.h"
     11 #include "webkit/common/fileapi/directory_entry.h"
     12 #include "webkit/common/fileapi/file_system_info.h"
     13 #include "webkit/common/fileapi/file_system_types.h"
     14 #include "webkit/common/quota/quota_types.h"
     15 
     16 #undef IPC_MESSAGE_EXPORT
     17 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
     18 #define IPC_MESSAGE_START FileSystemMsgStart
     19 
     20 IPC_STRUCT_TRAITS_BEGIN(fileapi::DirectoryEntry)
     21   IPC_STRUCT_TRAITS_MEMBER(name)
     22   IPC_STRUCT_TRAITS_MEMBER(is_directory)
     23 IPC_STRUCT_TRAITS_END()
     24 
     25 IPC_STRUCT_TRAITS_BEGIN(fileapi::FileSystemInfo)
     26   IPC_STRUCT_TRAITS_MEMBER(name)
     27   IPC_STRUCT_TRAITS_MEMBER(root_url)
     28   IPC_STRUCT_TRAITS_MEMBER(mount_type)
     29 IPC_STRUCT_TRAITS_END()
     30 
     31 IPC_ENUM_TRAITS(fileapi::FileSystemType)
     32 IPC_ENUM_TRAITS(quota::QuotaLimitType)
     33 
     34 // File system messages sent from the browser to the child process.
     35 
     36 // WebFrameClient::openFileSystem response messages.
     37 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidOpenFileSystem,
     38                      int /* request_id */,
     39                      std::string /* name */,
     40                      GURL /* root_url */)
     41 
     42 // WebFileSystem response messages.
     43 IPC_MESSAGE_CONTROL4(FileSystemMsg_DidResolveURL,
     44                      int /* request_id */,
     45                      fileapi::FileSystemInfo /* filesystem_info */,
     46                      base::FilePath /* file_path */,
     47                      bool /* is_directory */)
     48 IPC_MESSAGE_CONTROL1(FileSystemMsg_DidSucceed,
     49                      int /* request_id */)
     50 IPC_MESSAGE_CONTROL2(FileSystemMsg_DidReadMetadata,
     51                      int /* request_id */,
     52                      base::File::Info)
     53 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidCreateSnapshotFile,
     54                      int /* request_id */,
     55                      base::File::Info,
     56                      base::FilePath /* true platform path */)
     57 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidReadDirectory,
     58                      int /* request_id */,
     59                      std::vector<fileapi::DirectoryEntry> /* entries */,
     60                      bool /* has_more */)
     61 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidWrite,
     62                      int /* request_id */,
     63                      int64 /* byte count */,
     64                      bool /* complete */)
     65 IPC_MESSAGE_CONTROL4(FileSystemMsg_DidOpenFile,
     66                      int /* request_id */,
     67                      IPC::PlatformFileForTransit,
     68                      int /* file_open_id */,
     69                      quota::QuotaLimitType /* quota_policy */)
     70 IPC_MESSAGE_CONTROL2(FileSystemMsg_DidFail,
     71                      int /* request_id */,
     72                      base::File::Error /* error_code */)
     73 
     74 // File system messages sent from the child process to the browser.
     75 
     76 // WebFrameClient::openFileSystem() message.
     77 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_OpenFileSystem,
     78                      int /* request_id */,
     79                      GURL /* origin_url */,
     80                      fileapi::FileSystemType /* type */)
     81 
     82 // WevFrameClient::resolveURL() message.
     83 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ResolveURL,
     84                      int /* request_id */,
     85                      GURL /* filesystem_url */)
     86 
     87 // WebFrameClient::deleteFileSystem() message.
     88 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_DeleteFileSystem,
     89                      int /* request_id */,
     90                      GURL /* origin_url */,
     91                      fileapi::FileSystemType /* type */)
     92 
     93 // WebFileSystem::move() message.
     94 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Move,
     95                      int /* request_id */,
     96                      GURL /* src path */,
     97                      GURL /* dest path */)
     98 
     99 // WebFileSystem::copy() message.
    100 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Copy,
    101                      int /* request_id */,
    102                      GURL /* src path */,
    103                      GURL /* dest path */)
    104 
    105 // WebFileSystem::remove() message.
    106 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Remove,
    107                      int /* request_id */,
    108                      GURL /* path */,
    109                      bool /* recursive */)
    110 
    111 // WebFileSystem::readMetadata() message.
    112 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ReadMetadata,
    113                      int /* request_id */,
    114                      GURL /* path */)
    115 
    116 // WebFileSystem::create() message.
    117 IPC_MESSAGE_CONTROL5(FileSystemHostMsg_Create,
    118                      int /* request_id */,
    119                      GURL /* path */,
    120                      bool /* exclusive */,
    121                      bool /* is_directory */,
    122                      bool /* recursive */)
    123 
    124 // WebFileSystem::exists() messages.
    125 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Exists,
    126                      int /* request_id */,
    127                      GURL /* path */,
    128                      bool /* is_directory */)
    129 
    130 // WebFileSystem::readDirectory() message.
    131 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ReadDirectory,
    132                      int /* request_id */,
    133                      GURL /* path */)
    134 
    135 // WebFileWriter::write() message.
    136 IPC_MESSAGE_CONTROL4(FileSystemHostMsg_Write,
    137                      int /* request id */,
    138                      GURL /* file path */,
    139                      std::string /* blob uuid */,
    140                      int64 /* position */)
    141 
    142 // WebFileWriter::truncate() message.
    143 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Truncate,
    144                      int /* request id */,
    145                      GURL /* file path */,
    146                      int64 /* length */)
    147 
    148 // Pepper's Touch() message.
    149 IPC_MESSAGE_CONTROL4(FileSystemHostMsg_TouchFile,
    150                      int /* request_id */,
    151                      GURL /* path */,
    152                      base::Time /* last_access_time */,
    153                      base::Time /* last_modified_time */)
    154 
    155 // WebFileWriter::cancel() message.
    156 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CancelWrite,
    157                      int /* request id */,
    158                      int /* id of request to cancel */)
    159 
    160 // WebFileSystem::createSnapshotFileAndReadMetadata() message.
    161 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CreateSnapshotFile,
    162                      int /* request_id */,
    163                      GURL /* file_path */)
    164 
    165 // Renderers are expected to send this message after having processed
    166 // the FileSystemMsg_DidCreateSnapshotFile message. In particular,
    167 // after having created a BlobDataHandle backed by the snapshot file.
    168 IPC_MESSAGE_CONTROL1(FileSystemHostMsg_DidReceiveSnapshotFile,
    169                      int /* request_id */)
    170 
    171 // For Pepper's URL loader.
    172 IPC_SYNC_MESSAGE_CONTROL1_1(FileSystemHostMsg_SyncGetPlatformPath,
    173                             GURL /* file path */,
    174                             base::FilePath /* platform_path */)
    175