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

Unified Diff: chrome/browser/ui/gtk/select_file_dialog_impl_gtk.cc

Issue 10414085: Modified the pepper file chooser API to support filtering files by extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 | « chrome/browser/file_select_helper_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/select_file_dialog_impl_gtk.cc
diff --git a/chrome/browser/ui/gtk/select_file_dialog_impl_gtk.cc b/chrome/browser/ui/gtk/select_file_dialog_impl_gtk.cc
index 3544eb3170c3954f3a45505bb9937e8f3dee91d0..b657f7f68620a0240fa6ccd966713ac838a2f989 100644
--- a/chrome/browser/ui/gtk/select_file_dialog_impl_gtk.cc
+++ b/chrome/browser/ui/gtk/select_file_dialog_impl_gtk.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/ui/select_file_dialog.h"
#include "content/public/browser/browser_thread.h"
#include "grit/generated_resources.h"
-#include "net/base/mime_util.h"
#include "ui/base/gtk/gtk_signal.h"
#include "ui/base/l10n/l10n_util.h"
@@ -228,27 +227,11 @@ void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) {
for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) {
const std::string& current_extension = file_types_.extensions[i][j];
if (!current_extension.empty()) {
- std::string mime_type;
- bool found_valid_mime_type;
- {
- // Allow IO in the file dialog. (http://crbug.com/72637)
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- found_valid_mime_type = net::GetMimeTypeFromExtension(
- current_extension, &mime_type);
- }
if (!filter)
filter = gtk_file_filter_new();
-
- // Try to add a mime-type filter instead of an extension filter if
- // possible. (http://crbug.com/12347)
- if (found_valid_mime_type) {
- gtk_file_filter_add_mime_type(filter, mime_type.c_str());
- fallback_labels.insert(mime_type);
- } else {
- std::string pattern = "*." + current_extension;
- gtk_file_filter_add_pattern(filter, pattern.c_str());
- fallback_labels.insert(pattern);
- }
+ std::string pattern = "*." + current_extension;
+ gtk_file_filter_add_pattern(filter, pattern.c_str());
+ fallback_labels.insert(pattern);
}
}
// We didn't find any non-empty extensions to filter on.
@@ -262,7 +245,7 @@ void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) {
file_types_.extension_description_overrides[i]).c_str());
} else {
// There is no system default filter description so we use
- // the MIME types themselves if the description is blank.
+ // the extensions themselves if the description is blank.
std::vector<std::string> fallback_labels_vector(fallback_labels.begin(),
fallback_labels.end());
std::string fallback_label = JoinString(fallback_labels_vector, ',');
« no previous file with comments | « chrome/browser/file_select_helper_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698