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 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" | 5 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" | 9 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" |
10 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" | 10 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" |
11 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo
ry.h" | 11 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo
ry.h" |
| 12 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" |
12 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" | 13 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" |
13 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" | 14 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" |
14 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" | 15 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" |
15 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" | 16 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" |
16 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" | 17 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" |
17 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" | 18 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" |
18 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 19 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/common/extensions/api/file_system_provider.h" | 21 #include "chrome/common/extensions/api/file_system_provider.h" |
21 #include "extensions/browser/event_router.h" | 22 #include "extensions/browser/event_router.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 scoped_ptr<RequestManager::HandlerInterface>( | 160 scoped_ptr<RequestManager::HandlerInterface>( |
160 new operations::DeleteEntry(event_router_, | 161 new operations::DeleteEntry(event_router_, |
161 file_system_info_, | 162 file_system_info_, |
162 entry_path, | 163 entry_path, |
163 recursive, | 164 recursive, |
164 callback)))) { | 165 callback)))) { |
165 callback.Run(base::File::FILE_ERROR_SECURITY); | 166 callback.Run(base::File::FILE_ERROR_SECURITY); |
166 } | 167 } |
167 } | 168 } |
168 | 169 |
| 170 void ProvidedFileSystem::CreateFile( |
| 171 const base::FilePath& file_path, |
| 172 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
| 173 if (!request_manager_.CreateRequest( |
| 174 CREATE_FILE, |
| 175 scoped_ptr<RequestManager::HandlerInterface>( |
| 176 new operations::CreateFile( |
| 177 event_router_, file_system_info_, file_path, callback)))) { |
| 178 callback.Run(base::File::FILE_ERROR_SECURITY); |
| 179 } |
| 180 } |
| 181 |
169 const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const { | 182 const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const { |
170 return file_system_info_; | 183 return file_system_info_; |
171 } | 184 } |
172 | 185 |
173 RequestManager* ProvidedFileSystem::GetRequestManager() { | 186 RequestManager* ProvidedFileSystem::GetRequestManager() { |
174 return &request_manager_; | 187 return &request_manager_; |
175 } | 188 } |
176 | 189 |
177 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { | 190 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { |
178 return weak_ptr_factory_.GetWeakPtr(); | 191 return weak_ptr_factory_.GetWeakPtr(); |
179 } | 192 } |
180 | 193 |
181 } // namespace file_system_provider | 194 } // namespace file_system_provider |
182 } // namespace chromeos | 195 } // namespace chromeos |
OLD | NEW |