diff options
author | rolandsteiner@chromium.org <rolandsteiner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 05:24:41 +0000 |
---|---|---|
committer | rolandsteiner@chromium.org <rolandsteiner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 05:24:41 +0000 |
commit | ea9058d410a6df42e3ed72e0414fcf4b3607c3cb (patch) | |
tree | c7e0c39cab780a9bba614a4e28b9fd96db66b0ea /chrome/browser/download/download_manager.h | |
parent | dfc95697b09185a561b2a30080ead8298b9c8668 (diff) | |
download | chromium_src-ea9058d410a6df42e3ed72e0414fcf4b3607c3cb.zip chromium_src-ea9058d410a6df42e3ed72e0414fcf4b3607c3cb.tar.gz chromium_src-ea9058d410a6df42e3ed72e0414fcf4b3607c3cb.tar.bz2 |
Commit patch set from http://codereview.chromium.org/149796
(see discussion and history there)
BUG=10876
TEST=FilePathTest.MatchesExtension.CompareIgnoreCase
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_manager.h')
-rw-r--r-- | chrome/browser/download/download_manager.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 34a2e42..5f613a8 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -419,16 +419,19 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, // 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 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, 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_; |