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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/provided_file_system.cc

Issue 1151763007: Add the boilerplate for actions to File System Provider API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased + fixed a comment. Created 5 years, 6 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
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" 11 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h"
12 #include "chrome/browser/chromeos/file_system_provider/operations/abort.h" 12 #include "chrome/browser/chromeos/file_system_provider/operations/abort.h"
13 #include "chrome/browser/chromeos/file_system_provider/operations/add_watcher.h" 13 #include "chrome/browser/chromeos/file_system_provider/operations/add_watcher.h"
14 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" 14 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h"
15 #include "chrome/browser/chromeos/file_system_provider/operations/configure.h" 15 #include "chrome/browser/chromeos/file_system_provider/operations/configure.h"
16 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" 16 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h"
17 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo ry.h" 17 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo ry.h"
18 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" 18 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h"
19 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h " 19 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h "
20 #include "chrome/browser/chromeos/file_system_provider/operations/get_actions.h"
20 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h " 21 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h "
21 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" 22 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h"
22 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" 23 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h"
23 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory .h" 24 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory .h"
24 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" 25 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h"
25 #include "chrome/browser/chromeos/file_system_provider/operations/remove_watcher .h" 26 #include "chrome/browser/chromeos/file_system_provider/operations/remove_watcher .h"
26 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h" 27 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h"
27 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" 28 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h"
28 #include "chrome/browser/chromeos/file_system_provider/operations/write_file.h" 29 #include "chrome/browser/chromeos/file_system_provider/operations/write_file.h"
29 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" 30 #include "chrome/browser/chromeos/file_system_provider/request_manager.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (!request_id) { 186 if (!request_id) {
186 callback.Run(make_scoped_ptr<EntryMetadata>(NULL), 187 callback.Run(make_scoped_ptr<EntryMetadata>(NULL),
187 base::File::FILE_ERROR_SECURITY); 188 base::File::FILE_ERROR_SECURITY);
188 return AbortCallback(); 189 return AbortCallback();
189 } 190 }
190 191
191 return base::Bind( 192 return base::Bind(
192 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); 193 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id);
193 } 194 }
194 195
196 AbortCallback ProvidedFileSystem::GetActions(
197 const base::FilePath& entry_path,
198 const GetActionsCallback& callback) {
199 const int request_id = request_manager_->CreateRequest(
200 GET_ACTIONS,
201 scoped_ptr<RequestManager::HandlerInterface>(new operations::GetActions(
202 event_router_, file_system_info_, entry_path, callback)));
203 if (!request_id) {
204 callback.Run(Actions(), base::File::FILE_ERROR_SECURITY);
205 return AbortCallback();
206 }
207
208 return base::Bind(&ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(),
209 request_id);
210 }
211
195 AbortCallback ProvidedFileSystem::ReadDirectory( 212 AbortCallback ProvidedFileSystem::ReadDirectory(
196 const base::FilePath& directory_path, 213 const base::FilePath& directory_path,
197 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) { 214 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) {
198 const int request_id = request_manager_->CreateRequest( 215 const int request_id = request_manager_->CreateRequest(
199 READ_DIRECTORY, 216 READ_DIRECTORY,
200 scoped_ptr<RequestManager::HandlerInterface>( 217 scoped_ptr<RequestManager::HandlerInterface>(
201 new operations::ReadDirectory( 218 new operations::ReadDirectory(
202 event_router_, file_system_info_, directory_path, callback))); 219 event_router_, file_system_info_, directory_path, callback)));
203 if (!request_id) { 220 if (!request_id) {
204 callback.Run(base::File::FILE_ERROR_SECURITY, 221 callback.Run(base::File::FILE_ERROR_SECURITY,
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 const storage::AsyncFileUtil::StatusCallback& callback, 796 const storage::AsyncFileUtil::StatusCallback& callback,
780 base::File::Error result) { 797 base::File::Error result) {
781 // Closing files is final. Even if an error happened, we remove it from the 798 // Closing files is final. Even if an error happened, we remove it from the
782 // list of opened files. 799 // list of opened files.
783 opened_files_.erase(file_handle); 800 opened_files_.erase(file_handle);
784 callback.Run(result); 801 callback.Run(result);
785 } 802 }
786 803
787 } // namespace file_system_provider 804 } // namespace file_system_provider
788 } // namespace chromeos 805 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698