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

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, 7 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/file_handlers/app_file_handler_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..39a6c7d2597b74ef5514aff113b8009c1651563c 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::FindFileHandlersForFiles;
+using extensions::app_file_handler_util::PathAndMimeTypeSet;
using chromeos::disks::DiskMountManager;
using content::BrowserContext;
using content::BrowserThread;
@@ -393,7 +394,7 @@ void FillDriveEntryPropertiesValue(
}
void GetMimeTypesForFileURLs(const std::vector<base::FilePath>& file_paths,
- std::set<std::string>* mime_types) {
+ PathAndMimeTypeSet* 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 +410,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(*iter, mime_type));
}
}
}
@@ -898,8 +899,8 @@ bool GetFileTasksFileBrowserFunction::FindAppTasks(
if (!service)
return false;
- std::set<std::string> mime_types;
- GetMimeTypesForFileURLs(file_paths, &mime_types);
+ PathAndMimeTypeSet files;
+ GetMimeTypesForFileURLs(file_paths, &files);
for (ExtensionSet::const_iterator iter = service->extensions()->begin();
iter != service->extensions()->end();
@@ -915,9 +916,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 = FindFileHandlersForFiles(*extension, files);
if (file_handlers.empty())
continue;
« no previous file with comments | « no previous file | chrome/browser/extensions/api/file_handlers/app_file_handler_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698