| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |