OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/js_modal_dialog_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/js_modal_dialog_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "base/mac/cocoa_protocols.h" | 10 #import "base/mac/cocoa_protocols.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 : dialog_(dialog), | 100 : dialog_(dialog), |
101 helper_(NULL) { | 101 helper_(NULL) { |
102 // Determine the names of the dialog buttons based on the flags. "Default" | 102 // Determine the names of the dialog buttons based on the flags. "Default" |
103 // is the OK button. "Other" is the cancel button. We don't use the | 103 // is the OK button. "Other" is the cancel button. We don't use the |
104 // "Alternate" button in NSRunAlertPanel. | 104 // "Alternate" button in NSRunAlertPanel. |
105 NSString* default_button = l10n_util::GetNSStringWithFixup(IDS_APP_OK); | 105 NSString* default_button = l10n_util::GetNSStringWithFixup(IDS_APP_OK); |
106 NSString* other_button = l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL); | 106 NSString* other_button = l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL); |
107 bool text_field = false; | 107 bool text_field = false; |
108 bool one_button = false; | 108 bool one_button = false; |
109 switch (dialog_->dialog_flags()) { | 109 switch (dialog_->dialog_flags()) { |
110 case ui::MessageBoxFlags::kIsJavascriptAlert: | 110 case ui::MESSAGE_BOX_IS_JAVASCRIPT_ALERT_DIALOG: |
111 one_button = true; | 111 one_button = true; |
112 break; | 112 break; |
113 case ui::MessageBoxFlags::kIsJavascriptConfirm: | 113 case ui::MESSAGE_BOX_IS_JAVASCRIPT_CONFIRM_DIALOG: |
114 if (dialog_->is_before_unload_dialog()) { | 114 if (dialog_->is_before_unload_dialog()) { |
115 default_button = l10n_util::GetNSStringWithFixup( | 115 default_button = l10n_util::GetNSStringWithFixup( |
116 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); | 116 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); |
117 other_button = l10n_util::GetNSStringWithFixup( | 117 other_button = l10n_util::GetNSStringWithFixup( |
118 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); | 118 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); |
119 } | 119 } |
120 break; | 120 break; |
121 case ui::MessageBoxFlags::kIsJavascriptPrompt: | 121 case ui::MESSAGE_BOX_IS_JAVASCRIPT_PROMPT_DIALOG: |
122 text_field = true; | 122 text_field = true; |
123 break; | 123 break; |
124 | 124 |
125 default: | 125 default: |
126 NOTREACHED(); | 126 NOTREACHED(); |
127 } | 127 } |
128 | 128 |
129 // Create a helper which will receive the sheet ended selector. It will | 129 // Create a helper which will receive the sheet ended selector. It will |
130 // delete itself when done. It doesn't need anything passed to its init | 130 // delete itself when done. It doesn't need anything passed to its init |
131 // as it will get a contextInfo parameter. | 131 // as it will get a contextInfo parameter. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 //////////////////////////////////////////////////////////////////////////////// | 212 //////////////////////////////////////////////////////////////////////////////// |
213 // NativeAppModalDialog, public: | 213 // NativeAppModalDialog, public: |
214 | 214 |
215 // static | 215 // static |
216 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( | 216 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( |
217 JavaScriptAppModalDialog* dialog, | 217 JavaScriptAppModalDialog* dialog, |
218 gfx::NativeWindow parent_window) { | 218 gfx::NativeWindow parent_window) { |
219 return new JSModalDialogCocoa(dialog); | 219 return new JSModalDialogCocoa(dialog); |
220 } | 220 } |
OLD | NEW |