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

Unified Diff: content/browser/download/save_package.cc

Issue 2013633003: Adding a command-line flag to set MHTML generation options. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/save_package.cc
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc
index 7704eb4aae239d3bb53cf152caedcd28912f8e29..1f1859c20fbe51edc28769d602c42f9907588646 100644
--- a/content/browser/download/save_package.cc
+++ b/content/browser/download/save_package.cc
@@ -8,6 +8,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/i18n/file_util_icu.h"
@@ -48,6 +49,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/resource_context.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/content_switches.h"
#include "content/public/common/mhtml_generation_params.h"
#include "net/base/filename_util.h"
#include "net/base/io_buffer.h"
@@ -340,6 +342,22 @@ void SavePackage::InitWithDownloadItem(
GetSavableResourceLinks();
} else if (save_type_ == SAVE_PAGE_TYPE_AS_MHTML) {
MHTMLGenerationParams mhtml_generation_params(saved_main_file_path_);
+
+ // Check which variant of MHTML generation is required.
+ std::string MHTMLGeneratorOptionFlag =
dewittj 2016/05/24 23:03:20 Another option would be to override the default in
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kMHTMLGeneratorOption);
+
+ if (MHTMLGeneratorOptionFlag == "skip_nostore_main") {
dewittj 2016/05/24 23:03:20 hm, wish this could be a constant that's shared in
+ mhtml_generation_params.cache_control_policy =
+ blink::WebFrameSerializerCacheControlPolicy::
+ FailForNoStoreMainFrame;
+ } else if (MHTMLGeneratorOptionFlag == "skip_nostore_all") {
+ mhtml_generation_params.cache_control_policy =
+ blink::WebFrameSerializerCacheControlPolicy::
+ SkipAnyFrameOrResourceMarkedNoStore;
+ }
+
web_contents()->GenerateMHTML(
mhtml_generation_params,
base::Bind(&SavePackage::OnMHTMLGenerated, this));
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698