summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 00:05:32 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-30 00:05:32 +0000
commitf9a4c41a40dc781ea6bbbeeeb77ee3713dc168e2 (patch)
tree2f06565b8aaf35996d1ff3a553801f6d5aa29565 /content
parent1e1184a4047adf5096a5597e4adf1ad07130445a (diff)
downloadchromium_src-f9a4c41a40dc781ea6bbbeeeb77ee3713dc168e2.zip
chromium_src-f9a4c41a40dc781ea6bbbeeeb77ee3713dc168e2.tar.gz
chromium_src-f9a4c41a40dc781ea6bbbeeeb77ee3713dc168e2.tar.bz2
Modified the pepper file chooser API to support filtering files by extensions.
Previously you could filter only by MIME type. This adds support for filtering by specific extensions as well, e.g. .txt,.html. This change is aligned with the web platform which now allows filtering by file extension for <input> elements (http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#attr-input-accept). This also changes the linux implementation of the file dialog (SelectFileDialogImplGTK). In the past, it would turn file extensions to filter into MIME types. However this is a bit silly because in FileSelectHelper we do the reverse (turn MIME types into a list of file extensions to filter by). It also prevents us from filtering by a specific extensions when this is really what is desired. BUG=129251 TEST= Review URL: https://chromiumcodereview.appspot.com/10414085 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/public/common/file_chooser_params.h6
-rw-r--r--content/renderer/render_view_impl.cc6
2 files changed, 6 insertions, 6 deletions
diff --git a/content/public/common/file_chooser_params.h b/content/public/common/file_chooser_params.h
index 7807cbd..acc7fad 100644
--- a/content/public/common/file_chooser_params.h
+++ b/content/public/common/file_chooser_params.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -43,8 +43,8 @@ struct CONTENT_EXPORT FileChooserParams {
// Default file name to select in the dialog.
FilePath default_file_name;
- // A list of valid lower-cased MIME types specified in an input element. It is
- // used to restrict selectable files to such types.
+ // A list of valid lower-cased MIME types or file extensions specified in an
+ // input element. It is used to restrict selectable files to such types.
std::vector<string16> accept_types;
};
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index e26b07a..1b4a943 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1910,9 +1910,9 @@ bool RenderViewImpl::runFileChooser(
ipc_params.title = params.title;
ipc_params.default_file_name =
webkit_glue::WebStringToFilePath(params.initialValue);
- ipc_params.accept_types.reserve(params.acceptMIMETypes.size());
- for (size_t i = 0; i < params.acceptMIMETypes.size(); ++i)
- ipc_params.accept_types.push_back(params.acceptMIMETypes[i]);
+ ipc_params.accept_types.reserve(params.acceptTypes.size());
+ for (size_t i = 0; i < params.acceptTypes.size(); ++i)
+ ipc_params.accept_types.push_back(params.acceptTypes[i]);
return ScheduleFileChooser(ipc_params, chooser_completion);
}