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

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

Issue 10941025: Simplify document title for Windows printing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | « chrome/service/cloud_print/print_system_win.cc ('k') | printing/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b34de253e3aa250659218b7c0f7932d620272923..98b4e9dd7b1bdf8b57ab783901133aef45358fba 100644
--- a/chrome/service/cloud_print/printer_job_handler.cc
+++ b/chrome/service/cloud_print/printer_job_handler.cc
@@ -17,8 +17,11 @@
#include "chrome/service/cloud_print/cloud_print_helpers.h"
#include "chrome/service/cloud_print/job_status_updater.h"
#include "googleurl/src/gurl.h"
+#include "grit/generated_resources.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
+#include "printing/backend/print_backend.h"
+#include "ui/base/l10n/l10n_util.h"
PrinterJobHandler::JobDetails::JobDetails() {}
@@ -676,13 +679,22 @@ void PrinterJobHandler::DoPrint(const JobDetails& job_details,
const std::string& printer_name) {
job_spooler_ = print_system_->CreateJobSpooler();
DCHECK(job_spooler_);
- if (!job_spooler_ || !job_spooler_->Spool(job_details.print_ticket_,
- job_details.print_data_file_path_,
- job_details.print_data_mime_type_,
- printer_name,
- job_details.job_title_,
- job_details.tags_,
- this)) {
+ if (!job_spooler_)
+ return;
+ string16 document_name =
+ printing::PrintBackend::SimplifyDocumentTitle(
+ UTF8ToUTF16(job_details.job_title_));
+ if (document_name.empty()) {
+ document_name = printing::PrintBackend::SimplifyDocumentTitle(
+ l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE));
+ }
+ if (!job_spooler_->Spool(job_details.print_ticket_,
+ job_details.print_data_file_path_,
+ job_details.print_data_mime_type_,
+ printer_name,
+ UTF16ToUTF8(document_name),
+ job_details.tags_,
+ this)) {
OnJobSpoolFailed();
}
}
« no previous file with comments | « chrome/service/cloud_print/print_system_win.cc ('k') | printing/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698