diff options
author | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-16 19:44:32 +0000 |
---|---|---|
committer | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-16 19:44:32 +0000 |
commit | e77f2523948dbfcf6b1cf8e7f4f33dbea7dd9ec8 (patch) | |
tree | 0406ed7945e8683c44ef2284e5521dcf5d55163e /chrome/browser/file_system | |
parent | 19eef069c3a53544627254e54f88ae8bbc8c40a7 (diff) | |
download | chromium_src-e77f2523948dbfcf6b1cf8e7f4f33dbea7dd9ec8.zip chromium_src-e77f2523948dbfcf6b1cf8e7f4f33dbea7dd9ec8.tar.gz chromium_src-e77f2523948dbfcf6b1cf8e7f4f33dbea7dd9ec8.tar.bz2 |
Change the FileSystem IPCs to take FilePaths as arguments instead of
string16s. FilePaths are better than string16s, because pepper uses
FilePaths, and for the WebFileSystem API it doesn't matter, because it
needs to do the string16 --> FilePath conversion once.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3383003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/file_system')
-rw-r--r-- | chrome/browser/file_system/file_system_dispatcher_host.cc | 62 | ||||
-rw-r--r-- | chrome/browser/file_system/file_system_dispatcher_host.h | 40 |
2 files changed, 39 insertions, 63 deletions
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc index 16e8795..86555a2 100644 --- a/chrome/browser/file_system/file_system_dispatcher_host.cc +++ b/chrome/browser/file_system/file_system_dispatcher_host.cc @@ -151,73 +151,61 @@ void FileSystemDispatcherHost::OnOpenFileSystem( } void FileSystemDispatcherHost::OnMove( - int request_id, const string16& src_path, const string16& dest_path) { - FilePath src_file_path = webkit_glue::WebStringToFilePath(src_path); - FilePath dest_file_path = webkit_glue::WebStringToFilePath(dest_path); - - if (!CheckValidFileSystemPath(src_file_path, request_id) || - !CheckValidFileSystemPath(dest_file_path, request_id)) + int request_id, const FilePath& src_path, const FilePath& dest_path) { + if (!CheckValidFileSystemPath(src_path, request_id) || + !CheckValidFileSystemPath(dest_path, request_id)) return; - GetNewOperation(request_id)->Move(src_file_path, dest_file_path); + GetNewOperation(request_id)->Move(src_path, dest_path); } void FileSystemDispatcherHost::OnCopy( - int request_id, const string16& src_path, const string16& dest_path) { - FilePath src_file_path = webkit_glue::WebStringToFilePath(src_path); - FilePath dest_file_path = webkit_glue::WebStringToFilePath(dest_path); - - if (!CheckValidFileSystemPath(src_file_path, request_id) || - !CheckValidFileSystemPath(dest_file_path, request_id)) + int request_id, const FilePath& src_path, const FilePath& dest_path) { + if (!CheckValidFileSystemPath(src_path, request_id) || + !CheckValidFileSystemPath(dest_path, request_id)) return; - GetNewOperation(request_id)->Copy(src_file_path, dest_file_path); + GetNewOperation(request_id)->Copy(src_path, dest_path); } -void FileSystemDispatcherHost::OnRemove( - int request_id, const string16& path) { - FilePath file_path = webkit_glue::WebStringToFilePath(path); - if (!CheckValidFileSystemPath(file_path, request_id)) +void FileSystemDispatcherHost::OnRemove(int request_id, const FilePath& path) { + if (!CheckValidFileSystemPath(path, request_id)) return; - GetNewOperation(request_id)->Remove(file_path); + GetNewOperation(request_id)->Remove(path); } void FileSystemDispatcherHost::OnReadMetadata( - int request_id, const string16& path) { - FilePath file_path = webkit_glue::WebStringToFilePath(path); - if (!CheckValidFileSystemPath(file_path, request_id)) + int request_id, const FilePath& path) { + if (!CheckValidFileSystemPath(path, request_id)) return; - GetNewOperation(request_id)->GetMetadata(file_path); + GetNewOperation(request_id)->GetMetadata(path); } void FileSystemDispatcherHost::OnCreate( - int request_id, const string16& path, bool exclusive, bool is_directory) { - FilePath file_path = webkit_glue::WebStringToFilePath(path); - if (!CheckValidFileSystemPath(file_path, request_id)) + int request_id, const FilePath& path, bool exclusive, bool is_directory) { + if (!CheckValidFileSystemPath(path, request_id)) return; if (is_directory) - GetNewOperation(request_id)->CreateDirectory(file_path, exclusive); + GetNewOperation(request_id)->CreateDirectory(path, exclusive); else - GetNewOperation(request_id)->CreateFile(file_path, exclusive); + GetNewOperation(request_id)->CreateFile(path, exclusive); } void FileSystemDispatcherHost::OnExists( - int request_id, const string16& path, bool is_directory) { - FilePath file_path = webkit_glue::WebStringToFilePath(path); - if (!CheckValidFileSystemPath(file_path, request_id)) + int request_id, const FilePath& path, bool is_directory) { + if (!CheckValidFileSystemPath(path, request_id)) return; if (is_directory) - GetNewOperation(request_id)->DirectoryExists(file_path); + GetNewOperation(request_id)->DirectoryExists(path); else - GetNewOperation(request_id)->FileExists(file_path); + GetNewOperation(request_id)->FileExists(path); } void FileSystemDispatcherHost::OnReadDirectory( - int request_id, const string16& path) { - FilePath file_path = webkit_glue::WebStringToFilePath(path); - if (!CheckValidFileSystemPath(file_path, request_id)) + int request_id, const FilePath& path) { + if (!CheckValidFileSystemPath(path, request_id)) return; - GetNewOperation(request_id)->ReadDirectory(file_path); + GetNewOperation(request_id)->ReadDirectory(path); } void FileSystemDispatcherHost::DidFail( diff --git a/chrome/browser/file_system/file_system_dispatcher_host.h b/chrome/browser/file_system/file_system_dispatcher_host.h index fff7108..8f21654 100644 --- a/chrome/browser/file_system/file_system_dispatcher_host.h +++ b/chrome/browser/file_system/file_system_dispatcher_host.h @@ -35,32 +35,20 @@ class FileSystemDispatcherHost bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok); void OnOpenFileSystem(const ViewHostMsg_OpenFileSystemRequest_Params&); - void OnMove( - int request_id, - const string16& src_path, - const string16& dest_path); - void OnCopy( - int request_id, - const string16& src_path, - const string16& dest_path); - void OnRemove( - int request_id, - const string16& path); - void OnReadMetadata( - int request_id, - const string16& path); - void OnCreate( - int request_id, - const string16& path, - bool exclusive, - bool is_directory); - void OnExists( - int request_id, - const string16& path, - bool is_directory); - void OnReadDirectory( - int request_id, - const string16& path); + void OnMove(int request_id, + const FilePath& src_path, + const FilePath& dest_path); + void OnCopy(int request_id, + const FilePath& src_path, + const FilePath& dest_path); + void OnRemove(int request_id, const FilePath& path); + void OnReadMetadata(int request_id, const FilePath& path); + void OnCreate(int request_id, + const FilePath& path, + bool exclusive, + bool is_directory); + void OnExists(int request_id, const FilePath& path, bool is_directory); + void OnReadDirectory(int request_id, const FilePath& path); void Send(IPC::Message* message); // FileSystemOperationClient methods. |