diff options
author | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-22 21:19:02 +0000 |
---|---|---|
committer | tsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-22 21:19:02 +0000 |
commit | af4b9df213e776858d025ec39059831ce15904d0 (patch) | |
tree | 8eb5cf37b46397605469d6506329693b5735802e /chrome | |
parent | ed56a7a029ec8515ab30ba13ee1dcdb4721c32d4 (diff) | |
download | chromium_src-af4b9df213e776858d025ec39059831ce15904d0.zip chromium_src-af4b9df213e776858d025ec39059831ce15904d0.tar.gz chromium_src-af4b9df213e776858d025ec39059831ce15904d0.tar.bz2 |
Last part of change for bug 49747.
Implements the two-dimensional elider in app/text_elider.cc, and calls it from js_modal_dialog to reformat the message text prior to displaying an alert box.
The elider is implemented using the abstractions introduced in the previous CLs for bug 49747.
BUG=49746
TEST=TextEliderTest.*
Review URL: http://codereview.chromium.org/5964007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc b/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc index 8fe0499..801562d 100644 --- a/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc +++ b/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc @@ -6,6 +6,7 @@ #include "app/text_elider.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -17,7 +18,8 @@ namespace { // The maximum sizes of various texts passed to us from javascript. -const int kMessageTextMaxSize = 3000; +const int kMessageTextMaxRows = 32; +const int kMessageTextMaxCols = 132; const int kDefaultPromptTextSize = 2000; } // namespace @@ -40,7 +42,10 @@ JavaScriptAppModalDialog::JavaScriptAppModalDialog( reply_msg_(reply_msg) { // We trim the various parts of the message dialog because otherwise we can // overflow the message dialog (and crash/hang the GTK+ version). - gfx::ElideString(message_text, kMessageTextMaxSize, &message_text_); + string16 elided_text; + gfx::ElideRectangleString(WideToUTF16(message_text), + kMessageTextMaxRows, kMessageTextMaxCols, &elided_text); + message_text_ = UTF16ToWide(elided_text); gfx::ElideString(default_prompt_text, kDefaultPromptTextSize, &default_prompt_text_); |