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

Unified Diff: chrome/browser/chromeos/printing/cups_print_job_notification.cc

Issue 2872733002: [CUPS] Update UI for CUPS printing notifications. (Closed)
Patch Set: . Created 3 years, 7 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/app/chromeos_strings.grdp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/printing/cups_print_job_notification.cc
diff --git a/chrome/browser/chromeos/printing/cups_print_job_notification.cc b/chrome/browser/chromeos/printing/cups_print_job_notification.cc
index 8dee4784300d2bc23e40a0b2a37e24c9d5402ba5..f8158fe1363193f9e47ab4baa30c3c2c960e7b56 100644
--- a/chrome/browser/chromeos/printing/cups_print_job_notification.cc
+++ b/chrome/browser/chromeos/printing/cups_print_job_notification.cc
@@ -181,65 +181,65 @@ void CupsPrintJobNotification::UpdateNotification() {
}
void CupsPrintJobNotification::UpdateNotificationTitle() {
- notification_->set_title(base::UTF8ToUTF16(print_job_->document_title()));
-}
-
-void CupsPrintJobNotification::UpdateNotificationIcon() {
- ResourceBundle& bundle = ResourceBundle::GetSharedInstance();
+ base::string16 title;
switch (print_job_->state()) {
case CupsPrintJob::State::STATE_WAITING:
case CupsPrintJob::State::STATE_STARTED:
case CupsPrintJob::State::STATE_PAGE_DONE:
case CupsPrintJob::State::STATE_SUSPENDED:
case CupsPrintJob::State::STATE_RESUMED:
- notification_->set_icon(
- bundle.GetImageNamed(IDR_PRINT_NOTIFICATION_PRINTING));
+ title = l10n_util::GetStringFUTF16(
+ IDS_PRINT_JOB_PRINTING_NOTIFICATION_TITLE,
+ base::UTF8ToUTF16(print_job_->document_title()));
break;
case CupsPrintJob::State::STATE_DOCUMENT_DONE:
- notification_->set_icon(
- bundle.GetImageNamed(IDR_PRINT_NOTIFICATION_DONE));
+ title = l10n_util::GetStringFUTF16(
+ IDS_PRINT_JOB_DONE_NOTIFICATION_TITLE,
+ base::UTF8ToUTF16(print_job_->document_title()));
break;
case CupsPrintJob::State::STATE_CANCELLED:
case CupsPrintJob::State::STATE_ERROR:
- notification_->set_icon(
- bundle.GetImageNamed(IDR_PRINT_NOTIFICATION_ERROR));
- case CupsPrintJob::State::STATE_NONE:
+ title = l10n_util::GetStringFUTF16(
+ IDS_PRINT_JOB_ERROR_NOTIFICATION_TITLE,
+ base::UTF8ToUTF16(print_job_->document_title()));
+ break;
+ default:
break;
}
+ notification_->set_title(title);
}
-void CupsPrintJobNotification::UpdateNotificationBodyMessage() {
- base::string16 message;
+void CupsPrintJobNotification::UpdateNotificationIcon() {
+ ResourceBundle& bundle = ResourceBundle::GetSharedInstance();
switch (print_job_->state()) {
- case CupsPrintJob::State::STATE_NONE:
- break;
case CupsPrintJob::State::STATE_WAITING:
case CupsPrintJob::State::STATE_STARTED:
case CupsPrintJob::State::STATE_PAGE_DONE:
case CupsPrintJob::State::STATE_SUSPENDED:
case CupsPrintJob::State::STATE_RESUMED:
- message = l10n_util::GetStringFUTF16(
- IDS_PRINT_JOB_PRINTING_NOTIFICATION_MESSAGE,
- base::IntToString16(print_job_->total_page_number()),
- base::UTF8ToUTF16(print_job_->printer().display_name()));
-
+ notification_->set_icon(
+ bundle.GetImageNamed(IDR_PRINT_NOTIFICATION_PRINTING));
break;
case CupsPrintJob::State::STATE_DOCUMENT_DONE:
- message = l10n_util::GetStringFUTF16(
- IDS_PRINT_JOB_DONE_NOTIFICATION_MESSAGE,
- base::IntToString16(print_job_->total_page_number()),
- base::UTF8ToUTF16(print_job_->printer().display_name()));
+ notification_->set_icon(
+ bundle.GetImageNamed(IDR_PRINT_NOTIFICATION_DONE));
break;
case CupsPrintJob::State::STATE_CANCELLED:
case CupsPrintJob::State::STATE_ERROR:
- message = l10n_util::GetStringFUTF16(
- IDS_PRINT_JOB_ERROR_NOTIFICATION_MESSAGE,
- base::IntToString16(print_job_->total_page_number()),
- base::UTF8ToUTF16(print_job_->printer().display_name()));
- break;
- default:
+ notification_->set_icon(
+ bundle.GetImageNamed(IDR_PRINT_NOTIFICATION_ERROR));
+ case CupsPrintJob::State::STATE_NONE:
break;
}
+}
+
+void CupsPrintJobNotification::UpdateNotificationBodyMessage() {
+ base::string16 message = l10n_util::GetStringFUTF16(
+ (print_job_->total_page_number() > 1)
+ ? IDS_PRINT_JOB_NOTIFICATION_MESSAGE
+ : IDS_PRINT_JOB_NOTIFICATION_SINGLE_PAGE_MESSAGE,
+ base::IntToString16(print_job_->total_page_number()),
+ base::UTF8ToUTF16(print_job_->printer().display_name()));
notification_->set_message(message);
}
« no previous file with comments | « chrome/app/chromeos_strings.grdp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698