OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/download/download_prefs.h" | 5 #include "chrome/browser/download/download_prefs.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) | 139 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) |
140 should_open_pdf_in_system_reader_ = | 140 should_open_pdf_in_system_reader_ = |
141 prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader) || | 141 prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader) || |
142 prefs->GetBoolean(prefs::kPluginsAlwaysOpenPdfExternally); | 142 prefs->GetBoolean(prefs::kPluginsAlwaysOpenPdfExternally); |
143 disable_adobe_version_check_for_tests_ = false; | 143 disable_adobe_version_check_for_tests_ = false; |
144 #endif | 144 #endif |
145 | 145 |
146 // If the download path is dangerous we forcefully reset it. But if we do | 146 // If the download path is dangerous we forcefully reset it. But if we do |
147 // so we set a flag to make sure we only do it once, to avoid fighting | 147 // so we set a flag to make sure we only do it once, to avoid fighting |
148 // the user if he really wants it on an unsafe place such as the desktop. | 148 // the user if they really want it on an unsafe place such as the desktop. |
149 if (!prefs->GetBoolean(prefs::kDownloadDirUpgraded)) { | 149 if (!prefs->GetBoolean(prefs::kDownloadDirUpgraded)) { |
150 base::FilePath current_download_dir = prefs->GetFilePath( | 150 base::FilePath current_download_dir = prefs->GetFilePath( |
151 prefs::kDownloadDefaultDirectory); | 151 prefs::kDownloadDefaultDirectory); |
152 if (DownloadPathIsDangerous(current_download_dir)) { | 152 if (DownloadPathIsDangerous(current_download_dir)) { |
153 prefs->SetFilePath(prefs::kDownloadDefaultDirectory, | 153 prefs->SetFilePath(prefs::kDownloadDefaultDirectory, |
154 GetDefaultDownloadDirectoryForProfile()); | 154 GetDefaultDownloadDirectoryForProfile()); |
155 } | 155 } |
156 prefs->SetBoolean(prefs::kDownloadDirUpgraded, true); | 156 prefs->SetBoolean(prefs::kDownloadDirUpgraded, true); |
157 } | 157 } |
158 | 158 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 extensions.erase(extensions.size() - 1); | 388 extensions.erase(extensions.size() - 1); |
389 | 389 |
390 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); | 390 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); |
391 } | 391 } |
392 | 392 |
393 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( | 393 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( |
394 const base::FilePath::StringType& a, | 394 const base::FilePath::StringType& a, |
395 const base::FilePath::StringType& b) const { | 395 const base::FilePath::StringType& b) const { |
396 return base::FilePath::CompareLessIgnoreCase(a, b); | 396 return base::FilePath::CompareLessIgnoreCase(a, b); |
397 } | 397 } |
OLD | NEW |