summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authorzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-25 06:19:02 +0000
committerzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-25 06:19:02 +0000
commit3976e5dfe1b2c23bb8e573f34d1da1a05403e41f (patch)
tree858230a49fceabe22c886a1a70c3a771f3708560 /chrome/browser/extensions
parent434da4e43076f7cdb7faf899c2841b6829c01541 (diff)
downloadchromium_src-3976e5dfe1b2c23bb8e573f34d1da1a05403e41f.zip
chromium_src-3976e5dfe1b2c23bb8e573f34d1da1a05403e41f.tar.gz
chromium_src-3976e5dfe1b2c23bb8e573f34d1da1a05403e41f.tar.bz2
Revert 93838 - Merged already reviewed CLs for r/o zip support in ChromeOS file browser:
Re-landing http://codereview.chromium.org/7457001: Adding support for mount point different from removable devices to MountLibrary (work in progress..have to add GetMountPoints support) tested on ChromeOS with these three patches: http://gerrit.chromium.org/gerrit/#change,4447 http://gerrit.chromium.org/gerrit/#change,4449 http://gerrit.chromium.org/gerrit/#change,4544 http://codereview.chromium.org/7471039/: UI for mounting/unmounting archive files. BUG=chromium-os:17673, chromium-os:17783 TEST=Made sure mounting devices still works and that MountCompleted event gets through to file_browser_event_router (checking ui and chrome logs for mount completed entries) TBR=tbarzic, dgozman Review URL: http://codereview.chromium.org/7488044 TBR=zelidrag@chromium.org Review URL: http://codereview.chromium.org/7495024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93849 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extension_event_names.cc2
-rw-r--r--chrome/browser/extensions/extension_event_names.h1
-rw-r--r--chrome/browser/extensions/extension_file_browser_private_api.cc224
-rw-r--r--chrome/browser/extensions/extension_file_browser_private_api.h85
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc4
-rw-r--r--chrome/browser/extensions/file_manager_util.cc27
-rw-r--r--chrome/browser/extensions/file_manager_util.h8
7 files changed, 59 insertions, 292 deletions
diff --git a/chrome/browser/extensions/extension_event_names.cc b/chrome/browser/extensions/extension_event_names.cc
index fc226f3..76c0d8f 100644
--- a/chrome/browser/extensions/extension_event_names.cc
+++ b/chrome/browser/extensions/extension_event_names.cc
@@ -25,8 +25,6 @@ const char kOnExtensionDisabled[] = "management.onDisabled";
const char kOnFileBrowserDiskChanged[] = "fileBrowserPrivate.onDiskChanged";
const char kOnFileChanged[] = "fileBrowserPrivate.onFileChanged";
-const char kOnFileBrowserMountCompleted[] =
- "fileBrowserPrivate.onMountCompleted";
const char kOnInputMethodChanged[] = "inputMethodPrivate.onChanged";
} // namespace extension_event_names
diff --git a/chrome/browser/extensions/extension_event_names.h b/chrome/browser/extensions/extension_event_names.h
index 0b26e4f..b6958e2 100644
--- a/chrome/browser/extensions/extension_event_names.h
+++ b/chrome/browser/extensions/extension_event_names.h
@@ -33,7 +33,6 @@ extern const char kOnExtensionDisabled[];
// FileBrowser.
extern const char kOnFileBrowserDiskChanged[];
extern const char kOnFileChanged[];
-extern const char kOnFileBrowserMountCompleted[];
// InputMethod.
extern const char kOnInputMethodChanged[];
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc
index 95dbc0c..a5f386f 100644
--- a/chrome/browser/extensions/extension_file_browser_private_api.cc
+++ b/chrome/browser/extensions/extension_file_browser_private_api.cc
@@ -238,40 +238,6 @@ void UpdateFileHandlerUsageStats(Profile* profile, const std::string& task_id) {
base::Time::kMicrosecondsPerSecond)));
}
-#ifdef OS_CHROMEOS
-base::DictionaryValue* MountPointToValue(Profile* profile,
- const chromeos::MountLibrary::MountPointInfo& mount_point_info) {
-
- base::DictionaryValue *mount_info = new base::DictionaryValue();
-
- mount_info->SetString("mountType",
- chromeos::MountLibrary::MountTypeToString(mount_point_info.mount_type));
-
- if (mount_point_info.mount_type == chromeos::MOUNT_TYPE_ARCHIVE) {
- GURL source_url;
- if (FileManagerUtil::ConvertFileToFileSystemUrl(profile,
- FilePath(mount_point_info.source_path),
- FileManagerUtil::GetFileBrowserExtensionUrl().GetOrigin(),
- &source_url)) {
- mount_info->SetString("sourceUrl", source_url.spec());
- }
- } else {
- mount_info->SetString("sourceUrl", mount_point_info.source_path);
- }
-
- FilePath relative_mount_path;
- // Convert mount point path to relative path with the external file system
- // exposed within File API.
- if (FileManagerUtil::ConvertFileToRelativeFileSystemPath(profile,
- FilePath(mount_point_info.mount_path),
- &relative_mount_path)) {
- mount_info->SetString("mountPath", relative_mount_path.value());
- }
-
- return mount_info;
-}
-#endif
-
class LocalFileSystemCallbackDispatcher
: public fileapi::FileSystemCallbackDispatcher {
@@ -903,13 +869,13 @@ void ExecuteTasksFileBrowserFunction::ExecuteFileActionsOnUIThread(
SendResponse(true);
}
-FileBrowserFunction::FileBrowserFunction() {
+FileDialogFunction::FileDialogFunction() {
}
-FileBrowserFunction::~FileBrowserFunction() {
+FileDialogFunction::~FileDialogFunction() {
}
-int32 FileBrowserFunction::GetTabId() const {
+int32 FileDialogFunction::GetTabId() const {
int32 tab_id = 0;
if (!dispatcher()) {
NOTREACHED();
@@ -918,9 +884,8 @@ int32 FileBrowserFunction::GetTabId() const {
// TODO(jamescook): This is going to fail when we switch to tab-modal
// dialogs. Figure out a way to find which SelectFileDialog::Listener
- // to call from inside these extension FileBrowserFunctions.
- Browser* browser =
- const_cast<FileBrowserFunction*>(this)->GetCurrentBrowser();
+ // to call from inside these extension FileDialogFunctions.
+ Browser* browser = const_cast<FileDialogFunction*>(this)->GetCurrentBrowser();
if (browser) {
TabContents* contents = browser->GetSelectedTabContents();
if (contents)
@@ -933,8 +898,8 @@ int32 FileBrowserFunction::GetTabId() const {
// so here we are. This function takes a vector of virtual paths, converts
// them to local paths and calls GetLocalPathsResponseOnUIThread with the
// result vector, on the UI thread.
-void FileBrowserFunction::GetLocalPathsOnFileThread(const UrlList& file_urls,
- void* context) {
+void FileDialogFunction::GetLocalPathsOnFileThread(const UrlList& file_urls,
+ const std::string& task_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
FilePathList selected_files;
@@ -973,11 +938,13 @@ void FileBrowserFunction::GetLocalPathsOnFileThread(const UrlList& file_urls,
}
#endif
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(this,
- &FileBrowserFunction::GetLocalPathsResponseOnUIThread,
- selected_files, context));
+ if (!selected_files.empty()) {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableMethod(this,
+ &FileDialogFunction::GetLocalPathsResponseOnUIThread,
+ selected_files, task_id));
+ }
}
bool SelectFileFunction::RunImpl() {
@@ -993,15 +960,14 @@ bool SelectFileFunction::RunImpl() {
BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(this,
&SelectFileFunction::GetLocalPathsOnFileThread,
- file_paths, reinterpret_cast<void*>(NULL)));
+ file_paths, std::string()));
return true;
}
void SelectFileFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files, void* context) {
+ const FilePathList& files, const std::string& task_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!context);
if (files.size() != 1) {
SendResponse(false);
return;
@@ -1045,23 +1011,18 @@ bool ViewFilesFunction::RunImpl() {
BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(this,
&ViewFilesFunction::GetLocalPathsOnFileThread,
- file_urls,
- reinterpret_cast<void*>(new std::string(internal_task_id))));
+ file_urls, internal_task_id));
return true;
}
void ViewFilesFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files, void* context) {
+ const FilePathList& files, const std::string& internal_task_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(context);
- scoped_ptr<std::string> internal_task_id(
- reinterpret_cast<std::string*>(context));
for (FilePathList::const_iterator iter = files.begin();
iter != files.end();
++iter) {
- FileManagerUtil::ViewItem(*iter,
- *(internal_task_id.get()) == kEnqueueTaskId);
+ FileManagerUtil::ViewItem(*iter, internal_task_id == kEnqueueTaskId);
}
SendResponse(true);
}
@@ -1094,15 +1055,14 @@ bool SelectFilesFunction::RunImpl() {
BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(this,
&SelectFilesFunction::GetLocalPathsOnFileThread,
- file_urls, reinterpret_cast<void*>(NULL)));
+ file_urls, std::string()));
return true;
}
void SelectFilesFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files, void* context) {
+ const FilePathList& files, const std::string& internal_task_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!context);
int32 tab_id = GetTabId();
FileManagerDialog::OnMultiFilesSelected(tab_id, files);
SendResponse(true);
@@ -1115,150 +1075,31 @@ bool CancelFileDialogFunction::RunImpl() {
return true;
}
-AddMountFunction::AddMountFunction() {
-}
-
-AddMountFunction::~AddMountFunction() {
-}
-
-bool AddMountFunction::RunImpl() {
- if (args_->GetSize() != 2 && args_->GetSize() != 3) {
- error_ = "Invalid argument count";
- return false;
- }
-
- std::string file_url;
- if (!args_->GetString(0, &file_url)) {
- return false;
- }
-
- std::string mount_type_str;
- if (!args_->GetString(1, &mount_type_str)) {
- return false;
- }
-
- UrlList file_paths;
- file_paths.push_back(GURL(file_url));
-
- chromeos::MountPathOptions options;
- if (args_->GetSize() == 3) {
- DictionaryValue *dict;
- if (!args_->GetDictionary(2, &dict)) {
- NOTREACHED();
- }
-
- for (base::DictionaryValue::key_iterator it = dict->begin_keys();
- it != dict->end_keys();
- ++it) {
- std::string value;
- if (!dict->GetString(*it, &value)) {
- NOTREACHED();
- }
-
- options.push_back(chromeos::MountPathOptions::value_type((*it).c_str(),
- value.c_str()));
- }
- }
-
- MountParamaters* params = new MountParamaters(mount_type_str, options);
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this,
- &AddMountFunction::GetLocalPathsOnFileThread,
- file_paths, reinterpret_cast<void*>(params)));
-
- return true;
-}
-
-void AddMountFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files, void* context) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(context);
- scoped_ptr<MountParamaters> params(
- reinterpret_cast<MountParamaters*>(context));
-
- if (!files.size()) {
- SendResponse(false);
- return;
- }
-
- const std::string& mount_type_str = params->mount_type;
- const chromeos::MountPathOptions& options = params->mount_options;
- FilePath::StringType source_file = files[0].value();
-
-#ifdef OS_CHROMEOS
- chromeos::MountLibrary *mount_lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
-
- chromeos::MountType mount_type =
- mount_lib->MountTypeFromString(mount_type_str);
- if (mount_type == chromeos::MOUNT_TYPE_INVALID) {
- error_ = "Invalid mount type";
- SendResponse(false);
- return;
- }
-
- mount_lib->MountPath(source_file.data(), mount_type, options);
-#endif
-
- SendResponse(true);
-}
-
-RemoveMountFunction::RemoveMountFunction() {
+UnmountVolumeFunction::UnmountVolumeFunction() {
}
-RemoveMountFunction::~RemoveMountFunction() {
+UnmountVolumeFunction::~UnmountVolumeFunction() {
}
-bool RemoveMountFunction::RunImpl() {
+bool UnmountVolumeFunction::RunImpl() {
if (args_->GetSize() != 1) {
return false;
}
- std::string mount_path;
- if (!args_->GetString(0, &mount_path)) {
- return false;
+ std::string volume_device_path;
+ if (!args_->GetString(0, &volume_device_path)) {
+ NOTREACHED();
}
#ifdef OS_CHROMEOS
chromeos::CrosLibrary::Get()->GetMountLibrary()->UnmountPath(
- mount_path.c_str());
+ volume_device_path.c_str());
#endif
SendResponse(true);
return true;
}
-GetMountPointsFunction::GetMountPointsFunction() {
-}
-
-GetMountPointsFunction::~GetMountPointsFunction() {
-}
-
-bool GetMountPointsFunction::RunImpl() {
- if (args_->GetSize())
- return false;
-
- base::ListValue *mounts = new base::ListValue();
- result_.reset(mounts);
-
- #ifdef OS_CHROMEOS
- chromeos::MountLibrary *mount_lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
- chromeos::MountLibrary::MountPointMap mount_points =
- mount_lib->mount_points();
-
- for (chromeos::MountLibrary::MountPointMap::const_iterator it =
- mount_points.begin();
- it != mount_points.end();
- ++it) {
- mounts->Append(MountPointToValue(profile_, it->second));
- }
-#endif
- SendResponse(true);
- return true;
-}
-
GetVolumeMetadataFunction::GetVolumeMetadataFunction() {
}
@@ -1300,6 +1141,7 @@ bool GetVolumeMetadataFunction::RunImpl() {
volume_info->SetBoolean("hasMedia", volume->has_media());
volume_info->SetBoolean("isOnBootDevice", volume->on_boot_device());
+ SendResponse(true);
return true;
}
#endif
@@ -1336,8 +1178,8 @@ bool FileDialogStringsFunction::RunImpl() {
SET_STRING(IDS_FILE_BROWSER, ROOT_DIRECTORY_LABEL);
SET_STRING(IDS_FILE_BROWSER, DOWNLOADS_DIRECTORY_LABEL);
- SET_STRING(IDS_FILE_BROWSER, ARCHIVE_DIRECTORY_LABEL);
- SET_STRING(IDS_FILE_BROWSER, REMOVABLE_DIRECTORY_LABEL);
+ SET_STRING(IDS_FILE_BROWSER, DOWNLOADS_DIRECTORY_WARNING);
+ SET_STRING(IDS_FILE_BROWSER, MEDIA_DIRECTORY_LABEL);
SET_STRING(IDS_FILE_BROWSER, NAME_COLUMN_LABEL);
SET_STRING(IDS_FILE_BROWSER, SIZE_COLUMN_LABEL);
SET_STRING(IDS_FILE_BROWSER, DATE_COLUMN_LABEL);
@@ -1359,10 +1201,6 @@ bool FileDialogStringsFunction::RunImpl() {
SET_STRING(IDS_FILE_BROWSER, VOLUME_LABEL);
SET_STRING(IDS_FILE_BROWSER, READ_ONLY);
- SET_STRING(IDS_FILE_BROWSER, ARCHIVE_MOUNT_FAILED);
- SET_STRING(IDS_FILE_BROWSER, MOUNT_ARCHIVE);
- SET_STRING(IDS_FILE_BROWSER, UNMOUNT_ARCHIVE);
-
SET_STRING(IDS_FILE_BROWSER, CONFIRM_OVERWRITE_FILE);
SET_STRING(IDS_FILE_BROWSER, FILE_ALREADY_EXISTS);
SET_STRING(IDS_FILE_BROWSER, DIRECTORY_ALREADY_EXISTS);
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.h b/chrome/browser/extensions/extension_file_browser_private_api.h
index 69bd537..065b9e2 100644
--- a/chrome/browser/extensions/extension_file_browser_private_api.h
+++ b/chrome/browser/extensions/extension_file_browser_private_api.h
@@ -118,24 +118,24 @@ class ExecuteTasksFileBrowserFunction : public AsyncExtensionFunction {
};
// Parent class for the chromium extension APIs for the file dialog.
-class FileBrowserFunction
+class FileDialogFunction
: public AsyncExtensionFunction {
public:
- FileBrowserFunction();
+ FileDialogFunction();
protected:
typedef std::vector<GURL> UrlList;
typedef std::vector<FilePath> FilePathList;
- virtual ~FileBrowserFunction();
+ virtual ~FileDialogFunction();
// Convert virtual paths to local paths on the file thread.
void GetLocalPathsOnFileThread(const UrlList& file_urls,
- void* context);
+ const std::string& internal_task_id);
// Callback with converted local paths.
virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files,
- void* context) { NOTREACHED(); }
+ const std::string& internal_task_id) {}
// Figure out the tab_id of the hosting tab.
int32 GetTabId() const;
@@ -143,7 +143,7 @@ class FileBrowserFunction
// Select a single file. Closes the dialog window.
class SelectFileFunction
- : public FileBrowserFunction {
+ : public FileDialogFunction {
public:
SelectFileFunction() {}
@@ -153,9 +153,9 @@ class SelectFileFunction
// AsyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
- // FileBrowserFunction overrides.
- virtual void GetLocalPathsResponseOnUIThread(const FilePathList& files,
- void* context) OVERRIDE;
+ // FileDialogFunction overrides.
+ virtual void GetLocalPathsResponseOnUIThread(
+ const FilePathList& files, const std::string& internal_task_id) OVERRIDE;
private:
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFile");
@@ -163,7 +163,7 @@ class SelectFileFunction
// View multiple selected files. Window stays open.
class ViewFilesFunction
- : public FileBrowserFunction {
+ : public FileDialogFunction {
public:
ViewFilesFunction();
@@ -173,9 +173,9 @@ class ViewFilesFunction
// AsyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
- // FileBrowserFunction overrides.
+ // FileDialogFunction overrides.
virtual void GetLocalPathsResponseOnUIThread(
- const FilePathList& files, void* context) OVERRIDE;
+ const FilePathList& files, const std::string& internal_task_id) OVERRIDE;
private:
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.viewFiles");
@@ -183,7 +183,7 @@ class ViewFilesFunction
// Select multiple files. Closes the dialog window.
class SelectFilesFunction
- : public FileBrowserFunction {
+ : public FileDialogFunction {
public:
SelectFilesFunction();
@@ -193,9 +193,9 @@ class SelectFilesFunction
// AsyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
- // FileBrowserFunction overrides.
+ // FileDialogFunction overrides.
virtual void GetLocalPathsResponseOnUIThread(
- const FilePathList& files, void* context) OVERRIDE;
+ const FilePathList& files, const std::string& internal_task_id) OVERRIDE;
private:
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFiles");
@@ -203,7 +203,7 @@ class SelectFilesFunction
// Cancel file selection Dialog. Closes the dialog window.
class CancelFileDialogFunction
- : public FileBrowserFunction {
+ : public FileDialogFunction {
public:
CancelFileDialogFunction() {}
@@ -217,60 +217,19 @@ class CancelFileDialogFunction
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.cancelDialog");
};
-// Mount a device or a file.
-class AddMountFunction
- : public FileBrowserFunction {
- public:
- AddMountFunction();
-
- protected:
- virtual ~AddMountFunction();
-
- virtual bool RunImpl() OVERRIDE;
-
- // FileBrowserFunction overrides.
- virtual void GetLocalPathsResponseOnUIThread(
- const FilePathList& files, void* context) OVERRIDE;
-
- private:
- struct MountParamaters {
- MountParamaters(const std::string& type,
- const chromeos::MountPathOptions& options)
- : mount_type(type), mount_options(options) {}
- std::string mount_type;
- chromeos::MountPathOptions mount_options;
- };
-
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addMount");
-};
-
-// Unmounts selected device. Expects mount point path as an argument.
-class RemoveMountFunction
+// Unmounts selected device. Expects volume's device path as an argument.
+class UnmountVolumeFunction
: public SyncExtensionFunction {
- public:
- RemoveMountFunction();
-
- protected:
- virtual ~RemoveMountFunction();
-
- virtual bool RunImpl() OVERRIDE;
-
- private:
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.removeMount");
-};
-
-class GetMountPointsFunction
- : public AsyncExtensionFunction {
- public:
- GetMountPointsFunction();
+ public:
+ UnmountVolumeFunction();
protected:
- virtual ~GetMountPointsFunction();
+ virtual ~UnmountVolumeFunction();
virtual bool RunImpl() OVERRIDE;
private:
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getMountPoints");
+ DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.unmountVolume");
};
// Retrieves devices meta-data. Expects volume's device path as an argument.
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 640492f..e3ce123 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -347,9 +347,7 @@ void FactoryRegistry::ResetFunctions() {
RegisterFunction<RemoveFileWatchBrowserFunction>();
RegisterFunction<SelectFileFunction>();
RegisterFunction<SelectFilesFunction>();
- RegisterFunction<AddMountFunction>();
- RegisterFunction<RemoveMountFunction>();
- RegisterFunction<GetMountPointsFunction>();
+ RegisterFunction<UnmountVolumeFunction>();
RegisterFunction<ViewFilesFunction>();
// Mediaplayer
diff --git a/chrome/browser/extensions/file_manager_util.cc b/chrome/browser/extensions/file_manager_util.cc
index 76b5c43..fb19e6c 100644
--- a/chrome/browser/extensions/file_manager_util.cc
+++ b/chrome/browser/extensions/file_manager_util.cc
@@ -27,7 +27,6 @@
// This is the "well known" url for the file manager extension from
// browser/resources/file_manager. In the future we may provide a way to swap
// out this file manager for an aftermarket part, but not yet.
-const char kFileBrowserExtensionUrl[] = FILEBROWSER_URL("");
const char kBaseFileBrowserUrl[] = FILEBROWSER_URL("main.html");
const char kMediaPlayerUrl[] = FILEBROWSER_URL("mediaplayer.html");
const char kMediaPlayerPlaylistUrl[] = FILEBROWSER_URL("playlist.html");
@@ -68,11 +67,6 @@ bool IsSupportedAVExtension(const char* ext) {
}
// static
-GURL FileManagerUtil::GetFileBrowserExtensionUrl() {
- return GURL(kFileBrowserExtensionUrl);
-}
-
-// static
GURL FileManagerUtil::GetFileBrowserUrl() {
return GURL(kBaseFileBrowserUrl);
}
@@ -91,21 +85,6 @@ GURL FileManagerUtil::GetMediaPlayerPlaylistUrl() {
bool FileManagerUtil::ConvertFileToFileSystemUrl(
Profile* profile, const FilePath& full_file_path, const GURL& origin_url,
GURL* url) {
- FilePath virtual_path;
- if (!ConvertFileToRelativeFileSystemPath(profile, full_file_path,
- &virtual_path)) {
- return false;
- }
-
- GURL base_url = fileapi::GetFileSystemRootURI(origin_url,
- fileapi::kFileSystemTypeExternal);
- *url = GURL(base_url.spec() + virtual_path.value());
- return true;
-}
-
-// static
-bool FileManagerUtil::ConvertFileToRelativeFileSystemPath(
- Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) {
fileapi::FileSystemPathManager* path_manager =
profile->GetFileSystemContext()->path_manager();
fileapi::ExternalFileSystemMountPointProvider* provider =
@@ -114,9 +93,13 @@ bool FileManagerUtil::ConvertFileToRelativeFileSystemPath(
return false;
// Find if this file path is managed by the external provider.
- if (!provider->GetVirtualPath(full_file_path, virtual_path))
+ FilePath virtual_path;
+ if (!provider->GetVirtualPath(full_file_path, &virtual_path))
return false;
+ GURL base_url = fileapi::GetFileSystemRootURI(origin_url,
+ fileapi::kFileSystemTypeExternal);
+ *url = GURL(base_url.spec() + virtual_path.value());
return true;
}
diff --git a/chrome/browser/extensions/file_manager_util.h b/chrome/browser/extensions/file_manager_util.h
index 877eba8..205b893 100644
--- a/chrome/browser/extensions/file_manager_util.h
+++ b/chrome/browser/extensions/file_manager_util.h
@@ -16,7 +16,6 @@ class Profile;
class FileManagerUtil {
public:
// Gets base file browser url.
- static GURL GetFileBrowserExtensionUrl();
static GURL GetFileBrowserUrl();
static GURL GetMediaPlayerUrl();
static GURL GetMediaPlayerPlaylistUrl();
@@ -25,13 +24,6 @@ class FileManagerUtil {
// if |full_file_path| is not managed by the external filesystem provider.
static bool ConvertFileToFileSystemUrl(Profile* profile,
const FilePath& full_file_path, const GURL& origin_url, GURL* url);
-
- // Converts |full_file_path| into |relative_path| within the external provider
- // in File API. Returns false if |full_file_path| is not managed by the
- // external filesystem provider.
- static bool ConvertFileToRelativeFileSystemPath(Profile* profile,
- const FilePath& full_file_path, FilePath* relative_path);
-
// Gets base file browser url for.
static GURL GetFileBrowserUrlWithParams(
SelectFileDialog::Type type,