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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_uninstall_dialog_cocoa.mm

Issue 6721013: extensions: Refactor ExtensionInstallUI class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: indentation Created 9 years, 9 months 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
OLDNEW
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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/extensions/extension_install_dialog.h" 11 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 #include "grit/chromium_strings.h" 14 #include "grit/chromium_strings.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "skia/ext/skia_utils_mac.h" 16 #include "skia/ext/skia_utils_mac.h"
17 #include "ui/base/l10n/l10n_util_mac.h" 17 #include "ui/base/l10n/l10n_util_mac.h"
18 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
19 19
20 void ShowExtensionInstallDialog(Profile* profile, 20 // static
21 ExtensionInstallUI::Delegate* delegate, 21 void ExtensionUninstallDialog::Show(
22 const Extension* extension, 22 Profile* profile,
23 SkBitmap* icon, 23 ExtensionUninstallDialog::Delegate* delegate,
24 ExtensionInstallUI::PromptType type) { 24 const Extension* extension,
25 SkBitmap* icon) {
25 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; 26 NSAlert* alert = [[[NSAlert alloc] init] autorelease];
26 27
27 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString( 28 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString(
28 ExtensionInstallUI::kButtonIds[type])]; 29 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON)];
29 // Clear the key equivalent (currently 'Return') because cancel is the default 30 // Clear the key equivalent (currently 'Return') because cancel is the default
30 // button. 31 // button.
31 [continueButton setKeyEquivalent:@""]; 32 [continueButton setKeyEquivalent:@""];
32 33
33 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( 34 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString(
34 IDS_CANCEL)]; 35 IDS_CANCEL)];
35 [cancelButton setKeyEquivalent:@"\r"]; 36 [cancelButton setKeyEquivalent:@"\r"];
36 37
37 [alert setMessageText:l10n_util::GetNSStringF( 38 [alert setMessageText:l10n_util::GetNSStringF(
38 ExtensionInstallUI::kHeadingIds[type], 39 IDS_EXTENSION_UNINSTALL_PROMPT_HEADING,
39 UTF8ToUTF16(extension->name()))]; 40 UTF8ToUTF16(extension->name()))];
40 [alert setAlertStyle:NSWarningAlertStyle]; 41 [alert setAlertStyle:NSWarningAlertStyle];
41 [alert setIcon:gfx::SkBitmapToNSImage(*icon)]; 42 [alert setIcon:gfx::SkBitmapToNSImage(*icon)];
42 43
43 if ([alert runModal] == NSAlertFirstButtonReturn) { 44 if ([alert runModal] == NSAlertFirstButtonReturn)
44 delegate->InstallUIProceed(); 45 delegate->ExtensionDialogAccepted();
45 } else { 46 else
46 delegate->InstallUIAbort(); 47 delegate->ExtensionDialogCanceled();
47 }
48 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698