Chromium Code Reviews| Index: chrome/browser/download/download_prefs.cc |
| diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc |
| index 2bfb7928e96259b62a0dbf21fd573489b576979a..aec63ee19a6c13c08e878e4634adbff35de98b9e 100644 |
| --- a/chrome/browser/download/download_prefs.cc |
| +++ b/chrome/browser/download/download_prefs.cc |
| @@ -153,8 +153,13 @@ bool DownloadPrefs::IsAutoOpenUsed() const { |
| return !auto_open_.empty(); |
| } |
| -bool DownloadPrefs::IsAutoOpenEnabledForExtension( |
| - const base::FilePath::StringType& extension) const { |
| +bool DownloadPrefs::IsAutoOpenEnabledBasedOnExtension( |
| + const base::FilePath& path) const { |
| + base::FilePath::StringType extension = path.Extension(); |
| + if (extension.empty()) |
| + return false; |
| + DCHECK(extension[0] == base::FilePath::kExtensionSeparator); |
| + extension.erase(0, 1); |
| return auto_open_.find(extension) != auto_open_.end(); |
| } |
| @@ -202,6 +207,8 @@ void DownloadPrefs::SaveAutoOpenState() { |
| if (!extensions.empty()) |
| extensions.erase(extensions.size() - 1); |
| + DCHECK(profile_); |
|
benjhayden
2013/04/09 15:46:32
I thought it was unnecessary to dcheck pointers th
asanka
2013/04/16 20:34:01
Done.
|
| + DCHECK(profile_->GetPrefs()); |
| profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
| } |