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 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 NOTREACHED(); | 133 NOTREACHED(); |
134 } | 134 } |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 - (void)showAlert { | 138 - (void)showAlert { |
139 DCHECK(nativeDialog_); | 139 DCHECK(nativeDialog_); |
140 DCHECK(!alertShown_); | 140 DCHECK(!alertShown_); |
141 alertShown_ = YES; | 141 alertShown_ = YES; |
142 NSAlert* alert = [self alert]; | 142 NSAlert* alert = [self alert]; |
| 143 |
| 144 [alert layout]; |
| 145 [[alert window] recalculateKeyViewLoop]; |
| 146 |
143 [alert beginSheetModalForWindow:nil // nil here makes it app-modal | 147 [alert beginSheetModalForWindow:nil // nil here makes it app-modal |
144 modalDelegate:self | 148 modalDelegate:self |
145 didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) | 149 didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) |
146 contextInfo:NULL]; | 150 contextInfo:NULL]; |
147 } | 151 } |
148 | 152 |
149 - (void)acceptAlert { | 153 - (void)acceptAlert { |
150 DCHECK(nativeDialog_); | 154 DCHECK(nativeDialog_); |
151 if (!alertShown_) { | 155 if (!alertShown_) { |
152 [self sendAcceptToNativeDialog]; | 156 [self sendAcceptToNativeDialog]; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 472 |
469 DISALLOW_COPY_AND_ASSIGN(ChromeJavaScriptNativeDialogCocoaFactory); | 473 DISALLOW_COPY_AND_ASSIGN(ChromeJavaScriptNativeDialogCocoaFactory); |
470 }; | 474 }; |
471 | 475 |
472 } // namespace | 476 } // namespace |
473 | 477 |
474 void InstallChromeJavaScriptNativeDialogFactory() { | 478 void InstallChromeJavaScriptNativeDialogFactory() { |
475 app_modal::JavaScriptDialogManager::GetInstance()->SetNativeDialogFactory( | 479 app_modal::JavaScriptDialogManager::GetInstance()->SetNativeDialogFactory( |
476 base::WrapUnique(new ChromeJavaScriptNativeDialogCocoaFactory)); | 480 base::WrapUnique(new ChromeJavaScriptNativeDialogCocoaFactory)); |
477 } | 481 } |
OLD | NEW |