Chromium Code Reviews| Index: components/app_modal/javascript_dialog_manager.cc |
| diff --git a/components/app_modal/javascript_dialog_manager.cc b/components/app_modal/javascript_dialog_manager.cc |
| index 7c4db07af63ab2e967dcdb9e2dbb2dd659e6a4d5..6475c693c8b289c2ce2598f7b6e2eccdb221ddc1 100644 |
| --- a/components/app_modal/javascript_dialog_manager.cc |
| +++ b/components/app_modal/javascript_dialog_manager.cc |
| @@ -24,6 +24,7 @@ |
| #include "net/base/net_util.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/gfx/font_list.h" |
| +#include "ui/gfx/text_elider.h" |
| namespace app_modal { |
| namespace { |
| @@ -145,6 +146,9 @@ void JavaScriptDialogManager::RunJavaScriptDialog( |
| bool is_alert = message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT; |
| base::string16 dialog_title = |
| GetTitle(web_contents, origin_url, accept_lang, is_alert); |
| + // If you can't say it in 100 characters, it doesn't need to be said. |
| + base::string16 message = |
| + gfx::TruncateString(message_text, 100, gfx::CHARACTER_BREAK); |
| extensions_client_->OnDialogOpened(web_contents); |
| @@ -153,7 +157,7 @@ void JavaScriptDialogManager::RunJavaScriptDialog( |
| &javascript_dialog_extra_data_, |
| dialog_title, |
| message_type, |
| - message_text, |
| + message, |
| default_prompt_text, |
| ShouldDisplaySuppressCheckbox(extra_data), |
| false, // is_before_unload_dialog |
| @@ -184,8 +188,10 @@ void JavaScriptDialogManager::RunBeforeUnloadDialog( |
| const base::string16 footer = l10n_util::GetStringUTF16(is_reload ? |
| IDS_BEFORERELOAD_MESSAGEBOX_FOOTER : IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER); |
| + // If you can't say it in 100 characters, it doesn't need to be said. |
| base::string16 full_message = |
| - message_text + base::ASCIIToUTF16("\n\n") + footer; |
| + gfx::TruncateString(message_text, 100, gfx::CHARACTER_BREAK) + |
|
palmer
2016/02/18 21:51:10
Rather than repeat the code and comment, abstract
|
| + base::ASCIIToUTF16("\n\n") + footer; |
| extensions_client_->OnDialogOpened(web_contents); |