Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/common/file_system/file_system_dispatcher.h

Issue 3394003: Add Worker support for FileSystem API. (Closed)
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/file_system/file_system_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ 5 #ifndef CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_
6 #define CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ 6 #define CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/file_util_proxy.h" 11 #include "base/file_util_proxy.h"
12 #include "base/id_map.h" 12 #include "base/id_map.h"
13 #include "base/nullable_string16.h"
14 #include "googleurl/src/gurl.h"
15 #include "ipc/ipc_channel.h" 13 #include "ipc/ipc_channel.h"
16 #include "ipc/ipc_message.h" 14 #include "ipc/ipc_message.h"
17 #include "webkit/fileapi/file_system_callback_dispatcher.h" 15 #include "webkit/fileapi/file_system_callback_dispatcher.h"
16 #include "webkit/fileapi/file_system_types.h"
18 17
19 namespace base { 18 namespace base {
20 struct PlatformFileInfo; 19 struct PlatformFileInfo;
21 } 20 }
22 21
23 class FilePath; 22 class FilePath;
23 class GURL;
24 24
25 // Dispatches and sends file system related messages sent to/from a child 25 // Dispatches and sends file system related messages sent to/from a child
26 // process from/to the main browser process. There is one instance 26 // process from/to the main browser process. There is one instance
27 // per child process. Messages are dispatched on the main child thread. 27 // per child process. Messages are dispatched on the main child thread.
28 class FileSystemDispatcher { 28 class FileSystemDispatcher {
29 public: 29 public:
30 FileSystemDispatcher(); 30 FileSystemDispatcher();
31 ~FileSystemDispatcher(); 31 ~FileSystemDispatcher();
32 32
33 bool OnMessageReceived(const IPC::Message& msg); 33 bool OnMessageReceived(const IPC::Message& msg);
34 34
35 void OpenFileSystem(const GURL& origin_url,
36 fileapi::FileSystemType type,
37 long long size,
38 fileapi::FileSystemCallbackDispatcher* dispatcher);
35 bool Move(const FilePath& src_path, 39 bool Move(const FilePath& src_path,
36 const FilePath& dest_path, 40 const FilePath& dest_path,
37 fileapi::FileSystemCallbackDispatcher* dispatcher); 41 fileapi::FileSystemCallbackDispatcher* dispatcher);
38 bool Copy(const FilePath& src_path, 42 bool Copy(const FilePath& src_path,
39 const FilePath& dest_path, 43 const FilePath& dest_path,
40 fileapi::FileSystemCallbackDispatcher* dispatcher); 44 fileapi::FileSystemCallbackDispatcher* dispatcher);
41 bool Remove(const FilePath& path, 45 bool Remove(const FilePath& path,
42 fileapi::FileSystemCallbackDispatcher* dispatcher); 46 fileapi::FileSystemCallbackDispatcher* dispatcher);
43 bool ReadMetadata(const FilePath& path, 47 bool ReadMetadata(const FilePath& path,
44 fileapi::FileSystemCallbackDispatcher* dispatcher); 48 fileapi::FileSystemCallbackDispatcher* dispatcher);
45 bool Create(const FilePath& path, 49 bool Create(const FilePath& path,
46 bool exclusive, 50 bool exclusive,
47 bool is_directory, 51 bool is_directory,
48 bool recursive, 52 bool recursive,
49 fileapi::FileSystemCallbackDispatcher* dispatcher); 53 fileapi::FileSystemCallbackDispatcher* dispatcher);
50 bool Exists(const FilePath& path, 54 bool Exists(const FilePath& path,
51 bool for_directory, 55 bool for_directory,
52 fileapi::FileSystemCallbackDispatcher* dispatcher); 56 fileapi::FileSystemCallbackDispatcher* dispatcher);
53 bool ReadDirectory(const FilePath& path, 57 bool ReadDirectory(const FilePath& path,
54 fileapi::FileSystemCallbackDispatcher* dispatcher); 58 fileapi::FileSystemCallbackDispatcher* dispatcher);
55 59
56 private: 60 private:
61 // Message handler for OpenFileSystem.
62 void OnOpenFileSystemRequestComplete(
63 int request_id,
64 bool accepted,
65 const std::string& name,
66 const FilePath& root_path);
67
68 // Message handlers for regular file system operations.
57 void DidSucceed(int request_id); 69 void DidSucceed(int request_id);
58 void DidReadMetadata(int request_id, 70 void DidReadMetadata(int request_id,
59 const base::PlatformFileInfo& file_info); 71 const base::PlatformFileInfo& file_info);
60 void DidReadDirectory( 72 void DidReadDirectory(
61 int request_id, 73 int request_id,
62 const std::vector<base::file_util_proxy::Entry>& entries, 74 const std::vector<base::file_util_proxy::Entry>& entries,
63 bool has_more); 75 bool has_more);
64 void DidFail(int request_id, base::PlatformFileError error_code); 76 void DidFail(int request_id, base::PlatformFileError error_code);
65 77
66 IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_; 78 IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_;
67 79
68 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); 80 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher);
69 }; 81 };
70 82
71 #endif // CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ 83 #endif // CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_
OLDNEW
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/file_system/file_system_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698