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

Unified Diff: chrome/browser/download/download_manager.h

Issue 149796: Bug fix for 10876, file extension handling refactoring (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « base/file_path_unittest.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_manager.h
===================================================================
--- chrome/browser/download/download_manager.h (revision 30182)
+++ chrome/browser/download/download_manager.h (working copy)
@@ -419,16 +419,19 @@
// Registers this file extension for automatic opening upon download
// completion if 'open' is true, or prevents the extension from automatic
// opening if 'open' is false.
- void OpenFilesOfExtension(const FilePath::StringType& extension, bool open);
+ void OpenFilesBasedOnExtension(const FilePath& path, bool open);
// Tests if a file type should be opened automatically.
- bool ShouldOpenFileExtension(const FilePath::StringType& extension);
+ bool ShouldOpenFileBasedOnExtension(const FilePath& path) const;
// Tests if we think the server means for this mime_type to be executable.
static bool IsExecutableMimeType(const std::string& mime_type);
+ // Tests if a file is considered executable, based on its type.
+ bool IsExecutableFile(const FilePath& path) const;
+
// Tests if a file type is considered executable.
- bool IsExecutable(const FilePath::StringType& extension);
+ bool IsExecutableExtension(const FilePath::StringType& extension) const;
// Resets the automatic open preference.
void ResetAutoOpenFiles();
@@ -605,7 +608,14 @@
FilePath last_download_path_;
// Set of file extensions to open at download completion.
- std::set<FilePath::StringType> auto_open_;
+ struct AutoOpenCompareFunctor {
+ inline bool operator()(const FilePath::StringType& a,
+ const FilePath::StringType& b) const {
+ return FilePath::CompareLessIgnoreCase(a, b);
+ }
+ };
+ typedef std::set<FilePath::StringType, AutoOpenCompareFunctor> AutoOpenSet;
+ AutoOpenSet auto_open_;
// Set of file extensions that are executables and shouldn't be auto opened.
std::set<std::string> exe_types_;
« no previous file with comments | « base/file_path_unittest.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698