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

Side by Side Diff: chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.mm

Issue 381953002: New avatar button: Consolidate text elision between Mac and Win/Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 5 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 | Annotate | Revision Log
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/ui/cocoa/javascript_app_modal_dialog_cocoa.h" 5 #include "chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 for (size_t index = 0, slots_count = 0; index < informative_text.length; 272 for (size_t index = 0, slots_count = 0; index < informative_text.length;
273 ++index) { 273 ++index) {
274 unichar current_char = [informative_text characterAtIndex:index]; 274 unichar current_char = [informative_text characterAtIndex:index];
275 if ([newline_char_set characterIsMember:current_char]) 275 if ([newline_char_set characterIsMember:current_char])
276 slots_count += kSlotsPerLine; 276 slots_count += kSlotsPerLine;
277 else 277 else
278 slots_count++; 278 slots_count++;
279 if (slots_count > kMessageTextMaxSlots) { 279 if (slots_count > kMessageTextMaxSlots) {
280 base::string16 info_text = base::SysNSStringToUTF16(informative_text); 280 base::string16 info_text = base::SysNSStringToUTF16(informative_text);
281 informative_text = base::SysUTF16ToNSString( 281 informative_text = base::SysUTF16ToNSString(
282 gfx::TruncateString(info_text, index)); 282 gfx::TruncateString(info_text, index, gfx::WORD_BREAK));
283 break; 283 break;
284 } 284 }
285 } 285 }
286 286
287 [GetAlert() setInformativeText:informative_text]; 287 [GetAlert() setInformativeText:informative_text];
288 NSString* message_text = 288 NSString* message_text =
289 base::SysUTF16ToNSString(dialog_->title()); 289 base::SysUTF16ToNSString(dialog_->title());
290 [GetAlert() setMessageText:message_text]; 290 [GetAlert() setMessageText:message_text];
291 [GetAlert() addButtonWithTitle:default_button]; 291 [GetAlert() addButtonWithTitle:default_button];
292 if (!one_button) { 292 if (!one_button) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 //////////////////////////////////////////////////////////////////////////////// 437 ////////////////////////////////////////////////////////////////////////////////
438 // NativeAppModalDialog, public: 438 // NativeAppModalDialog, public:
439 439
440 // static 440 // static
441 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( 441 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt(
442 JavaScriptAppModalDialog* dialog, 442 JavaScriptAppModalDialog* dialog,
443 gfx::NativeWindow parent_window) { 443 gfx::NativeWindow parent_window) {
444 return new JavaScriptAppModalDialogCocoa(dialog); 444 return new JavaScriptAppModalDialogCocoa(dialog);
445 } 445 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698