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/logging.h" | 9 #include "base/logging.h" |
10 #import "base/mac/cocoa_protocols.h" | 10 #import "base/mac/cocoa_protocols.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 : dialog_(dialog), | 96 : dialog_(dialog), |
97 helper_(NULL) { | 97 helper_(NULL) { |
98 // Determine the names of the dialog buttons based on the flags. "Default" | 98 // Determine the names of the dialog buttons based on the flags. "Default" |
99 // is the OK button. "Other" is the cancel button. We don't use the | 99 // is the OK button. "Other" is the cancel button. We don't use the |
100 // "Alternate" button in NSRunAlertPanel. | 100 // "Alternate" button in NSRunAlertPanel. |
101 NSString* default_button = l10n_util::GetNSStringWithFixup(IDS_APP_OK); | 101 NSString* default_button = l10n_util::GetNSStringWithFixup(IDS_APP_OK); |
102 NSString* other_button = l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL); | 102 NSString* other_button = l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL); |
103 bool text_field = false; | 103 bool text_field = false; |
104 bool one_button = false; | 104 bool one_button = false; |
105 switch (dialog_->javascript_message_type()) { | 105 switch (dialog_->javascript_message_type()) { |
106 case ui::JAVASCRIPT_MESSAGE_TYPE_ALERT: | 106 case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: |
107 one_button = true; | 107 one_button = true; |
108 break; | 108 break; |
109 case ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: | 109 case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: |
110 if (dialog_->is_before_unload_dialog()) { | 110 if (dialog_->is_before_unload_dialog()) { |
111 if (dialog_->is_reload()) { | 111 if (dialog_->is_reload()) { |
112 default_button = l10n_util::GetNSStringWithFixup( | 112 default_button = l10n_util::GetNSStringWithFixup( |
113 IDS_BEFORERELOAD_MESSAGEBOX_OK_BUTTON_LABEL); | 113 IDS_BEFORERELOAD_MESSAGEBOX_OK_BUTTON_LABEL); |
114 other_button = l10n_util::GetNSStringWithFixup( | 114 other_button = l10n_util::GetNSStringWithFixup( |
115 IDS_BEFORERELOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); | 115 IDS_BEFORERELOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); |
116 } else { | 116 } else { |
117 default_button = l10n_util::GetNSStringWithFixup( | 117 default_button = l10n_util::GetNSStringWithFixup( |
118 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); | 118 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); |
119 other_button = l10n_util::GetNSStringWithFixup( | 119 other_button = l10n_util::GetNSStringWithFixup( |
120 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); | 120 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); |
121 } | 121 } |
122 } | 122 } |
123 break; | 123 break; |
124 case ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT: | 124 case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: |
125 text_field = true; | 125 text_field = true; |
126 break; | 126 break; |
127 | 127 |
128 default: | 128 default: |
129 NOTREACHED(); | 129 NOTREACHED(); |
130 } | 130 } |
131 | 131 |
132 // Create a helper which will receive the sheet ended selector. It will | 132 // Create a helper which will receive the sheet ended selector. It will |
133 // delete itself when done. It doesn't need anything passed to its init | 133 // delete itself when done. It doesn't need anything passed to its init |
134 // as it will get a contextInfo parameter. | 134 // as it will get a contextInfo parameter. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 //////////////////////////////////////////////////////////////////////////////// | 215 //////////////////////////////////////////////////////////////////////////////// |
216 // NativeAppModalDialog, public: | 216 // NativeAppModalDialog, public: |
217 | 217 |
218 // static | 218 // static |
219 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( | 219 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( |
220 JavaScriptAppModalDialog* dialog, | 220 JavaScriptAppModalDialog* dialog, |
221 gfx::NativeWindow parent_window) { | 221 gfx::NativeWindow parent_window) { |
222 return new JavaScriptAppModalDialogCocoa(dialog); | 222 return new JavaScriptAppModalDialogCocoa(dialog); |
223 } | 223 } |
OLD | NEW |