| 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/extensions/extension_uninstall_dialog.h" | 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 ExtensionUninstallDialog::Delegate* delegate) | 42 ExtensionUninstallDialog::Delegate* delegate) |
| 43 : ExtensionUninstallDialog(profile, browser, delegate) {} | 43 : ExtensionUninstallDialog(profile, browser, delegate) {} |
| 44 | 44 |
| 45 ExtensionUninstallDialogCocoa::~ExtensionUninstallDialogCocoa() {} | 45 ExtensionUninstallDialogCocoa::~ExtensionUninstallDialogCocoa() {} |
| 46 | 46 |
| 47 void ExtensionUninstallDialogCocoa::Show() { | 47 void ExtensionUninstallDialogCocoa::Show() { |
| 48 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; | 48 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; |
| 49 | 49 |
| 50 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString( | 50 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString( |
| 51 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON)]; | 51 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON)]; |
| 52 // Clear the key equivalent (currently 'Return') because cancel is the default | |
| 53 // button. | |
| 54 [continueButton setKeyEquivalent:@""]; | |
| 55 | |
| 56 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( | 52 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( |
| 57 IDS_CANCEL)]; | 53 IDS_CANCEL)]; |
| 58 [cancelButton setKeyEquivalent:@"\r"]; | 54 // Default to accept when triggered via chrome://extensions page. |
| 55 if (triggering_extension_) { |
| 56 [continueButton setKeyEquivalent:@""]; |
| 57 [cancelButton setKeyEquivalent:@"\r"]; |
| 58 } |
| 59 | 59 |
| 60 [alert setMessageText:base::SysUTF8ToNSString(GetHeadingText())]; | 60 [alert setMessageText:base::SysUTF8ToNSString(GetHeadingText())]; |
| 61 [alert setAlertStyle:NSWarningAlertStyle]; | 61 [alert setAlertStyle:NSWarningAlertStyle]; |
| 62 [alert setIcon:gfx::NSImageFromImageSkia(icon_)]; | 62 [alert setIcon:gfx::NSImageFromImageSkia(icon_)]; |
| 63 | 63 |
| 64 if ([alert runModal] == NSAlertFirstButtonReturn) | 64 if ([alert runModal] == NSAlertFirstButtonReturn) |
| 65 delegate_->ExtensionUninstallAccepted(); | 65 delegate_->ExtensionUninstallAccepted(); |
| 66 else | 66 else |
| 67 delegate_->ExtensionUninstallCanceled(); | 67 delegate_->ExtensionUninstallCanceled(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| 72 // static | 72 // static |
| 73 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( | 73 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( |
| 74 Profile* profile, | 74 Profile* profile, |
| 75 Browser* browser, | 75 Browser* browser, |
| 76 Delegate* delegate) { | 76 Delegate* delegate) { |
| 77 return new ExtensionUninstallDialogCocoa(profile, browser, delegate); | 77 return new ExtensionUninstallDialogCocoa(profile, browser, delegate); |
| 78 } | 78 } |
| OLD | NEW |