OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ | 5 #ifndef CONTENT_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ |
6 #define CONTENT_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ | 6 #define CONTENT_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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 ~FileSystemDispatcher(); | 31 ~FileSystemDispatcher(); |
32 | 32 |
33 // IPC::Channel::Listener implementation. | 33 // IPC::Channel::Listener implementation. |
34 virtual bool OnMessageReceived(const IPC::Message& msg); | 34 virtual bool OnMessageReceived(const IPC::Message& msg); |
35 | 35 |
36 bool OpenFileSystem(const GURL& origin_url, | 36 bool OpenFileSystem(const GURL& origin_url, |
37 fileapi::FileSystemType type, | 37 fileapi::FileSystemType type, |
38 long long size, | 38 long long size, |
39 bool create, | 39 bool create, |
40 fileapi::FileSystemCallbackDispatcher* dispatcher); | 40 fileapi::FileSystemCallbackDispatcher* dispatcher); |
41 bool Move(const FilePath& src_path, | 41 bool Move(const GURL& src_path, |
42 const FilePath& dest_path, | 42 const GURL& dest_path, |
43 fileapi::FileSystemCallbackDispatcher* dispatcher); | 43 fileapi::FileSystemCallbackDispatcher* dispatcher); |
44 bool Copy(const FilePath& src_path, | 44 bool Copy(const GURL& src_path, |
45 const FilePath& dest_path, | 45 const GURL& dest_path, |
46 fileapi::FileSystemCallbackDispatcher* dispatcher); | 46 fileapi::FileSystemCallbackDispatcher* dispatcher); |
47 bool Remove(const FilePath& path, | 47 bool Remove(const GURL& path, |
48 bool recursive, | 48 bool recursive, |
49 fileapi::FileSystemCallbackDispatcher* dispatcher); | 49 fileapi::FileSystemCallbackDispatcher* dispatcher); |
50 bool ReadMetadata(const FilePath& path, | 50 bool ReadMetadata(const GURL& path, |
51 fileapi::FileSystemCallbackDispatcher* dispatcher); | 51 fileapi::FileSystemCallbackDispatcher* dispatcher); |
52 bool Create(const FilePath& path, | 52 bool Create(const GURL& path, |
53 bool exclusive, | 53 bool exclusive, |
54 bool is_directory, | 54 bool is_directory, |
55 bool recursive, | 55 bool recursive, |
56 fileapi::FileSystemCallbackDispatcher* dispatcher); | 56 fileapi::FileSystemCallbackDispatcher* dispatcher); |
57 bool Exists(const FilePath& path, | 57 bool Exists(const GURL& path, |
58 bool for_directory, | 58 bool for_directory, |
59 fileapi::FileSystemCallbackDispatcher* dispatcher); | 59 fileapi::FileSystemCallbackDispatcher* dispatcher); |
60 bool ReadDirectory(const FilePath& path, | 60 bool ReadDirectory(const GURL& path, |
61 fileapi::FileSystemCallbackDispatcher* dispatcher); | 61 fileapi::FileSystemCallbackDispatcher* dispatcher); |
62 bool Truncate(const FilePath& path, | 62 bool Truncate(const GURL& path, |
63 int64 offset, | 63 int64 offset, |
64 int* request_id_out, | 64 int* request_id_out, |
65 fileapi::FileSystemCallbackDispatcher* dispatcher); | 65 fileapi::FileSystemCallbackDispatcher* dispatcher); |
66 bool Write(const FilePath& path, | 66 bool Write(const GURL& path, |
67 const GURL& blob_url, | 67 const GURL& blob_url, |
68 int64 offset, | 68 int64 offset, |
69 int* request_id_out, | 69 int* request_id_out, |
70 fileapi::FileSystemCallbackDispatcher* dispatcher); | 70 fileapi::FileSystemCallbackDispatcher* dispatcher); |
71 bool Cancel(int request_id_to_cancel, | 71 bool Cancel(int request_id_to_cancel, |
72 fileapi::FileSystemCallbackDispatcher* dispatcher); | 72 fileapi::FileSystemCallbackDispatcher* dispatcher); |
73 bool TouchFile(const FilePath& file_path, | 73 bool TouchFile(const GURL& file_path, |
74 const base::Time& last_access_time, | 74 const base::Time& last_access_time, |
75 const base::Time& last_modified_time, | 75 const base::Time& last_modified_time, |
76 fileapi::FileSystemCallbackDispatcher* dispatcher); | 76 fileapi::FileSystemCallbackDispatcher* dispatcher); |
77 | 77 |
78 private: | 78 private: |
79 // Message handlers. | 79 // Message handlers. |
80 void OnOpenComplete( | 80 void OnOpenComplete( |
81 int request_id, | 81 int request_id, |
82 bool accepted, | 82 bool accepted, |
83 const std::string& name, | 83 const std::string& name, |
84 const FilePath& root_path); | 84 const GURL& root); |
85 void OnDidSucceed(int request_id); | 85 void OnDidSucceed(int request_id); |
86 void OnDidReadMetadata(int request_id, | 86 void OnDidReadMetadata(int request_id, |
87 const base::PlatformFileInfo& file_info, | 87 const base::PlatformFileInfo& file_info, |
88 const FilePath& platform_path); | 88 const FilePath& platform_path); |
89 void OnDidReadDirectory( | 89 void OnDidReadDirectory( |
90 int request_id, | 90 int request_id, |
91 const std::vector<base::FileUtilProxy::Entry>& entries, | 91 const std::vector<base::FileUtilProxy::Entry>& entries, |
92 bool has_more); | 92 bool has_more); |
93 void OnDidFail(int request_id, base::PlatformFileError error_code); | 93 void OnDidFail(int request_id, base::PlatformFileError error_code); |
94 void OnDidWrite(int request_id, int64 bytes, bool complete); | 94 void OnDidWrite(int request_id, int64 bytes, bool complete); |
95 | 95 |
96 IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_; | 96 IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); | 98 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); |
99 }; | 99 }; |
100 | 100 |
101 #endif // CONTENT_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ | 101 #endif // CONTENT_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ |
OLD | NEW |