| Index: chrome/browser/extensions/file_manager_util.cc
|
| diff --git a/chrome/browser/extensions/file_manager_util.cc b/chrome/browser/extensions/file_manager_util.cc
|
| index 25253cef2ae91b2c6f9ebb8c52045aa2192c0ff8..469128a4a06149df9708f9f634ea52a0a71618ed 100644
|
| --- a/chrome/browser/extensions/file_manager_util.cc
|
| +++ b/chrome/browser/extensions/file_manager_util.cc
|
| @@ -22,11 +22,16 @@
|
| #include "webkit/fileapi/file_system_mount_point_provider.h"
|
| #include "webkit/fileapi/file_system_util.h"
|
|
|
| +#define FILEBROWSER_URL(PATH) \
|
| + ("chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/" PATH)
|
| // 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 kBaseFileBrowserUrl[] =
|
| - "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/main.html";
|
| +const char kBaseFileBrowserUrl[] = FILEBROWSER_URL("main.html");
|
| +const char kMediaPlayerUrl[] = FILEBROWSER_URL("mediaplayer.html");
|
| +const char kMediaPlayerPlaylistUrl[] = FILEBROWSER_URL("playlist.html");
|
| +#undef FILEBROWSER_URL
|
| +
|
| // List of file extension we can open in tab.
|
| const char* kBrowserSupportedExtensions[] = {
|
| ".jpg", ".jpeg", ".png", ".webp", ".gif", ".pdf", ".txt", ".html", ".htm"
|
| @@ -65,6 +70,16 @@ GURL FileManagerUtil::GetFileBrowserUrl() {
|
| }
|
|
|
| // static
|
| +GURL FileManagerUtil::GetMediaPlayerUrl() {
|
| + return GURL(kMediaPlayerUrl);
|
| +}
|
| +
|
| +// static
|
| +GURL FileManagerUtil::GetMediaPlayerPlaylistUrl() {
|
| + return GURL(kMediaPlayerPlaylistUrl);
|
| +}
|
| +
|
| +// static
|
| bool FileManagerUtil::ConvertFileToFileSystemUrl(
|
| Profile* profile, const FilePath& full_file_path, const GURL& origin_url,
|
| GURL* url) {
|
| @@ -76,28 +91,14 @@ bool FileManagerUtil::ConvertFileToFileSystemUrl(
|
| return false;
|
|
|
| // Find if this file path is managed by the external provider.
|
| - std::vector<FilePath> root_dirs = provider->GetRootDirectories();
|
| - for (std::vector<FilePath>::iterator iter = root_dirs.begin();
|
| - iter != root_dirs.end();
|
| - ++iter) {
|
| - FilePath path;
|
| - std::vector<FilePath::StringType> components;
|
| - const FilePath& root_path = *iter;
|
| - root_path.GetComponents(&components);
|
| - if (!components.size()) {
|
| - NOTREACHED();
|
| - continue;
|
| - }
|
| - if (root_path.AppendRelativePath(full_file_path, &path)) {
|
| - GURL base_url = fileapi::GetFileSystemRootURI(origin_url,
|
| - fileapi::kFileSystemTypeExternal);
|
| - std::string final_url = base_url.spec();
|
| - FilePath relative_path(components[components.size() - 1]);
|
| - *url = GURL(base_url.spec() + relative_path.Append(path).value());
|
| - return true;
|
| - }
|
| - }
|
| - return false;
|
| + 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;
|
| }
|
|
|
| // static
|
|
|