| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/js_modal_dialog_cocoa.h" | 5 #include "chrome/browser/cocoa/js_modal_dialog_cocoa.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
| 10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 void JSModalDialogCocoa::ShowAppModalDialog() { | 179 void JSModalDialogCocoa::ShowAppModalDialog() { |
| 180 [alert_ | 180 [alert_ |
| 181 beginSheetModalForWindow:nil // nil here makes it app-modal | 181 beginSheetModalForWindow:nil // nil here makes it app-modal |
| 182 modalDelegate:helper_.get() | 182 modalDelegate:helper_.get() |
| 183 didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) | 183 didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) |
| 184 contextInfo:this]; | 184 contextInfo:this]; |
| 185 | 185 |
| 186 if ([helper_ textField]) | 186 if ([alert_ accessoryView]) |
| 187 [[alert_ window] makeFirstResponder:[helper_ textField]]; | 187 [[alert_ window] makeFirstResponder:[alert_ accessoryView]]; |
| 188 } | 188 } |
| 189 | 189 |
| 190 void JSModalDialogCocoa::ActivateAppModalDialog() { | 190 void JSModalDialogCocoa::ActivateAppModalDialog() { |
| 191 } | 191 } |
| 192 | 192 |
| 193 void JSModalDialogCocoa::CloseAppModalDialog() { | 193 void JSModalDialogCocoa::CloseAppModalDialog() { |
| 194 DCHECK([alert_ isKindOfClass:[NSAlert class]]); | 194 DCHECK([alert_ isKindOfClass:[NSAlert class]]); |
| 195 [NSApp endSheet:[alert_ window]]; | 195 [NSApp endSheet:[alert_ window]]; |
| 196 alert_ = NULL; | 196 alert_ = NULL; |
| 197 } | 197 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 209 | 209 |
| 210 //////////////////////////////////////////////////////////////////////////////// | 210 //////////////////////////////////////////////////////////////////////////////// |
| 211 // NativeAppModalDialog, public: | 211 // NativeAppModalDialog, public: |
| 212 | 212 |
| 213 // static | 213 // static |
| 214 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( | 214 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( |
| 215 JavaScriptAppModalDialog* dialog, | 215 JavaScriptAppModalDialog* dialog, |
| 216 gfx::NativeWindow parent_window) { | 216 gfx::NativeWindow parent_window) { |
| 217 return new JSModalDialogCocoa(dialog); | 217 return new JSModalDialogCocoa(dialog); |
| 218 } | 218 } |
| OLD | NEW |