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

Unified Diff: printing/pdf_metafile_skia.cc

Issue 1842473002: Use SkDocument_PDF_None if pdf support is not enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/pdf_metafile_skia.cc
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index 104970e1cecf45319cbc20a3b909b7b98ed37145..de93b4bd925c40782d7b4b60d043312aae5ad4e7 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -65,6 +65,7 @@ bool WriteAssetToBuffer(const SkStreamAsset* asset,
return (length == assetCopy->read(buffer, length));
}
+#if defined(ENABLE_PRINTING) && ENABLE_PRINTING
slan 2016/03/28 20:03:44 Just: #if defined(ENABLE_PRINTING) here and belo
mbjorge 2016/03/28 20:26:52 Done
SkTime::DateTime TimeToSkTime(base::Time time) {
base::Time::Exploded exploded;
time.UTCExplode(&exploded);
@@ -79,6 +80,7 @@ SkTime::DateTime TimeToSkTime(base::Time time) {
skdate.fSecond = exploded.second;
return skdate;
}
+#endif // defined(ENABLE_PRINTING) && ENABLE_PRINTING
} // namespace
@@ -156,6 +158,7 @@ bool PdfMetafileSkia::FinishDocument() {
if (data_->recorder_.getRecordingCanvas())
FinishPage();
+#if defined(ENABLE_PRINTING) && ENABLE_PRINTING
SkDynamicMemoryWStream pdf_stream;
skia::RefPtr<SkDocument> pdf_doc =
skia::AdoptRef(SkDocument::CreatePDF(&pdf_stream));
@@ -181,6 +184,11 @@ bool PdfMetafileSkia::FinishDocument() {
data_->pdf_data_.reset(pdf_stream.detachAsStream());
return true;
+#else
+// On platforms without printing enabled, SkDocument::CreatePDF does not exist,
+// so just return false.
+ return false;
+#endif // !defined(ENABLE_PRINTING || !ENABLE_PRINTING
}
uint32_t PdfMetafileSkia::GetDataSize() const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698