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

Side by Side Diff: chrome/browser/download/download_prefs.cc

Issue 8351052: Created a DownloadManager interface, for use in unit tests.. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Mac & Clang issues. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (download_util::DownloadPathIsDangerous(current_download_dir)) { 87 if (download_util::DownloadPathIsDangerous(current_download_dir)) {
88 prefs->SetFilePath(prefs::kDownloadDefaultDirectory, 88 prefs->SetFilePath(prefs::kDownloadDefaultDirectory,
89 default_download_path); 89 default_download_path);
90 } 90 }
91 prefs->SetBoolean(prefs::kDownloadDirUpgraded, true); 91 prefs->SetBoolean(prefs::kDownloadDirUpgraded, true);
92 } 92 }
93 } 93 }
94 94
95 // static 95 // static
96 DownloadPrefs* DownloadPrefs::FromDownloadManager( 96 DownloadPrefs* DownloadPrefs::FromDownloadManager(
97 DownloadManager* download_manager) { 97 DownloadManagerInterface* download_manager) {
98 ChromeDownloadManagerDelegate* delegate = 98 ChromeDownloadManagerDelegate* delegate =
99 static_cast<ChromeDownloadManagerDelegate*>(download_manager->delegate()); 99 static_cast<ChromeDownloadManagerDelegate*>(download_manager->delegate());
100 return delegate->download_prefs(); 100 return delegate->download_prefs();
101 } 101 }
102 102
103 bool DownloadPrefs::PromptForDownload() const { 103 bool DownloadPrefs::PromptForDownload() const {
104 // If the DownloadDirectory policy is set, then |prompt_for_download_| should 104 // If the DownloadDirectory policy is set, then |prompt_for_download_| should
105 // always be false. 105 // always be false.
106 DCHECK(!download_path_.IsManaged() || !prompt_for_download_.GetValue()); 106 DCHECK(!download_path_.IsManaged() || !prompt_for_download_.GetValue());
107 return *prompt_for_download_; 107 return *prompt_for_download_;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 extensions.erase(extensions.size() - 1); 163 extensions.erase(extensions.size() - 1);
164 164
165 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); 165 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions);
166 } 166 }
167 167
168 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( 168 bool DownloadPrefs::AutoOpenCompareFunctor::operator()(
169 const FilePath::StringType& a, 169 const FilePath::StringType& a,
170 const FilePath::StringType& b) const { 170 const FilePath::StringType& b) const {
171 return FilePath::CompareLessIgnoreCase(a, b); 171 return FilePath::CompareLessIgnoreCase(a, b);
172 } 172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698