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 if (triggering_extension_) |
55 // Default to cancel when uninstall is triggered by API. | |
Yoyo Zhou
2014/04/18 23:07:13
This should also say "Default to accept when trigg
| |
56 [continueButton setKeyEquivalent:@""]; | |
57 [cancelButton setKeyEquivalent:@"\r"]; | |
Yoyo Zhou
2014/04/18 23:07:13
This indentation level looks like a mistake.
Isaac (away)
2014/04/18 23:42:44
I believe both of these lines are needed to switch
Yoyo Zhou
2014/04/18 23:48:05
How about some braces?
Isaac (away)
2014/04/18 23:54:51
Done. Was trying to copy style from line 63-66.
| |
59 | 58 |
60 [alert setMessageText:base::SysUTF8ToNSString(GetHeadingText())]; | 59 [alert setMessageText:base::SysUTF8ToNSString(GetHeadingText())]; |
61 [alert setAlertStyle:NSWarningAlertStyle]; | 60 [alert setAlertStyle:NSWarningAlertStyle]; |
62 [alert setIcon:gfx::NSImageFromImageSkia(icon_)]; | 61 [alert setIcon:gfx::NSImageFromImageSkia(icon_)]; |
63 | 62 |
64 if ([alert runModal] == NSAlertFirstButtonReturn) | 63 if ([alert runModal] == NSAlertFirstButtonReturn) |
65 delegate_->ExtensionUninstallAccepted(); | 64 delegate_->ExtensionUninstallAccepted(); |
66 else | 65 else |
67 delegate_->ExtensionUninstallCanceled(); | 66 delegate_->ExtensionUninstallCanceled(); |
68 } | 67 } |
69 | 68 |
70 } // namespace | 69 } // namespace |
71 | 70 |
72 // static | 71 // static |
73 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( | 72 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( |
74 Profile* profile, | 73 Profile* profile, |
75 Browser* browser, | 74 Browser* browser, |
76 Delegate* delegate) { | 75 Delegate* delegate) { |
77 return new ExtensionUninstallDialogCocoa(profile, browser, delegate); | 76 return new ExtensionUninstallDialogCocoa(profile, browser, delegate); |
78 } | 77 } |
OLD | NEW |