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/get_metadata.h
" | 12 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" |
12 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" | 13 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" |
13 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" | 14 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" |
14 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" | 15 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" |
15 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" | 16 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" |
16 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 17 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/common/extensions/api/file_system_provider.h" | 19 #include "chrome/common/extensions/api/file_system_provider.h" |
19 #include "extensions/browser/event_router.h" | 20 #include "extensions/browser/event_router.h" |
20 | 21 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 124 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
124 if (!request_manager_.CreateRequest( | 125 if (!request_manager_.CreateRequest( |
125 CLOSE_FILE, | 126 CLOSE_FILE, |
126 scoped_ptr<RequestManager::HandlerInterface>( | 127 scoped_ptr<RequestManager::HandlerInterface>( |
127 new operations::CloseFile( | 128 new operations::CloseFile( |
128 event_router_, file_system_info_, file_handle, callback)))) { | 129 event_router_, file_system_info_, file_handle, callback)))) { |
129 callback.Run(base::File::FILE_ERROR_SECURITY); | 130 callback.Run(base::File::FILE_ERROR_SECURITY); |
130 } | 131 } |
131 } | 132 } |
132 | 133 |
| 134 void ProvidedFileSystem::CreateDirectory( |
| 135 const base::FilePath& directory_path, |
| 136 bool exclusive, |
| 137 bool recursive, |
| 138 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
| 139 if (!request_manager_.CreateRequest( |
| 140 CREATE_DIRECTORY, |
| 141 scoped_ptr<RequestManager::HandlerInterface>( |
| 142 new operations::CreateDirectory(event_router_, |
| 143 file_system_info_, |
| 144 directory_path, |
| 145 exclusive, |
| 146 recursive, |
| 147 callback)))) { |
| 148 callback.Run(base::File::FILE_ERROR_SECURITY); |
| 149 } |
| 150 } |
| 151 |
133 const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const { | 152 const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const { |
134 return file_system_info_; | 153 return file_system_info_; |
135 } | 154 } |
136 | 155 |
137 RequestManager* ProvidedFileSystem::GetRequestManager() { | 156 RequestManager* ProvidedFileSystem::GetRequestManager() { |
138 return &request_manager_; | 157 return &request_manager_; |
139 } | 158 } |
140 | 159 |
141 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { | 160 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { |
142 return weak_ptr_factory_.GetWeakPtr(); | 161 return weak_ptr_factory_.GetWeakPtr(); |
143 } | 162 } |
144 | 163 |
145 } // namespace file_system_provider | 164 } // namespace file_system_provider |
146 } // namespace chromeos | 165 } // namespace chromeos |
OLD | NEW |