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

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc

Issue 1977303003: Adds a feature to MHTML serialization that omits subframes and subresources marked no-store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-store
Patch Set: Address dcheng's comments. Created 4 years, 7 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 | content/browser/DEPS » ('j') | content/browser/DEPS » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // TODO(fgorski): Figure out if the actual URL can be different at 114 // TODO(fgorski): Figure out if the actual URL can be different at
115 // the end of MHTML generation. Perhaps we should pull it out after the MHTML 115 // the end of MHTML generation. Perhaps we should pull it out after the MHTML
116 // is generated. 116 // is generated.
117 GURL url(web_contents_->GetLastCommittedURL()); 117 GURL url(web_contents_->GetLastCommittedURL());
118 base::string16 title(web_contents_->GetTitle()); 118 base::string16 title(web_contents_->GetTitle());
119 base::FilePath file_path( 119 base::FilePath file_path(
120 archives_dir.Append( 120 archives_dir.Append(
121 GenerateFileName(url, base::UTF16ToUTF8(title), archive_id))); 121 GenerateFileName(url, base::UTF16ToUTF8(title), archive_id)));
122 122
123 content::MHTMLGenerationParams params(file_path); 123 content::MHTMLGenerationParams params(file_path);
124 params.cache_control_policy = 124 params.cache_control_policy = blink::WebFrameSerializerCacheControlPolicy::
125 content::MHTMLCacheControlPolicy::FAIL_FOR_NO_STORE_MAIN_FRAME; 125 SkipAnyFrameOrResourceMarkedNoStore;
126 params.use_binary_encoding = true; 126 params.use_binary_encoding = true;
127 127
128 web_contents_->GenerateMHTML( 128 web_contents_->GenerateMHTML(
129 params, base::Bind(&OfflinePageMHTMLArchiver::OnGenerateMHTMLDone, 129 params, base::Bind(&OfflinePageMHTMLArchiver::OnGenerateMHTMLDone,
130 weak_ptr_factory_.GetWeakPtr(), url, file_path)); 130 weak_ptr_factory_.GetWeakPtr(), url, file_path));
131 } 131 }
132 132
133 void OfflinePageMHTMLArchiver::OnGenerateMHTMLDone( 133 void OfflinePageMHTMLArchiver::OnGenerateMHTMLDone(
134 const GURL& url, 134 const GURL& url,
135 const base::FilePath& file_path, 135 const base::FilePath& file_path,
(...skipping 18 matching lines...) Expand all
154 } 154 }
155 155
156 void OfflinePageMHTMLArchiver::ReportFailure(ArchiverResult result) { 156 void OfflinePageMHTMLArchiver::ReportFailure(ArchiverResult result) {
157 DCHECK(result != ArchiverResult::SUCCESSFULLY_CREATED); 157 DCHECK(result != ArchiverResult::SUCCESSFULLY_CREATED);
158 base::ThreadTaskRunnerHandle::Get()->PostTask( 158 base::ThreadTaskRunnerHandle::Get()->PostTask(
159 FROM_HERE, 159 FROM_HERE,
160 base::Bind(callback_, this, result, GURL(), base::FilePath(), 0)); 160 base::Bind(callback_, this, result, GURL(), base::FilePath(), 0));
161 } 161 }
162 162
163 } // namespace offline_pages 163 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | content/browser/DEPS » ('j') | content/browser/DEPS » ('J')

Powered by Google App Engine
This is Rietveld 408576698