Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3519)

Unified Diff: chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc

Issue 14790018: ChromeOS: Use file extensions in Files app to decide which apps to use. (Closed) Base URL: http://git.chromium.org/chromium/src.git@file-handler-extensions2
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
index 9a0175d3bee81779019f93e338ac4550fafd7f15..6cf57cd44e8e443135754488f288dfdfe2df258d 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
@@ -83,7 +83,8 @@
#include "webkit/fileapi/file_system_url.h"
#include "webkit/fileapi/file_system_util.h"
-using extensions::app_file_handler_util::FindFileHandlersForMimeTypes;
+using extensions::app_file_handler_util::FindFileHandlers;
+using extensions::app_file_handler_util::MimeTypeAndPathSet;
using chromeos::disks::DiskMountManager;
using content::BrowserContext;
using content::BrowserThread;
@@ -392,8 +393,9 @@ void FillDriveEntryPropertiesValue(
file_specific_info.content_mime_type());
}
-void GetMimeTypesForFileURLs(const std::vector<base::FilePath>& file_paths,
- std::set<std::string>* mime_types) {
+void GetMimeTypeAndPathsForFileURLs(
Matt Giuca 2013/05/07 05:39:59 I wouldn't change the name here, because it isn't
Sam McNally 2013/05/07 06:15:27 Done.
+ const std::vector<base::FilePath>& file_paths,
+ MimeTypeAndPathSet* files) {
for (std::vector<base::FilePath>::const_iterator iter = file_paths.begin();
iter != file_paths.end(); ++iter) {
const base::FilePath::StringType file_extension =
@@ -409,9 +411,9 @@ void GetMimeTypesForFileURLs(const std::vector<base::FilePath>& file_paths,
// If the file doesn't have an extension or its mime-type cannot be
// determined, then indicate that it has the empty mime-type. This will
// only be matched if the Web Intents accepts "*" or "*/*".
- mime_types->insert("");
+ files->insert(std::make_pair("", *iter));
} else {
- mime_types->insert(mime_type);
+ files->insert(std::make_pair(mime_type, *iter));
}
}
}
@@ -898,8 +900,8 @@ bool GetFileTasksFileBrowserFunction::FindAppTasks(
if (!service)
return false;
- std::set<std::string> mime_types;
- GetMimeTypesForFileURLs(file_paths, &mime_types);
+ MimeTypeAndPathSet files;
+ GetMimeTypeAndPathsForFileURLs(file_paths, &files);
for (ExtensionSet::const_iterator iter = service->extensions()->begin();
iter != service->extensions()->end();
@@ -915,9 +917,7 @@ bool GetFileTasksFileBrowserFunction::FindAppTasks(
continue;
typedef std::vector<const extensions::FileHandlerInfo*> FileHandlerList;
- FileHandlerList file_handlers =
- FindFileHandlersForMimeTypes(*extension, mime_types);
- // TODO(benwells): also support matching by file extension.
+ FileHandlerList file_handlers = FindFileHandlers(*extension, files);
if (file_handlers.empty())
continue;

Powered by Google App Engine
This is Rietveld 408576698