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

Unified Diff: printing/pdf_metafile_skia.cc

Issue 1397333003: PDF Printing: embed browser user agent string in PDF metadata. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2015-11-05 (Thursday) 17:13:38 EST Created 5 years, 1 month 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: printing/pdf_metafile_skia.cc
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index bb22792e40bd45e6fca8cfd90e2682a145ba321c..3558f334c266e06fc9136aeecc716ee4de0f95e8 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -10,6 +10,7 @@
#include "base/numerics/safe_conversions.h"
#include "base/posix/eintr_wrapper.h"
#include "base/time/time.h"
+#include "printing/print_settings.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkDocument.h"
@@ -163,7 +164,10 @@ bool PdfMetafileSkia::FinishDocument() {
pdf_doc->endPage();
}
SkTArray<SkDocument::Attribute> info;
- info.emplace_back(SkString("Creator"), SkString("Chromium"));
+ const std::string& user_agent = GetAgent();
+ info.emplace_back(SkString("Creator"),
+ user_agent.empty() ? SkString("Chromium")
+ : SkString(user_agent.c_str(), user_agent.size()));
Lei Zhang 2015/11/05 22:24:09 Can we do this in some way as suggested by the sty
hal.canary 2015/11/05 22:34:53 done
SkTime::DateTime now = TimeToSkTime(base::Time::Now());
pdf_doc->setMetadata(info, &now, &now);
if (!pdf_doc->close())

Powered by Google App Engine
This is Rietveld 408576698