| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 : dialog_(dialog), | 231 : dialog_(dialog), |
| 232 popup_helper_(new AppModalDialogHelper(dialog->web_contents())), | 232 popup_helper_(new AppModalDialogHelper(dialog->web_contents())), |
| 233 is_showing_(false) { | 233 is_showing_(false) { |
| 234 // Determine the names of the dialog buttons based on the flags. "Default" | 234 // Determine the names of the dialog buttons based on the flags. "Default" |
| 235 // is the OK button. "Other" is the cancel button. We don't use the | 235 // is the OK button. "Other" is the cancel button. We don't use the |
| 236 // "Alternate" button in NSRunAlertPanel. | 236 // "Alternate" button in NSRunAlertPanel. |
| 237 NSString* default_button = l10n_util::GetNSStringWithFixup(IDS_APP_OK); | 237 NSString* default_button = l10n_util::GetNSStringWithFixup(IDS_APP_OK); |
| 238 NSString* other_button = l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL); | 238 NSString* other_button = l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL); |
| 239 bool text_field = false; | 239 bool text_field = false; |
| 240 bool one_button = false; | 240 bool one_button = false; |
| 241 switch (dialog_->javascript_message_type()) { | 241 switch (dialog_->javascript_dialog_type()) { |
| 242 case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: | 242 case content::JAVASCRIPT_DIALOG_TYPE_ALERT: |
| 243 one_button = true; | 243 one_button = true; |
| 244 break; | 244 break; |
| 245 case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: | 245 case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM: |
| 246 if (dialog_->is_before_unload_dialog()) { | 246 if (dialog_->is_before_unload_dialog()) { |
| 247 if (dialog_->is_reload()) { | 247 if (dialog_->is_reload()) { |
| 248 default_button = l10n_util::GetNSStringWithFixup( | 248 default_button = l10n_util::GetNSStringWithFixup( |
| 249 IDS_BEFORERELOAD_MESSAGEBOX_OK_BUTTON_LABEL); | 249 IDS_BEFORERELOAD_MESSAGEBOX_OK_BUTTON_LABEL); |
| 250 other_button = l10n_util::GetNSStringWithFixup( | 250 other_button = l10n_util::GetNSStringWithFixup( |
| 251 IDS_BEFORERELOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); | 251 IDS_BEFORERELOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); |
| 252 } else { | 252 } else { |
| 253 default_button = l10n_util::GetNSStringWithFixup( | 253 default_button = l10n_util::GetNSStringWithFixup( |
| 254 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); | 254 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); |
| 255 other_button = l10n_util::GetNSStringWithFixup( | 255 other_button = l10n_util::GetNSStringWithFixup( |
| 256 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); | 256 IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 break; | 259 break; |
| 260 case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: | 260 case content::JAVASCRIPT_DIALOG_TYPE_PROMPT: |
| 261 text_field = true; | 261 text_field = true; |
| 262 break; | 262 break; |
| 263 | 263 |
| 264 default: | 264 default: |
| 265 NOTREACHED(); | 265 NOTREACHED(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 // Create a helper which will receive the sheet ended selector. It will | 268 // Create a helper which will receive the sheet ended selector. It will |
| 269 // delete itself when done. | 269 // delete itself when done. |
| 270 helper_.reset( | 270 helper_.reset( |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 | 472 |
| 473 DISALLOW_COPY_AND_ASSIGN(ChromeJavaScriptNativeDialogCocoaFactory); | 473 DISALLOW_COPY_AND_ASSIGN(ChromeJavaScriptNativeDialogCocoaFactory); |
| 474 }; | 474 }; |
| 475 | 475 |
| 476 } // namespace | 476 } // namespace |
| 477 | 477 |
| 478 void InstallChromeJavaScriptNativeDialogFactory() { | 478 void InstallChromeJavaScriptNativeDialogFactory() { |
| 479 app_modal::JavaScriptDialogManager::GetInstance()->SetNativeDialogFactory( | 479 app_modal::JavaScriptDialogManager::GetInstance()->SetNativeDialogFactory( |
| 480 base::WrapUnique(new ChromeJavaScriptNativeDialogCocoaFactory)); | 480 base::WrapUnique(new ChromeJavaScriptNativeDialogCocoaFactory)); |
| 481 } | 481 } |
| OLD | NEW |