OLD | NEW |
(Empty) | |
| 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 |
| 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 "chrome/browser/extensions/extension_install_ui.h" |
| 13 #include "chrome/common/extensions/extension.h" |
| 14 #include "grit/browser_resources.h" |
| 15 #include "grit/chromium_strings.h" |
| 16 #include "grit/generated_resources.h" |
| 17 #include "skia/ext/skia_utils_mac.h" |
| 18 |
| 19 class Profile; |
| 20 |
| 21 void ExtensionInstallUI::ShowExtensionInstallPrompt( |
| 22 Profile* profile, Delegate* delegate, Extension* extension, SkBitmap* icon, |
| 23 const std::wstring& warning_text) { |
| 24 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; |
| 25 [alert addButtonWithTitle:l10n_util::GetNSString( |
| 26 IDS_EXTENSION_PROMPT_INSTALL_BUTTON)]; |
| 27 [alert addButtonWithTitle:l10n_util::GetNSString( |
| 28 IDS_EXTENSION_PROMPT_CANCEL_BUTTON)]; |
| 29 [alert setMessageText:l10n_util::GetNSStringF( |
| 30 IDS_EXTENSION_PROMPT_HEADING, UTF8ToUTF16(extension->name()))]; |
| 31 [alert setInformativeText:base::SysWideToNSString(warning_text)]; |
| 32 [alert setAlertStyle:NSWarningAlertStyle]; |
| 33 [alert setIcon:gfx::SkBitmapToNSImage(*icon)]; |
| 34 |
| 35 if ([alert runModal] == NSAlertFirstButtonReturn) { |
| 36 delegate->ContinueInstall(); |
| 37 } else { |
| 38 delegate->AbortInstall(); |
| 39 } |
| 40 } |
| 41 |
| 42 void ExtensionInstallUI::ShowExtensionInstallError(const std::string& error) { |
| 43 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; |
| 44 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)]; |
| 45 [alert setMessageText:l10n_util::GetNSString( |
| 46 IDS_EXTENSION_INSTALL_FAILURE_TITLE)]; |
| 47 [alert setInformativeText:base::SysUTF8ToNSString(error)]; |
| 48 [alert setAlertStyle:NSWarningAlertStyle]; |
| 49 [alert runModal]; |
| 50 } |
OLD | NEW |