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

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:34:22 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
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | printing/print_settings.h » ('j') | 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 bb22792e40bd45e6fca8cfd90e2682a145ba321c..1e7a7d1b0f101a6dca2e26ace9dc0b7a5f3a877a 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,11 @@ 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()));
SkTime::DateTime now = TimeToSkTime(base::Time::Now());
pdf_doc->setMetadata(info, &now, &now);
if (!pdf_doc->close())
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | printing/print_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698