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