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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 // Create the save package and possibly prompt the user for the name to save | 1022 // Create the save package and possibly prompt the user for the name to save |
1023 // the page as. The user prompt is an asynchronous operation that runs on | 1023 // the page as. The user prompt is an asynchronous operation that runs on |
1024 // another thread. | 1024 // another thread. |
1025 save_package_ = new SavePackage(this); | 1025 save_package_ = new SavePackage(this); |
1026 save_package_->GetSaveInfo(); | 1026 save_package_->GetSaveInfo(); |
1027 } | 1027 } |
1028 | 1028 |
1029 // Used in automated testing to bypass prompting the user for file names. | 1029 // Used in automated testing to bypass prompting the user for file names. |
1030 // Instead, the names and paths are hard coded rather than running them through | 1030 // Instead, the names and paths are hard coded rather than running them through |
1031 // file name sanitation and extension / mime checking. | 1031 // file name sanitation and extension / mime checking. |
1032 void TabContents::SavePage(const std::wstring& main_file, | 1032 bool TabContents::SavePage(const std::wstring& main_file, |
1033 const std::wstring& dir_path, | 1033 const std::wstring& dir_path, |
1034 SavePackage::SavePackageType save_type) { | 1034 SavePackage::SavePackageType save_type) { |
1035 // Stop the page from navigating. | 1035 // Stop the page from navigating. |
1036 Stop(); | 1036 Stop(); |
1037 | 1037 |
1038 save_package_ = new SavePackage(this, save_type, | 1038 save_package_ = new SavePackage(this, save_type, |
1039 FilePath::FromWStringHack(main_file), | 1039 FilePath::FromWStringHack(main_file), |
1040 FilePath::FromWStringHack(dir_path)); | 1040 FilePath::FromWStringHack(dir_path)); |
1041 save_package_->Init(); | 1041 return save_package_->Init(); |
1042 } | 1042 } |
1043 | 1043 |
1044 void TabContents::PrintPreview() { | 1044 void TabContents::PrintPreview() { |
1045 // We don't show the print preview yet, only the print dialog. | 1045 // We don't show the print preview yet, only the print dialog. |
1046 PrintNow(); | 1046 PrintNow(); |
1047 } | 1047 } |
1048 | 1048 |
1049 bool TabContents::PrintNow() { | 1049 bool TabContents::PrintNow() { |
1050 // We can't print interstitial page for now. | 1050 // We can't print interstitial page for now. |
1051 if (showing_interstitial_page()) | 1051 if (showing_interstitial_page()) |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 NavigationController::LoadCommittedDetails& committed_details = | 2377 NavigationController::LoadCommittedDetails& committed_details = |
2378 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); | 2378 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); |
2379 ExpireInfoBars(committed_details); | 2379 ExpireInfoBars(committed_details); |
2380 break; | 2380 break; |
2381 } | 2381 } |
2382 | 2382 |
2383 default: | 2383 default: |
2384 NOTREACHED(); | 2384 NOTREACHED(); |
2385 } | 2385 } |
2386 } | 2386 } |
OLD | NEW |