OLD | NEW |
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/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 | 1261 |
1262 // The option index is not zero-based. | 1262 // The option index is not zero-based. |
1263 DCHECK(index > 0 && index < 3); | 1263 DCHECK(index > 0 && index < 3); |
1264 param->dir = param->saved_main_file_path.DirName(); | 1264 param->dir = param->saved_main_file_path.DirName(); |
1265 | 1265 |
1266 PrefService* prefs = tab_contents_->profile()->GetPrefs(); | 1266 PrefService* prefs = tab_contents_->profile()->GetPrefs(); |
1267 StringPrefMember save_file_path; | 1267 StringPrefMember save_file_path; |
1268 save_file_path.Init(prefs::kSaveFileDefaultDirectory, prefs, NULL); | 1268 save_file_path.Init(prefs::kSaveFileDefaultDirectory, prefs, NULL); |
1269 // If user change the default saving directory, we will remember it just | 1269 // If user change the default saving directory, we will remember it just |
1270 // like IE and FireFox. | 1270 // like IE and FireFox. |
1271 if (save_file_path.GetValue() != param->dir.ToWStringHack()) | 1271 if (!tab_contents_->profile()->IsOffTheRecord() && |
| 1272 save_file_path.GetValue() != param->dir.ToWStringHack()) |
1272 save_file_path.SetValue(param->dir.ToWStringHack()); | 1273 save_file_path.SetValue(param->dir.ToWStringHack()); |
1273 | 1274 |
1274 param->save_type = (index == 1) ? SavePackage::SAVE_AS_ONLY_HTML : | 1275 param->save_type = (index == 1) ? SavePackage::SAVE_AS_ONLY_HTML : |
1275 SavePackage::SAVE_AS_COMPLETE_HTML; | 1276 SavePackage::SAVE_AS_COMPLETE_HTML; |
1276 | 1277 |
1277 if (param->save_type == SavePackage::SAVE_AS_COMPLETE_HTML) { | 1278 if (param->save_type == SavePackage::SAVE_AS_COMPLETE_HTML) { |
1278 // Make new directory for saving complete file. | 1279 // Make new directory for saving complete file. |
1279 param->dir = param->dir.Append( | 1280 param->dir = param->dir.Append( |
1280 param->saved_main_file_path.RemoveExtension().BaseName().value() + | 1281 param->saved_main_file_path.RemoveExtension().BaseName().value() + |
1281 FILE_PATH_LITERAL("_files")); | 1282 FILE_PATH_LITERAL("_files")); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 int index, void* params) { | 1350 int index, void* params) { |
1350 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1351 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
1351 ContinueSave(save_params, path, index); | 1352 ContinueSave(save_params, path, index); |
1352 delete save_params; | 1353 delete save_params; |
1353 } | 1354 } |
1354 | 1355 |
1355 void SavePackage::FileSelectionCanceled(void* params) { | 1356 void SavePackage::FileSelectionCanceled(void* params) { |
1356 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1357 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
1357 delete save_params; | 1358 delete save_params; |
1358 } | 1359 } |
OLD | NEW |