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

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

Issue 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision Created 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/file_util.h" 7 #include "base/file_util.h"
8 #include "base/string_split.h" 8 #include "base/string_split.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/download/download_util.h" 12 #include "chrome/browser/download/download_util.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 15
16 DownloadPrefs::DownloadPrefs(PrefService* prefs) : prefs_(prefs) { 16 DownloadPrefs::DownloadPrefs(PrefService* prefs) : prefs_(prefs) {
17 prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL); 17 prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL);
18 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL); 18 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL);
19 19
20 // We store any file extension that should be opened automatically at 20 // We store any file extension that should be opened automatically at
21 // download completion in this pref. 21 // download completion in this pref.
22 std::string extensions_to_open = 22 std::string extensions_to_open =
23 prefs->GetString(prefs::kDownloadExtensionsToOpen); 23 prefs->GetString(prefs::kDownloadExtensionsToOpen);
24 std::vector<std::string> extensions; 24 std::vector<std::string> extensions;
25 SplitString(extensions_to_open, ':', &extensions); 25 base::SplitString(extensions_to_open, ':', &extensions);
26 26
27 for (size_t i = 0; i < extensions.size(); ++i) { 27 for (size_t i = 0; i < extensions.size(); ++i) {
28 #if defined(OS_POSIX) 28 #if defined(OS_POSIX)
29 FilePath path(extensions[i]); 29 FilePath path(extensions[i]);
30 #elif defined(OS_WIN) 30 #elif defined(OS_WIN)
31 FilePath path(UTF8ToWide(extensions[i])); 31 FilePath path(UTF8ToWide(extensions[i]));
32 #endif 32 #endif
33 if (!extensions[i].empty() && !download_util::IsExecutableFile(path)) 33 if (!extensions[i].empty() && !download_util::IsExecutableFile(path))
34 auto_open_.insert(path.value()); 34 auto_open_.insert(path.value());
35 } 35 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 extensions.erase(extensions.size() - 1); 131 extensions.erase(extensions.size() - 1);
132 132
133 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions); 133 prefs_->SetString(prefs::kDownloadExtensionsToOpen, extensions);
134 } 134 }
135 135
136 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( 136 bool DownloadPrefs::AutoOpenCompareFunctor::operator()(
137 const FilePath::StringType& a, 137 const FilePath::StringType& a,
138 const FilePath::StringType& b) const { 138 const FilePath::StringType& b) const {
139 return FilePath::CompareLessIgnoreCase(a, b); 139 return FilePath::CompareLessIgnoreCase(a, b);
140 } 140 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/options/cookies_view_handler.cc ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698