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

Unified Diff: headless/lib/browser/headless_devtools_manager_delegate.cc

Issue 2808653002: make headless lib complie when enable_basic_printing is set to false (Closed)
Patch Set: minor fix Created 3 years, 8 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 | « headless/BUILD.gn ('k') | headless/lib/browser/headless_web_contents_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/headless_devtools_manager_delegate.cc
diff --git a/headless/lib/browser/headless_devtools_manager_delegate.cc b/headless/lib/browser/headless_devtools_manager_delegate.cc
index df4d8f0376c14900cd53551aa1264f9f1f7578c8..040b8207c9e89b1fae5ff68455756533ce756c14 100644
--- a/headless/lib/browser/headless_devtools_manager_delegate.cc
+++ b/headless/lib/browser/headless_devtools_manager_delegate.cc
@@ -14,11 +14,15 @@
#include "headless/grit/headless_lib_resources.h"
#include "headless/lib/browser/headless_browser_context_impl.h"
#include "headless/lib/browser/headless_browser_impl.h"
-#include "headless/lib/browser/headless_print_manager.h"
#include "headless/lib/browser/headless_web_contents_impl.h"
#include "headless/public/devtools/domains/target.h"
+#include "printing/features/features.h"
#include "ui/base/resource/resource_bundle.h"
+#if BUILDFLAG(ENABLE_BASIC_PRINTING)
+#include "headless/lib/browser/headless_print_manager.h"
+#endif
+
namespace headless {
namespace {
@@ -68,6 +72,7 @@ std::unique_ptr<base::DictionaryValue> CreateInvalidParamResponse(
base::StringPrintf("Missing or invalid '%s' parameter", param.c_str()));
}
+#if BUILDFLAG(ENABLE_BASIC_PRINTING)
void PDFCreated(
const content::DevToolsManagerDelegate::CommandCallback& callback,
int command_id,
@@ -85,6 +90,7 @@ void PDFCreated(
}
callback.Run(std::move(response));
}
+#endif
} // namespace
@@ -183,11 +189,17 @@ void HeadlessDevToolsManagerDelegate::PrintToPDF(
int command_id,
const base::DictionaryValue* params,
const CommandCallback& callback) {
+#if BUILDFLAG(ENABLE_BASIC_PRINTING)
content::WebContents* web_contents = agent_host->GetWebContents();
content::RenderFrameHost* rfh = web_contents->GetMainFrame();
printing::HeadlessPrintManager::FromWebContents(web_contents)
->GetPDFContents(rfh, base::Bind(&PDFCreated, callback, command_id));
+#else
+ DCHECK(callback);
+ callback.Run(CreateErrorResponse(command_id, kErrorServerError,
+ "Printing is not enabled"));
+#endif
}
std::unique_ptr<base::DictionaryValue>
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/browser/headless_web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698