Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: chrome/browser/cocoa/extension_install_prompt.mm

Issue 463008: Makes 'Cancel' the default button for extension install/uninstall confirmatio... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/l10n_util_mac.h" 9 #include "app/l10n_util_mac.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "base/sys_string_conversions.h" 11 #include "base/sys_string_conversions.h"
12 #include "chrome/browser/extensions/extension_install_ui.h" 12 #include "chrome/browser/extensions/extension_install_ui.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 #include "grit/browser_resources.h" 14 #include "grit/browser_resources.h"
15 #include "grit/chromium_strings.h" 15 #include "grit/chromium_strings.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 #include "skia/ext/skia_utils_mac.h" 17 #include "skia/ext/skia_utils_mac.h"
18 18
19 class Profile; 19 class Profile;
20 20
21 void ExtensionInstallUI::ShowExtensionInstallUIPromptImpl( 21 void ExtensionInstallUI::ShowExtensionInstallUIPromptImpl(
22 Profile* profile, Delegate* delegate, Extension* extension, SkBitmap* icon, 22 Profile* profile, Delegate* delegate, Extension* extension, SkBitmap* icon,
23 const std::wstring& warning_text, bool is_uninstall) { 23 const std::wstring& warning_text, bool is_uninstall) {
24 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; 24 NSAlert* alert = [[[NSAlert alloc] init] autorelease];
25 [alert addButtonWithTitle:l10n_util::GetNSString( 25
26 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString(
26 is_uninstall ? IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON : 27 is_uninstall ? IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON :
27 IDS_EXTENSION_PROMPT_INSTALL_BUTTON)]; 28 IDS_EXTENSION_PROMPT_INSTALL_BUTTON)];
28 [alert addButtonWithTitle:l10n_util::GetNSString( 29 // Clear the key equivalent (currently 'Return') because cancel is the default
30 // button.
31 [continueButton setKeyEquivalent:@""];
32
33 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString(
29 IDS_EXTENSION_PROMPT_CANCEL_BUTTON)]; 34 IDS_EXTENSION_PROMPT_CANCEL_BUTTON)];
35 [cancelButton setKeyEquivalent:@"\r"];
36
30 [alert setMessageText:l10n_util::GetNSStringF( 37 [alert setMessageText:l10n_util::GetNSStringF(
31 is_uninstall ? IDS_EXTENSION_UNINSTALL_PROMPT_HEADING : 38 is_uninstall ? IDS_EXTENSION_UNINSTALL_PROMPT_HEADING :
32 IDS_EXTENSION_INSTALL_PROMPT_HEADING, 39 IDS_EXTENSION_INSTALL_PROMPT_HEADING,
33 UTF8ToUTF16(extension->name()))]; 40 UTF8ToUTF16(extension->name()))];
34 [alert setInformativeText:base::SysWideToNSString(warning_text)]; 41 [alert setInformativeText:base::SysWideToNSString(warning_text)];
35 [alert setAlertStyle:NSWarningAlertStyle]; 42 [alert setAlertStyle:NSWarningAlertStyle];
36 [alert setIcon:gfx::SkBitmapToNSImage(*icon)]; 43 [alert setIcon:gfx::SkBitmapToNSImage(*icon)];
37 44
38 if ([alert runModal] == NSAlertFirstButtonReturn) { 45 if ([alert runModal] == NSAlertFirstButtonReturn) {
39 delegate->InstallUIProceed(); 46 delegate->InstallUIProceed();
40 } else { 47 } else {
41 delegate->InstallUIAbort(); 48 delegate->InstallUIAbort();
42 } 49 }
43 } 50 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698