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

Side by Side Diff: chrome/browser/extensions/extension_install_prompt.cc

Issue 1049513002: Use the ICU syntax message for plural formatting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ios whitelist update 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_install_prompt.h" 5 #include "chrome/browser/extensions/extension_install_prompt.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 case WITHHELD_PERMISSIONS: 434 case WITHHELD_PERMISSIONS:
435 return l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WITHHELD); 435 return l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WITHHELD);
436 case ALL_PERMISSIONS: 436 case ALL_PERMISSIONS:
437 default: 437 default:
438 NOTREACHED(); 438 NOTREACHED();
439 return base::string16(); 439 return base::string16();
440 } 440 }
441 } 441 }
442 442
443 base::string16 ExtensionInstallPrompt::Prompt::GetRetainedFilesHeading() const { 443 base::string16 ExtensionInstallPrompt::Prompt::GetRetainedFilesHeading() const {
444 const int kRetainedFilesMessageIDs[6] = { 444 return l10n_util::GetPluralStringFUTF16(
445 IDS_EXTENSION_PROMPT_RETAINED_FILES_DEFAULT, 445 IDS_EXTENSION_PROMPT_RETAINED_FILES, GetRetainedFileCount());
446 IDS_EXTENSION_PROMPT_RETAINED_FILE_SINGULAR,
447 IDS_EXTENSION_PROMPT_RETAINED_FILES_ZERO,
448 IDS_EXTENSION_PROMPT_RETAINED_FILES_TWO,
449 IDS_EXTENSION_PROMPT_RETAINED_FILES_FEW,
450 IDS_EXTENSION_PROMPT_RETAINED_FILES_MANY,
451 };
452 std::vector<int> message_ids(
453 kRetainedFilesMessageIDs,
454 kRetainedFilesMessageIDs + arraysize(kRetainedFilesMessageIDs));
455
456 return l10n_util::GetPluralStringFUTF16(message_ids, GetRetainedFileCount());
457 } 446 }
458 447
459 base::string16 ExtensionInstallPrompt::Prompt::GetRetainedDevicesHeading() 448 base::string16 ExtensionInstallPrompt::Prompt::GetRetainedDevicesHeading()
460 const { 449 const {
461 const int kRetainedDevicesMessageIDs[6] = { 450 return l10n_util::GetPluralStringFUTF16(
462 IDS_EXTENSION_PROMPT_RETAINED_DEVICES_DEFAULT, 451 IDS_EXTENSION_PROMPT_RETAINED_DEVICES, GetRetainedDeviceCount());
463 IDS_EXTENSION_PROMPT_RETAINED_DEVICE_SINGULAR,
464 IDS_EXTENSION_PROMPT_RETAINED_DEVICES_ZERO,
465 IDS_EXTENSION_PROMPT_RETAINED_DEVICES_TWO,
466 IDS_EXTENSION_PROMPT_RETAINED_DEVICES_FEW,
467 IDS_EXTENSION_PROMPT_RETAINED_DEVICES_MANY,
468 };
469 std::vector<int> message_ids(
470 kRetainedDevicesMessageIDs,
471 kRetainedDevicesMessageIDs + arraysize(kRetainedDevicesMessageIDs));
472
473 return l10n_util::GetPluralStringFUTF16(message_ids,
474 GetRetainedDeviceCount());
475 } 452 }
476 453
477 bool ExtensionInstallPrompt::Prompt::ShouldShowPermissions() const { 454 bool ExtensionInstallPrompt::Prompt::ShouldShowPermissions() const {
478 return GetPermissionCount(ALL_PERMISSIONS) > 0 || 455 return GetPermissionCount(ALL_PERMISSIONS) > 0 ||
479 type_ == POST_INSTALL_PERMISSIONS_PROMPT; 456 type_ == POST_INSTALL_PERMISSIONS_PROMPT;
480 } 457 }
481 458
482 void ExtensionInstallPrompt::Prompt::AppendRatingStars( 459 void ExtensionInstallPrompt::Prompt::AppendRatingStars(
483 StarAppender appender, void* data) const { 460 StarAppender appender, void* data) const {
484 CHECK(appender); 461 CHECK(appender);
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 if (show_params_->WasParentDestroyed()) { 960 if (show_params_->WasParentDestroyed()) {
984 delegate_->InstallUIAbort(false); 961 delegate_->InstallUIAbort(false);
985 return; 962 return;
986 } 963 }
987 964
988 if (show_dialog_callback_.is_null()) 965 if (show_dialog_callback_.is_null())
989 GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_); 966 GetDefaultShowDialogCallback().Run(show_params_.get(), delegate_, prompt_);
990 else 967 else
991 show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_); 968 show_dialog_callback_.Run(show_params_.get(), delegate_, prompt_);
992 } 969 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698