| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import <Cocoa/Cocoa.h> | |
| 6 | |
| 7 #include <string> | |
| 8 | |
| 9 #include "app/l10n_util_mac.h" | |
| 10 #include "app/resource_bundle.h" | |
| 11 #include "base/sys_string_conversions.h" | |
| 12 #include "base/utf_string_conversions.h" | |
| 13 #include "chrome/browser/extensions/extension_install_ui.h" | |
| 14 #include "chrome/common/extensions/extension.h" | |
| 15 #include "grit/browser_resources.h" | |
| 16 #include "grit/chromium_strings.h" | |
| 17 #include "grit/generated_resources.h" | |
| 18 #include "skia/ext/skia_utils_mac.h" | |
| 19 | |
| 20 class Profile; | |
| 21 | |
| 22 void ExtensionInstallUI::ShowExtensionInstallUIPromptImpl( | |
| 23 Profile* profile, | |
| 24 Delegate* delegate, | |
| 25 const Extension* extension, | |
| 26 SkBitmap* icon, | |
| 27 ExtensionInstallUI::PromptType type) { | |
| 28 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; | |
| 29 | |
| 30 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString( | |
| 31 ExtensionInstallUI::kButtonIds[type])]; | |
| 32 // Clear the key equivalent (currently 'Return') because cancel is the default | |
| 33 // button. | |
| 34 [continueButton setKeyEquivalent:@""]; | |
| 35 | |
| 36 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( | |
| 37 IDS_CANCEL)]; | |
| 38 [cancelButton setKeyEquivalent:@"\r"]; | |
| 39 | |
| 40 [alert setMessageText:l10n_util::GetNSStringF( | |
| 41 ExtensionInstallUI::kHeadingIds[type], | |
| 42 UTF8ToUTF16(extension->name()))]; | |
| 43 [alert setAlertStyle:NSWarningAlertStyle]; | |
| 44 [alert setIcon:gfx::SkBitmapToNSImage(*icon)]; | |
| 45 | |
| 46 if ([alert runModal] == NSAlertFirstButtonReturn) { | |
| 47 delegate->InstallUIProceed(); | |
| 48 } else { | |
| 49 delegate->InstallUIAbort(); | |
| 50 } | |
| 51 } | |
| OLD | NEW |