summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 22:52:31 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 22:52:31 +0000
commitbcd0234ff7b8c0e8628663b45ca98f8be306e756 (patch)
tree83923734d895c34ba641010c12f842dac621ec04
parent2fa20c6731d7cc11bdbbfb17503f7a02ac603b10 (diff)
downloadchromium_src-bcd0234ff7b8c0e8628663b45ca98f8be306e756.zip
chromium_src-bcd0234ff7b8c0e8628663b45ca98f8be306e756.tar.gz
chromium_src-bcd0234ff7b8c0e8628663b45ca98f8be306e756.tar.bz2
Put in a "knock it off" checkbox in Mac alerts, to prevent web pages from locking the user out. Matches existing UI in Linux/Windows.
BUG=http://crbug.com/26800 TEST=as in bug Review URL: http://codereview.chromium.org/460025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33610 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/app_modal_dialog_mac.mm22
1 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/app_modal_dialog_mac.mm b/chrome/browser/app_modal_dialog_mac.mm
index f6e95f8..c0343be 100644
--- a/chrome/browser/app_modal_dialog_mac.mm
+++ b/chrome/browser/app_modal_dialog_mac.mm
@@ -51,7 +51,7 @@
// |contextInfo| is the bridge back to the C++ AppModalDialog. When complete,
// autorelease to clean ourselves up.
-- (void)alertDidEnd:(NSAlert *)alert
+- (void)alertDidEnd:(NSAlert*)alert
returnCode:(int)returnCode
contextInfo:(void*)contextInfo {
AppModalDialog* bridge = reinterpret_cast<AppModalDialog*>(contextInfo);
@@ -59,14 +59,20 @@
if (textField_)
input = base::SysNSStringToWide([textField_ stringValue]);
switch (returnCode) {
- case NSAlertFirstButtonReturn: // OK
- bridge->OnAccept(input, false);
+ case NSAlertFirstButtonReturn: { // OK
+ bool shouldSuppress = false;
+ if ([alert showsSuppressionButton])
+ shouldSuppress = [[alert suppressionButton] state] == NSOnState;
+ bridge->OnAccept(input, shouldSuppress);
break;
- case NSAlertSecondButtonReturn: // Cancel
+ }
+ case NSAlertSecondButtonReturn: { // Cancel
bridge->OnCancel();
break;
- default:
+ }
+ default: {
NOTREACHED();
+ }
}
[self autorelease];
delete bridge; // Done with the dialog, it needs be destroyed.
@@ -122,6 +128,12 @@ void AppModalDialog::CreateAndShowDialog() {
[alert addButtonWithTitle:default_button];
if (!one_button)
[alert addButtonWithTitle:other_button];
+ if (display_suppress_checkbox_) {
+ [alert setShowsSuppressionButton:YES];
+ NSString* suppression_title = l10n_util::GetNSStringWithFixup(
+ IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION);
+ [[alert suppressionButton] setTitle:suppression_title];
+ }
[alert beginSheetModalForWindow:nil // nil here makes it app-modal
modalDelegate:helper