Chromium Code Reviews| Index: chrome/browser/extensions/extension_file_browser_private_api.h |
| diff --git a/chrome/browser/extensions/extension_file_browser_private_api.h b/chrome/browser/extensions/extension_file_browser_private_api.h |
| index 28e96f4b6539da8649f039b25d88b48d17e8de17..b083186d63d64afe3606d522d270b10796b23795 100644 |
| --- a/chrome/browser/extensions/extension_file_browser_private_api.h |
| +++ b/chrome/browser/extensions/extension_file_browser_private_api.h |
| @@ -17,7 +17,7 @@ |
| #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| #ifdef OS_CHROMEOS |
| -#include "chrome/browser/chromeos/cros/mount_library.h" |
| +#include "chrome/browser/chromeos/disks/disk_mount_manager.h" |
| #endif |
| class GURL; |
| @@ -25,9 +25,12 @@ class GURL; |
| // Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method. |
| class RequestLocalFileSystemFunction : public AsyncExtensionFunction { |
| protected: |
| - friend class LocalFileSystemCallbackDispatcher; |
| // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| + |
| + private: |
| + class LocalFileSystemCallbackDispatcher; |
| + |
| void RespondSuccessOnUIThread(const std::string& name, |
| const GURL& root_path); |
| void RespondFailedOnUIThread(base::PlatformFileError error_code); |
| @@ -100,7 +103,7 @@ class ExecuteTasksFileBrowserFunction : public AsyncExtensionFunction { |
| bool is_directory; |
| }; |
| typedef std::vector<FileDefinition> FileDefinitionList; |
| - friend class ExecuteTasksFileSystemCallbackDispatcher; |
| + class ExecuteTasksFileSystemCallbackDispatcher; |
| // Initates execution of context menu tasks identified with |task_id| for |
| // each element of |files_list|. |
| bool InitiateFileTaskExecution(const std::string& task_id, |
| @@ -126,19 +129,19 @@ class FileBrowserFunction |
| protected: |
| typedef std::vector<GURL> UrlList; |
| typedef std::vector<FilePath> FilePathList; |
| + typedef base::Callback<void(const FilePathList&)> GetLocalPathsCallback; |
| virtual ~FileBrowserFunction(); |
| - // Convert virtual paths to local paths on the file thread. |
| - void GetLocalPathsOnFileThread(const UrlList& file_urls, |
| - void* context); |
| - |
| - // Callback with converted local paths. |
| - virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| - void* context) {} |
| + // Convert virtual paths to local paths |
|
satorux1
2011/11/16 06:46:06
period is missing. looking at the implementation,
hashimoto
2011/11/16 07:45:32
Done.
|
| + void GetLocalPaths(const UrlList& file_urls, GetLocalPathsCallback callback); |
| // Figure out the tab_id of the hosting tab. |
| int32 GetTabId() const; |
| + |
| + private: |
| + void GetLocalPathsOnFileThread(const UrlList& file_urls, |
|
satorux1
2011/11/16 06:46:06
function comment is missing.
hashimoto
2011/11/16 07:45:32
Done.
|
| + GetLocalPathsCallback callback); |
| }; |
| // Select a single file. Closes the dialog window. |
| @@ -153,11 +156,9 @@ class SelectFileFunction |
| // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| - // FileBrowserFunction overrides. |
| - virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| - void* context) OVERRIDE; |
| - |
| private: |
| + void GetLocalPathsResponseOnUIThread(const FilePathList& files); |
|
satorux1
2011/11/16 06:46:06
ditto.
hashimoto
2011/11/16 07:45:32
Done.
|
| + |
| DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFile"); |
| }; |
| @@ -173,11 +174,10 @@ class ViewFilesFunction |
| // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| - // FileBrowserFunction overrides. |
| - virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| - void* context) OVERRIDE; |
| - |
| private: |
| + void GetLocalPathsResponseOnUIThread(const std::string& internal_task_id, |
|
satorux1
2011/11/16 06:46:06
ditto.
hashimoto
2011/11/16 07:45:32
Done.
|
| + const FilePathList& files); |
| + |
| DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.viewFiles"); |
| }; |
| @@ -193,11 +193,9 @@ class SelectFilesFunction |
| // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| - // FileBrowserFunction overrides. |
| - virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| - void* context) OVERRIDE; |
| - |
| private: |
| + void GetLocalPathsResponseOnUIThread(const FilePathList& files); |
|
satorux1
2011/11/16 06:46:06
ditto
hashimoto
2011/11/16 07:45:32
Done.
|
| + |
| DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFiles"); |
| }; |
| @@ -226,23 +224,12 @@ class AddMountFunction |
| protected: |
| virtual ~AddMountFunction(); |
| + // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| - // FileBrowserFunction overrides. |
| - virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| - void* context) OVERRIDE; |
| - |
| private: |
| -#if defined(OS_CHROMEOS) |
| - struct MountParamaters { |
| - MountParamaters(const std::string& type, |
| - const chromeos::MountPathOptions& options) |
| - : mount_type(type), mount_options(options) {} |
| - ~MountParamaters() {} |
| - std::string mount_type; |
| - chromeos::MountPathOptions mount_options; |
| - }; |
| -#endif |
| + void GetLocalPathsResponseOnUIThread(const std::string& mount_type_str, |
| + const FilePathList& files); |
| DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addMount"); |
| }; |
| @@ -256,12 +243,12 @@ class RemoveMountFunction |
| protected: |
| virtual ~RemoveMountFunction(); |
| - // FileBrowserFunction overrides. |
| + // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| - virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| - void* context) OVERRIDE; |
| private: |
| + void GetLocalPathsResponseOnUIThread(const FilePathList& files); |
| + |
| DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.removeMount"); |
| }; |
| @@ -273,6 +260,7 @@ class GetMountPointsFunction |
| protected: |
| virtual ~GetMountPointsFunction(); |
| + // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| private: |
| @@ -288,13 +276,12 @@ class FormatDeviceFunction |
| protected: |
| virtual ~FormatDeviceFunction(); |
| + // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| -// FileBrowserFunction overrides. |
| - virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| - void* context) OVERRIDE; |
| - |
| private: |
| + void GetLocalPathsResponseOnUIThread(const FilePathList& files); |
| + |
| DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.formatDevice"); |
| }; |
| @@ -306,16 +293,16 @@ class GetSizeStatsFunction |
| protected: |
| virtual ~GetSizeStatsFunction(); |
| - // FileBrowserFunction overrides. |
| + // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| - virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files, |
| - void* context) OVERRIDE; |
| private: |
| - void GetSizeStatsCallbackOnUIThread(const char* mount_path, |
| + void GetLocalPathsResponseOnUIThread(const FilePathList& files); |
| + |
| + void GetSizeStatsCallbackOnUIThread(const std::string& mount_path, |
| size_t total_size_kb, |
| size_t remaining_size_kb); |
| - void CallGetSizeStatsOnFileThread(const char* mount_path); |
| + void CallGetSizeStatsOnFileThread(const std::string& mount_path); |
| DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getSizeStats"); |
| }; |