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

Unified Diff: chrome/browser/file_select_helper.h

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 | « no previous file | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/file_select_helper.h
diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h
index 7f544a446583d638a84aa909a976f95c371dc529..87c8ec60973f42561067aa8fbe788a839f819385 100644
--- a/chrome/browser/file_select_helper.h
+++ b/chrome/browser/file_select_helper.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/compiler_specific.h"
+#include "base/gtest_prod_util.h"
#include "chrome/browser/ui/select_file_dialog.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -43,6 +44,7 @@ class FileSelectHelper
private:
friend class base::RefCountedThreadSafe<FileSelectHelper>;
+ FRIEND_TEST_ALL_PREFIXES(FileSelectHelperTest, IsAcceptTypeValid);
explicit FileSelectHelper(Profile* profile);
virtual ~FileSelectHelper();
@@ -123,10 +125,15 @@ class FileSelectHelper
// Helper method to get allowed extensions for select file dialog from
// the specified accept types as defined in the spec:
// http://whatwg.org/html/number-state.html#attr-input-accept
- // |accept_types| contains only valid lowercased MIME types.
+ // |accept_types| contains only valid lowercased MIME types or file extensions
+ // beginning with a period (.).
SelectFileDialog::FileTypeInfo* GetFileTypesFromAcceptType(
const std::vector<string16>& accept_types);
+ // Check the accept type is valid. It is expected to be all lower case with
+ // no whitespace.
+ static bool IsAcceptTypeValid(const std::string& accept_type);
+
// Profile used to set/retrieve the last used directory.
Profile* profile_;
« no previous file with comments | « no previous file | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698