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

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

Issue 23591040: Use ICU for string pluralization in the extension permission dialog. (Closed) Base URL: http://git.chromium.org/chromium/src.git@gtk-extension-install-dialog
Patch Set: Created 7 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 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 340
341 string16 ExtensionInstallPrompt::Prompt::GetPermissionsHeading() const { 341 string16 ExtensionInstallPrompt::Prompt::GetPermissionsHeading() const {
342 return l10n_util::GetStringUTF16(kPermissionsHeaderIds[type_]); 342 return l10n_util::GetStringUTF16(kPermissionsHeaderIds[type_]);
343 } 343 }
344 344
345 string16 ExtensionInstallPrompt::Prompt::GetOAuthHeading() const { 345 string16 ExtensionInstallPrompt::Prompt::GetOAuthHeading() const {
346 return l10n_util::GetStringFUTF16(kOAuthHeaderIds[type_], oauth_user_name_); 346 return l10n_util::GetStringFUTF16(kOAuthHeaderIds[type_], oauth_user_name_);
347 } 347 }
348 348
349 string16 ExtensionInstallPrompt::Prompt::GetRetainedFilesHeading() const { 349 string16 ExtensionInstallPrompt::Prompt::GetRetainedFilesHeading() const {
350 return l10n_util::GetStringFUTF16( 350 const int kRetainedFilesMessageIDs[6] = {
351 IDS_EXTENSION_PROMPT_RETAINED_FILES, 351 IDS_EXTENSION_PROMPT_RETAINED_FILES_DEFAULT,
352 base::IntToString16(GetRetainedFileCount())); 352 IDS_EXTENSION_PROMPT_RETAINED_FILE_SINGULAR,
353 IDS_EXTENSION_PROMPT_RETAINED_FILES_ZERO,
354 IDS_EXTENSION_PROMPT_RETAINED_FILES_TWO,
355 IDS_EXTENSION_PROMPT_RETAINED_FILES_FEW,
356 IDS_EXTENSION_PROMPT_RETAINED_FILES_MANY,
357 };
358 std::vector<int> message_ids;
359 for (size_t i = 0; i < arraysize(kRetainedFilesMessageIDs); i++) {
360 message_ids.push_back(kRetainedFilesMessageIDs[i]);
361 }
362 return l10n_util::GetPluralStringFUTF16(message_ids, GetRetainedFileCount());
353 } 363 }
354 364
355 bool ExtensionInstallPrompt::Prompt::ShouldShowPermissions() const { 365 bool ExtensionInstallPrompt::Prompt::ShouldShowPermissions() const {
356 return GetPermissionCount() > 0 || type_ == POST_INSTALL_PERMISSIONS_PROMPT; 366 return GetPermissionCount() > 0 || type_ == POST_INSTALL_PERMISSIONS_PROMPT;
357 } 367 }
358 368
359 void ExtensionInstallPrompt::Prompt::AppendRatingStars( 369 void ExtensionInstallPrompt::Prompt::AppendRatingStars(
360 StarAppender appender, void* data) const { 370 StarAppender appender, void* data) const {
361 CHECK(appender); 371 CHECK(appender);
362 CHECK_EQ(INLINE_INSTALL_PROMPT, type_); 372 CHECK_EQ(INLINE_INSTALL_PROMPT, type_);
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 } 810 }
801 811
802 if (AutoConfirmPrompt(delegate_)) 812 if (AutoConfirmPrompt(delegate_))
803 return; 813 return;
804 814
805 if (show_dialog_callback_.is_null()) 815 if (show_dialog_callback_.is_null())
806 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); 816 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_);
807 else 817 else
808 show_dialog_callback_.Run(show_params_, delegate_, prompt_); 818 show_dialog_callback_.Run(show_params_, delegate_, prompt_);
809 } 819 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/common/extensions/permissions/permission_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698