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 | |
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
-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 | ||||
-rw-r--r-- | chrome/common/file_system/file_system_dispatcher.cc | 30 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 18 |
4 files changed, 67 insertions, 83 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. diff --git a/chrome/common/file_system/file_system_dispatcher.cc b/chrome/common/file_system/file_system_dispatcher.cc index 7b0492c..89a2de4 100644 --- a/chrome/common/file_system/file_system_dispatcher.cc +++ b/chrome/common/file_system/file_system_dispatcher.cc @@ -51,55 +51,63 @@ bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& msg) { void FileSystemDispatcher::Move( const string16& src_path, const string16& dest_path, WebFileSystemCallbacks* callbacks) { + FilePath src_file_path = webkit_glue::WebStringToFilePath(src_path); + FilePath dest_file_path = webkit_glue::WebStringToFilePath(dest_path); int request_id = callbacks_.Add(callbacks); - ChildThread::current()->Send( - new ViewHostMsg_FileSystem_Move(request_id, src_path, dest_path)); + ChildThread::current()->Send(new ViewHostMsg_FileSystem_Move( + request_id, src_file_path, dest_file_path)); } void FileSystemDispatcher::Copy( const string16& src_path, const string16& dest_path, WebFileSystemCallbacks* callbacks) { + FilePath src_file_path = webkit_glue::WebStringToFilePath(src_path); + FilePath dest_file_path = webkit_glue::WebStringToFilePath(dest_path); int request_id = callbacks_.Add(callbacks); - ChildThread::current()->Send( - new ViewHostMsg_FileSystem_Copy(request_id, src_path, dest_path)); + ChildThread::current()->Send(new ViewHostMsg_FileSystem_Copy( + request_id, src_file_path, dest_file_path)); } void FileSystemDispatcher::Remove( const string16& path, WebFileSystemCallbacks* callbacks) { + FilePath file_path = webkit_glue::WebStringToFilePath(path); int request_id = callbacks_.Add(callbacks); ChildThread::current()->Send( - new ViewHostMsg_FileSystem_Remove(request_id, path)); + new ViewHostMsg_FileSystem_Remove(request_id, file_path)); } void FileSystemDispatcher::ReadMetadata( const string16& path, WebFileSystemCallbacks* callbacks) { + FilePath file_path = webkit_glue::WebStringToFilePath(path); int request_id = callbacks_.Add(callbacks); ChildThread::current()->Send( - new ViewHostMsg_FileSystem_ReadMetadata(request_id, path)); + new ViewHostMsg_FileSystem_ReadMetadata(request_id, file_path)); } void FileSystemDispatcher::Create( const string16& path, bool exclusive, bool is_directory, WebFileSystemCallbacks* callbacks) { + FilePath file_path = webkit_glue::WebStringToFilePath(path); int request_id = callbacks_.Add(callbacks); - ChildThread::current()->Send( - new ViewHostMsg_FileSystem_Create(request_id, path, exclusive, - is_directory)); + ChildThread::current()->Send(new ViewHostMsg_FileSystem_Create( + request_id, file_path, exclusive, is_directory)); } void FileSystemDispatcher::Exists( const string16& path, bool is_directory, WebFileSystemCallbacks* callbacks) { + FilePath file_path = webkit_glue::WebStringToFilePath(path); int request_id = callbacks_.Add(callbacks); ChildThread::current()->Send( - new ViewHostMsg_FileSystem_Exists(request_id, path, is_directory)); + new ViewHostMsg_FileSystem_Exists(request_id, file_path, is_directory)); } void FileSystemDispatcher::ReadDirectory( const string16& path, WebFileSystemCallbacks* callbacks) { + FilePath file_path = webkit_glue::WebStringToFilePath(path); int request_id = callbacks_.Add(callbacks); ChildThread::current()->Send( - new ViewHostMsg_FileSystem_ReadDirectory(request_id, path)); + new ViewHostMsg_FileSystem_ReadDirectory(request_id, file_path)); } void FileSystemDispatcher::DidSucceed(int request_id) { diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 83b2b46..93eba73 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -2772,42 +2772,42 @@ IPC_BEGIN_MESSAGES(ViewHost) // WebFileSystem::move() message. IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Move, int /* request_id */, - string16 /* src path */, - string16 /* dest path */) + FilePath /* src path */, + FilePath /* dest path */) // WebFileSystem::copy() message. IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Copy, int /* request_id */, - string16 /* src path */, - string16 /* dest path */) + FilePath /* src path */, + FilePath /* dest path */) // WebFileSystem::remove() message. IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_Remove, int /* request_id */, - string16 /* path */) + FilePath /* path */) // WebFileSystem::readMetadata() message. IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadMetadata, int /* request_id */, - string16 /* path */) + FilePath /* path */) // WebFileSystem::create() message. IPC_MESSAGE_CONTROL4(ViewHostMsg_FileSystem_Create, int /* request_id */, - string16 /* path */, + FilePath /* path */, bool /* exclusive */, bool /* is_directory */) // WebFileSystem::exists() messages. IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Exists, int /* request_id */, - string16 /* path */, + FilePath /* path */, bool /* is_directory */) // WebFileSystem::readDirectory() message. IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadDirectory, int /* request_id */, - string16 /* path */) + FilePath /* path */) //--------------------------------------------------------------------------- // Blob messages: |