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

Unified Diff: chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc

Issue 1947263004: Introduces a new MHTML generation parameter specifying different behvaior for cache-control headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Work on compile. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc
diff --git a/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc b/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc
index 1af5ef4c304c6ec5a6170f7f83e0ee6522a1ca51..368857f2f563c6cc7ca6a7e280f8f5d4b688932a 100644
--- a/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc
+++ b/chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/ssl/chrome_security_state_model_client.h"
#include "components/security_state/security_state_model.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/mhtml_generation.h"
#include "net/base/filename_util.h"
namespace offline_pages {
@@ -119,10 +120,14 @@ void OfflinePageMHTMLArchiver::GenerateMHTML(
archives_dir.Append(
GenerateFileName(url, base::UTF16ToUTF8(title), archive_id)));
+ content::MHTMLGenerationParams params(file_path);
+ params.cache_control_policy =
+ content::MHTMLCacheControlPolicy::FAIL_FOR_NO_STORE_MAIN_FRAME;
+ params.use_binary_encoding = true;
+
web_contents_->GenerateMHTML(
- file_path, true /* use_binary_encoding */,
- base::Bind(&OfflinePageMHTMLArchiver::OnGenerateMHTMLDone,
- weak_ptr_factory_.GetWeakPtr(), url, file_path));
+ params, base::Bind(&OfflinePageMHTMLArchiver::OnGenerateMHTMLDone,
+ weak_ptr_factory_.GetWeakPtr(), url, file_path));
}
void OfflinePageMHTMLArchiver::OnGenerateMHTMLDone(

Powered by Google App Engine
This is Rietveld 408576698