| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/shell_javascript_dialog.h" | 5 #include "content/shell/browser/shell_javascript_dialog.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 alert_.reset(); | 82 alert_.reset(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 @end | 85 @end |
| 86 | 86 |
| 87 namespace content { | 87 namespace content { |
| 88 | 88 |
| 89 ShellJavaScriptDialog::ShellJavaScriptDialog( | 89 ShellJavaScriptDialog::ShellJavaScriptDialog( |
| 90 ShellJavaScriptDialogManager* manager, | 90 ShellJavaScriptDialogManager* manager, |
| 91 gfx::NativeWindow parent_window, | 91 gfx::NativeWindow parent_window, |
| 92 JavaScriptMessageType message_type, | 92 JavaScriptDialogType dialog_type, |
| 93 const base::string16& message_text, | 93 const base::string16& message_text, |
| 94 const base::string16& default_prompt_text, | 94 const base::string16& default_prompt_text, |
| 95 const JavaScriptDialogManager::DialogClosedCallback& callback) | 95 const JavaScriptDialogManager::DialogClosedCallback& callback) |
| 96 : callback_(callback) { | 96 : callback_(callback) { |
| 97 bool text_field = message_type == JAVASCRIPT_MESSAGE_TYPE_PROMPT; | 97 bool text_field = dialog_type == JAVASCRIPT_DIALOG_TYPE_PROMPT; |
| 98 bool one_button = message_type == JAVASCRIPT_MESSAGE_TYPE_ALERT; | 98 bool one_button = dialog_type == JAVASCRIPT_DIALOG_TYPE_ALERT; |
| 99 | 99 |
| 100 helper_ = | 100 helper_ = |
| 101 [[ShellJavaScriptDialogHelper alloc] initHelperWithManager:manager | 101 [[ShellJavaScriptDialogHelper alloc] initHelperWithManager:manager |
| 102 andCallback:callback]; | 102 andCallback:callback]; |
| 103 | 103 |
| 104 // Show the modal dialog. | 104 // Show the modal dialog. |
| 105 NSAlert* alert = [helper_ alert]; | 105 NSAlert* alert = [helper_ alert]; |
| 106 NSTextField* field = nil; | 106 NSTextField* field = nil; |
| 107 if (text_field) { | 107 if (text_field) { |
| 108 field = [helper_ textField]; | 108 field = [helper_ textField]; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 126 | 126 |
| 127 ShellJavaScriptDialog::~ShellJavaScriptDialog() { | 127 ShellJavaScriptDialog::~ShellJavaScriptDialog() { |
| 128 [helper_ release]; | 128 [helper_ release]; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void ShellJavaScriptDialog::Cancel() { | 131 void ShellJavaScriptDialog::Cancel() { |
| 132 [helper_ cancel]; | 132 [helper_ cancel]; |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace content | 135 } // namespace content |
| OLD | NEW |