Chromium Code Reviews| 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)); |