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

Unified Diff: chrome/service/cloud_print/printer_job_handler.cc

Issue 1212883003: Include user email into document title before spooling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mon Jul 6 10:13:42 PDT 2015 Created 5 years, 5 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
Index: chrome/service/cloud_print/printer_job_handler.cc
diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc
index 35a7ccd8f676b6bdcbd2e19925a64ab175db22fc..54108e3ae10d8688b32beead5e9a4c0b8a095247 100644
--- a/chrome/service/cloud_print/printer_job_handler.cc
+++ b/chrome/service/cloud_print/printer_job_handler.cc
@@ -792,8 +792,19 @@ void PrinterJobHandler::DoPrint(const JobDetails& job_details,
DCHECK(job_spooler_.get());
if (!job_spooler_.get())
return;
- base::string16 document_name = printing::SimplifyDocumentTitle(
- base::UTF8ToUTF16(job_details.job_title_));
+ base::string16 document_name = base::UTF8ToUTF16(job_details.job_title_);
+ if (!job_details.job_owner_.empty()) {
Aleksey Shlyapnikov 2015/07/06 23:06:25 What if it is empty? We still need to call printin
Vitaly Buka (NO REVIEWS) 2015/07/07 01:22:50 Re-done.
+ base::string16 prefix = printing::SimplifyDocumentTitle(
+ base::UTF8ToUTF16(job_details.job_owner_ + ": "));
+ if (prefix.size() < printing::kMaxDocumentTitleLength) {
+ document_name =
+ prefix +
+ printing::SimplifyDocumentTitleWithLength(
+ document_name, printing::kMaxDocumentTitleLength - prefix.size());
+ }
+ }
+
+ DCHECK_LE(document_name.size(), printing::kMaxDocumentTitleLength);
if (document_name.empty()) {
document_name = printing::SimplifyDocumentTitle(
l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE));

Powered by Google App Engine
This is Rietveld 408576698