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

Unified Diff: chrome/browser/local_discovery/privet_notifications.cc

Issue 1103293004: Use ICU plural syntax in more place (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment in generated_strings.grd Created 5 years, 8 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/browser/local_discovery/privet_notifications.cc
diff --git a/chrome/browser/local_discovery/privet_notifications.cc b/chrome/browser/local_discovery/privet_notifications.cc
index 716a5183325bd5b13529b5161988b6c61a0af1a6..1d49045161efe9af039f3e300d949e4194cdab06 100644
--- a/chrome/browser/local_discovery/privet_notifications.cc
+++ b/chrome/browser/local_discovery/privet_notifications.cc
@@ -147,7 +147,7 @@ void PrivetNotificationsListener::OnPrivetInfoDone(
DCHECK(!device->notification_may_be_active);
device->notification_may_be_active = true;
devices_active_++;
- delegate_->PrivetNotify(devices_active_ > 1, true);
+ delegate_->PrivetNotify(devices_active_, true);
}
void PrivetNotificationsListener::DeviceRemoved(const std::string& name) {
@@ -183,7 +183,7 @@ void PrivetNotificationsListener::NotifyDeviceRemoved() {
if (devices_active_ == 0) {
delegate_->PrivetRemoveNotification();
} else {
- delegate_->PrivetNotify(devices_active_ > 1, false);
+ delegate_->PrivetNotify(devices_active_, false);
}
}
@@ -234,21 +234,15 @@ bool PrivetNotificationService::IsForced() {
return command_line->HasSwitch(switches::kEnableDeviceDiscoveryNotifications);
}
-void PrivetNotificationService::PrivetNotify(bool has_multiple,
+void PrivetNotificationService::PrivetNotify(int devices_active,
bool added) {
base::string16 product_name = l10n_util::GetStringUTF16(
IDS_LOCAL_DISOCVERY_SERVICE_NAME_PRINTER);
- int title_resource = has_multiple ?
- IDS_LOCAL_DISOCVERY_NOTIFICATION_TITLE_PRINTER_MULTIPLE :
- IDS_LOCAL_DISOCVERY_NOTIFICATION_TITLE_PRINTER;
-
- int body_resource = has_multiple ?
- IDS_LOCAL_DISOCVERY_NOTIFICATION_CONTENTS_PRINTER_MULTIPLE :
- IDS_LOCAL_DISOCVERY_NOTIFICATION_CONTENTS_PRINTER;
-
- base::string16 title = l10n_util::GetStringUTF16(title_resource);
- base::string16 body = l10n_util::GetStringUTF16(body_resource);
+ base::string16 title = l10n_util::GetPluralStringFUTF16(
+ IDS_LOCAL_DISOCVERY_NOTIFICATION_TITLE_PRINTER, devices_active);
+ base::string16 body = l10n_util::GetPluralStringFUTF16(
+ IDS_LOCAL_DISOCVERY_NOTIFICATION_CONTENTS_PRINTER, devices_active);
Profile* profile_object = Profile::FromBrowserContext(profile_);
message_center::RichNotificationData rich_notification_data;

Powered by Google App Engine
This is Rietveld 408576698