Chromium Code Reviews| 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" |
| 11 #import "base/mac/foundation_util.h" | 11 #import "base/mac/foundation_util.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 13 #import "chrome/browser/chrome_browser_application_mac.h" | 13 #import "chrome/browser/chrome_browser_application_mac.h" |
| 14 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/browser/ui/app_modal_dialogs/chrome_javascript_native_dialog_fa ctory.h" |
| 15 #include "chrome/browser/ui/cocoa/javascript_app_modal_dialog_cocoa.h" | |
|
msw
2014/11/05 23:34:37
nit: Remove redundant include (same as first).
oshima
2014/11/06 00:04:32
Done.
| |
| 15 #include "components/app_modal_dialogs/javascript_app_modal_dialog.h" | 16 #include "components/app_modal_dialogs/javascript_app_modal_dialog.h" |
| 17 #include "components/app_modal_dialogs/javascript_dialog_manager.h" | |
| 18 #include "components/app_modal_dialogs/javascript_native_dialog_factory.h" | |
| 16 #include "grit/components_strings.h" | 19 #include "grit/components_strings.h" |
| 17 #include "ui/base/l10n/l10n_util_mac.h" | 20 #include "ui/base/l10n/l10n_util_mac.h" |
| 18 #include "ui/base/ui_base_types.h" | 21 #include "ui/base/ui_base_types.h" |
| 19 #include "ui/gfx/text_elider.h" | 22 #include "ui/gfx/text_elider.h" |
| 20 #include "ui/strings/grit/ui_strings.h" | 23 #include "ui/strings/grit/ui_strings.h" |
| 21 | 24 |
| 22 namespace { | 25 namespace { |
| 23 | 26 |
| 24 const int kSlotsPerLine = 50; | 27 const int kSlotsPerLine = 50; |
| 25 const int kMessageTextMaxSlots = 2000; | 28 const int kMessageTextMaxSlots = 2000; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 } | 431 } |
| 429 | 432 |
| 430 void JavaScriptAppModalDialogCocoa::AcceptAppModalDialog() { | 433 void JavaScriptAppModalDialogCocoa::AcceptAppModalDialog() { |
| 431 [helper_ playOrQueueAction:ACTION_ACCEPT]; | 434 [helper_ playOrQueueAction:ACTION_ACCEPT]; |
| 432 } | 435 } |
| 433 | 436 |
| 434 void JavaScriptAppModalDialogCocoa::CancelAppModalDialog() { | 437 void JavaScriptAppModalDialogCocoa::CancelAppModalDialog() { |
| 435 [helper_ playOrQueueAction:ACTION_CANCEL]; | 438 [helper_ playOrQueueAction:ACTION_CANCEL]; |
| 436 } | 439 } |
| 437 | 440 |
| 438 //////////////////////////////////////////////////////////////////////////////// | 441 namespace { |
| 439 // NativeAppModalDialog, public: | |
| 440 | 442 |
| 441 // static | 443 class ChromeJavaScritpNativeDialogCocoaFactory |
| 442 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( | 444 : public JavaScriptNativeDialogFactory { |
| 443 JavaScriptAppModalDialog* dialog, | 445 public: |
| 444 gfx::NativeWindow parent_window) { | 446 ChromeJavaScritpNativeDialogCocoaFactory() {} |
| 445 return new JavaScriptAppModalDialogCocoa(dialog); | 447 ~ChromeJavaScritpNativeDialogCocoaFactory() override {} |
| 448 | |
| 449 private: | |
| 450 NativeAppModalDialog* CreateNativeJavaScriptDialog( | |
| 451 JavaScriptAppModalDialog* dialog, | |
| 452 gfx::NativeWindow parent_window) override { | |
| 453 return new JavaScriptAppModalDialogCocoa(dialog); | |
| 454 } | |
| 455 | |
| 456 DISALLOW_COPY_AND_ASSIGN(ChromeJavaScritpNativeDialogCocoaFactory); | |
| 457 }; | |
| 458 | |
| 459 } // namespace | |
| 460 | |
| 461 void InstallChromeJavaScriptNativeDialogFactory() { | |
| 462 SetJavaScriptNativeDialogFactory( | |
| 463 make_scoped_ptr(new ChromeJavaScritpNativeDialogCocoaFactory)); | |
| 446 } | 464 } |
| OLD | NEW |