OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 std::string mime_type, | 61 std::string mime_type, |
62 std::string contents); | 62 std::string contents); |
63 | 63 |
64 // Fetches a pointer to a fake entry registered in the fake file system. If | 64 // Fetches a pointer to a fake entry registered in the fake file system. If |
65 // found, then the result is written to |fake_entry| and true is returned. | 65 // found, then the result is written to |fake_entry| and true is returned. |
66 // Otherwise, false is returned. |fake_entry| must not be NULL. | 66 // Otherwise, false is returned. |fake_entry| must not be NULL. |
67 bool GetEntry(const base::FilePath& entry_path, FakeEntry* fake_entry) const; | 67 bool GetEntry(const base::FilePath& entry_path, FakeEntry* fake_entry) const; |
68 | 68 |
69 // ProvidedFileSystemInterface overrides. | 69 // ProvidedFileSystemInterface overrides. |
70 virtual void RequestUnmount( | 70 virtual void RequestUnmount( |
71 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 71 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
72 virtual void GetMetadata( | 72 virtual void GetMetadata( |
73 const base::FilePath& entry_path, | 73 const base::FilePath& entry_path, |
74 const ProvidedFileSystemInterface::GetMetadataCallback& callback) | 74 const ProvidedFileSystemInterface::GetMetadataCallback& callback) |
75 OVERRIDE; | 75 OVERRIDE; |
76 virtual void ReadDirectory( | 76 virtual void ReadDirectory( |
77 const base::FilePath& directory_path, | 77 const base::FilePath& directory_path, |
78 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) OVERRIDE; | 78 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) OVERRIDE; |
79 virtual void OpenFile(const base::FilePath& file_path, | 79 virtual void OpenFile(const base::FilePath& file_path, |
80 OpenFileMode mode, | 80 OpenFileMode mode, |
81 const OpenFileCallback& callback) OVERRIDE; | 81 const OpenFileCallback& callback) OVERRIDE; |
82 virtual void CloseFile( | 82 virtual void CloseFile( |
83 int file_handle, | 83 int file_handle, |
84 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 84 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
85 virtual void ReadFile(int file_handle, | 85 virtual void ReadFile(int file_handle, |
86 net::IOBuffer* buffer, | 86 net::IOBuffer* buffer, |
87 int64 offset, | 87 int64 offset, |
88 int length, | 88 int length, |
89 const ReadChunkReceivedCallback& callback) OVERRIDE; | 89 const ReadChunkReceivedCallback& callback) OVERRIDE; |
90 virtual void CreateDirectory( | 90 virtual void CreateDirectory( |
91 const base::FilePath& directory_path, | 91 const base::FilePath& directory_path, |
92 bool exclusive, | 92 bool exclusive, |
93 bool recursive, | 93 bool recursive, |
94 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 94 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
95 virtual void DeleteEntry( | 95 virtual void DeleteEntry( |
96 const base::FilePath& entry_path, | 96 const base::FilePath& entry_path, |
97 bool recursive, | 97 bool recursive, |
98 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 98 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
99 virtual void CreateFile( | 99 virtual void CreateFile( |
100 const base::FilePath& file_path, | 100 const base::FilePath& file_path, |
101 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 101 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
102 virtual void CopyEntry( | 102 virtual void CopyEntry( |
103 const base::FilePath& source_path, | 103 const base::FilePath& source_path, |
104 const base::FilePath& target_path, | 104 const base::FilePath& target_path, |
105 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 105 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
106 virtual void MoveEntry( | 106 virtual void MoveEntry( |
107 const base::FilePath& source_path, | 107 const base::FilePath& source_path, |
108 const base::FilePath& target_path, | 108 const base::FilePath& target_path, |
109 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 109 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
110 virtual void Truncate( | 110 virtual void Truncate( |
111 const base::FilePath& file_path, | 111 const base::FilePath& file_path, |
112 int64 length, | 112 int64 length, |
113 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 113 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
114 virtual void WriteFile( | 114 virtual void WriteFile( |
115 int file_handle, | 115 int file_handle, |
116 net::IOBuffer* buffer, | 116 net::IOBuffer* buffer, |
117 int64 offset, | 117 int64 offset, |
118 int length, | 118 int length, |
119 const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE; | 119 const storage::AsyncFileUtil::StatusCallback& callback) OVERRIDE; |
120 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; | 120 virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const OVERRIDE; |
121 virtual RequestManager* GetRequestManager() OVERRIDE; | 121 virtual RequestManager* GetRequestManager() OVERRIDE; |
122 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() OVERRIDE; | 122 virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() OVERRIDE; |
123 | 123 |
124 // Factory callback, to be used in Service::SetFileSystemFactory(). The | 124 // Factory callback, to be used in Service::SetFileSystemFactory(). The |
125 // |event_router| argument can be NULL. | 125 // |event_router| argument can be NULL. |
126 static ProvidedFileSystemInterface* Create( | 126 static ProvidedFileSystemInterface* Create( |
127 Profile* profile, | 127 Profile* profile, |
128 const ProvidedFileSystemInfo& file_system_info); | 128 const ProvidedFileSystemInfo& file_system_info); |
129 | 129 |
130 private: | 130 private: |
131 typedef std::map<base::FilePath, FakeEntry> Entries; | 131 typedef std::map<base::FilePath, FakeEntry> Entries; |
132 typedef std::map<int, base::FilePath> OpenedFilesMap; | 132 typedef std::map<int, base::FilePath> OpenedFilesMap; |
133 | 133 |
134 ProvidedFileSystemInfo file_system_info_; | 134 ProvidedFileSystemInfo file_system_info_; |
135 Entries entries_; | 135 Entries entries_; |
136 OpenedFilesMap opened_files_; | 136 OpenedFilesMap opened_files_; |
137 int last_file_handle_; | 137 int last_file_handle_; |
138 | 138 |
139 base::WeakPtrFactory<ProvidedFileSystemInterface> weak_ptr_factory_; | 139 base::WeakPtrFactory<ProvidedFileSystemInterface> weak_ptr_factory_; |
140 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); | 140 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace file_system_provider | 143 } // namespace file_system_provider |
144 } // namespace chromeos | 144 } // namespace chromeos |
145 | 145 |
146 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE
M_H_ | 146 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE
M_H_ |
OLD | NEW |