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

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

Issue 2394303003: Don't prompt for download location on Android (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
159 // Ignore "Always prompt for download location" preference on Android.
160 #if defined(OS_ANDROID)
161 prompt_for_download_.SetValue(false);
asanka 2016/10/07 16:10:18 I don't think we can set the pref without initiali
qinmin 2016/10/07 16:25:14 Good catch. Switched to always return false in Dow
162 #else
159 prompt_for_download_.Init(prefs::kPromptForDownload, prefs); 163 prompt_for_download_.Init(prefs::kPromptForDownload, prefs);
164 #endif
160 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs); 165 download_path_.Init(prefs::kDownloadDefaultDirectory, prefs);
161 save_file_path_.Init(prefs::kSaveFileDefaultDirectory, prefs); 166 save_file_path_.Init(prefs::kSaveFileDefaultDirectory, prefs);
162 save_file_type_.Init(prefs::kSaveFileType, prefs); 167 save_file_type_.Init(prefs::kSaveFileType, prefs);
163 168
164 // We store any file extension that should be opened automatically at 169 // We store any file extension that should be opened automatically at
165 // download completion in this pref. 170 // download completion in this pref.
166 std::string extensions_to_open = 171 std::string extensions_to_open =
167 prefs->GetString(prefs::kDownloadExtensionsToOpen); 172 prefs->GetString(prefs::kDownloadExtensionsToOpen);
168 173
169 for (const auto& extension_string : base::SplitString( 174 for (const auto& extension_string : base::SplitString(
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 extensions.erase(extensions.size() - 1); 393 extensions.erase(extensions.size() - 1);
389 394
390 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions); 395 profile_->GetPrefs()->SetString(prefs::kDownloadExtensionsToOpen, extensions);
391 } 396 }
392 397
393 bool DownloadPrefs::AutoOpenCompareFunctor::operator()( 398 bool DownloadPrefs::AutoOpenCompareFunctor::operator()(
394 const base::FilePath::StringType& a, 399 const base::FilePath::StringType& a,
395 const base::FilePath::StringType& b) const { 400 const base::FilePath::StringType& b) const {
396 return base::FilePath::CompareLessIgnoreCase(a, b); 401 return base::FilePath::CompareLessIgnoreCase(a, b);
397 } 402 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698