| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 // Create the save package and possibly prompt the user for the name to save | 1120 // Create the save package and possibly prompt the user for the name to save |
| 1121 // the page as. The user prompt is an asynchronous operation that runs on | 1121 // the page as. The user prompt is an asynchronous operation that runs on |
| 1122 // another thread. | 1122 // another thread. |
| 1123 save_package_ = new SavePackage(this); | 1123 save_package_ = new SavePackage(this); |
| 1124 save_package_->GetSaveInfo(); | 1124 save_package_->GetSaveInfo(); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 // Used in automated testing to bypass prompting the user for file names. | 1127 // Used in automated testing to bypass prompting the user for file names. |
| 1128 // Instead, the names and paths are hard coded rather than running them through | 1128 // Instead, the names and paths are hard coded rather than running them through |
| 1129 // file name sanitation and extension / mime checking. | 1129 // file name sanitation and extension / mime checking. |
| 1130 bool TabContents::SavePage(const std::wstring& main_file, | 1130 bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, |
| 1131 const std::wstring& dir_path, | |
| 1132 SavePackage::SavePackageType save_type) { | 1131 SavePackage::SavePackageType save_type) { |
| 1133 // Stop the page from navigating. | 1132 // Stop the page from navigating. |
| 1134 Stop(); | 1133 Stop(); |
| 1135 | 1134 |
| 1136 save_package_ = new SavePackage(this, save_type, | 1135 save_package_ = new SavePackage(this, save_type, main_file, dir_path); |
| 1137 FilePath::FromWStringHack(main_file), | |
| 1138 FilePath::FromWStringHack(dir_path)); | |
| 1139 return save_package_->Init(); | 1136 return save_package_->Init(); |
| 1140 } | 1137 } |
| 1141 | 1138 |
| 1142 void TabContents::PrintPreview() { | 1139 void TabContents::PrintPreview() { |
| 1143 // We don't show the print preview yet, only the print dialog. | 1140 // We don't show the print preview yet, only the print dialog. |
| 1144 PrintNow(); | 1141 PrintNow(); |
| 1145 } | 1142 } |
| 1146 | 1143 |
| 1147 bool TabContents::PrintNow() { | 1144 bool TabContents::PrintNow() { |
| 1148 // We can't print interstitial page for now. | 1145 // We can't print interstitial page for now. |
| (...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2563 | 2560 |
| 2564 default: | 2561 default: |
| 2565 NOTREACHED(); | 2562 NOTREACHED(); |
| 2566 } | 2563 } |
| 2567 } | 2564 } |
| 2568 | 2565 |
| 2569 void TabContents::set_encoding(const std::string& encoding) { | 2566 void TabContents::set_encoding(const std::string& encoding) { |
| 2570 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2567 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
| 2571 } | 2568 } |
| 2572 | 2569 |
| OLD | NEW |