OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/offline_pages/offline_page_mhtml_archiver.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return; | 103 return; |
104 } | 104 } |
105 | 105 |
106 GURL url(web_contents_->GetLastCommittedURL()); | 106 GURL url(web_contents_->GetLastCommittedURL()); |
107 base::string16 title(web_contents_->GetTitle()); | 107 base::string16 title(web_contents_->GetTitle()); |
108 base::FilePath file_path( | 108 base::FilePath file_path( |
109 archives_dir.Append(base::GenerateGUID()).AddExtension(kMHTMLExtension)); | 109 archives_dir.Append(base::GenerateGUID()).AddExtension(kMHTMLExtension)); |
110 content::MHTMLGenerationParams params(file_path); | 110 content::MHTMLGenerationParams params(file_path); |
111 params.use_binary_encoding = true; | 111 params.use_binary_encoding = true; |
112 params.remove_popup_overlay = create_archive_params.remove_popup_overlay; | 112 params.remove_popup_overlay = create_archive_params.remove_popup_overlay; |
| 113 params.use_page_problem_detectors = |
| 114 create_archive_params.use_page_problem_detectors; |
113 | 115 |
114 web_contents_->GenerateMHTML( | 116 web_contents_->GenerateMHTML( |
115 params, | 117 params, |
116 base::Bind(&OfflinePageMHTMLArchiver::OnGenerateMHTMLDone, | 118 base::Bind(&OfflinePageMHTMLArchiver::OnGenerateMHTMLDone, |
117 weak_ptr_factory_.GetWeakPtr(), url, file_path, title)); | 119 weak_ptr_factory_.GetWeakPtr(), url, file_path, title)); |
118 } | 120 } |
119 | 121 |
120 void OfflinePageMHTMLArchiver::OnGenerateMHTMLDone( | 122 void OfflinePageMHTMLArchiver::OnGenerateMHTMLDone( |
121 const GURL& url, | 123 const GURL& url, |
122 const base::FilePath& file_path, | 124 const base::FilePath& file_path, |
(...skipping 28 matching lines...) Expand all Loading... |
151 } | 153 } |
152 | 154 |
153 void OfflinePageMHTMLArchiver::ReportFailure(ArchiverResult result) { | 155 void OfflinePageMHTMLArchiver::ReportFailure(ArchiverResult result) { |
154 DCHECK(result != ArchiverResult::SUCCESSFULLY_CREATED); | 156 DCHECK(result != ArchiverResult::SUCCESSFULLY_CREATED); |
155 base::ThreadTaskRunnerHandle::Get()->PostTask( | 157 base::ThreadTaskRunnerHandle::Get()->PostTask( |
156 FROM_HERE, base::Bind(callback_, this, result, GURL(), base::FilePath(), | 158 FROM_HERE, base::Bind(callback_, this, result, GURL(), base::FilePath(), |
157 base::string16(), 0)); | 159 base::string16(), 0)); |
158 } | 160 } |
159 | 161 |
160 } // namespace offline_pages | 162 } // namespace offline_pages |
OLD | NEW |