Chromium Code Reviews| 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 #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_uninstall_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 // static | 20 // static |
| 21 void ExtensionUninstallDialog::Show( | 21 void ExtensionUninstallUI::ShowDialog() { |
| 22 Profile* profile, | |
| 23 ExtensionUninstallDialog::Delegate* delegate, | |
| 24 const Extension* extension, | |
| 25 SkBitmap* icon) { | |
| 26 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; | 22 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; |
| 27 | 23 |
| 28 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString( | 24 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString( |
| 29 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON)]; | 25 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON)]; |
| 30 // Clear the key equivalent (currently 'Return') because cancel is the default | 26 // Clear the key equivalent (currently 'Return') because cancel is the default |
| 31 // button. | 27 // button. |
| 32 [continueButton setKeyEquivalent:@""]; | 28 [continueButton setKeyEquivalent:@""]; |
| 33 | 29 |
| 34 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( | 30 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( |
| 35 IDS_CANCEL)]; | 31 IDS_CANCEL)]; |
| 36 [cancelButton setKeyEquivalent:@"\r"]; | 32 [cancelButton setKeyEquivalent:@"\r"]; |
| 37 | 33 |
| 38 [alert setMessageText:l10n_util::GetNSStringF( | 34 [alert setMessageText:l10n_util::GetNSStringF( |
| 39 IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, | 35 IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, |
| 40 UTF8ToUTF16(extension->name()))]; | 36 UTF8ToUTF16(extension_->name()))]; |
| 41 [alert setAlertStyle:NSWarningAlertStyle]; | 37 [alert setAlertStyle:NSWarningAlertStyle]; |
| 42 [alert setIcon:gfx::SkBitmapToNSImage(*icon)]; | 38 [alert setIcon:gfx::SkBitmapToNSImage(icon_)]; |
| 43 | 39 |
| 44 if ([alert runModal] == NSAlertFirstButtonReturn) | 40 if ([alert runModal] == NSAlertFirstButtonReturn) |
| 45 delegate->ExtensionDialogAccepted(); | 41 delegate_->ExtensionUninstallAccepted(); |
| 46 else | 42 else |
| 47 delegate->ExtensionDialogCanceled(); | 43 delegate_->ExtensionUninstallCanceled(); |
| 44 | |
| 45 // We don't need to create an ExtensionUninstallDialog on Mac because the | |
| 46 // dialog prevents the page from changing so the widget is only closed by | |
|
Mihai Parparita -not on Chrome
2011/09/20 23:54:47
Can you make this comment a bit more explicit (add
jstritar
2011/09/22 16:47:13
Done.
| |
| 47 // user action. | |
| 48 } | 48 } |
| OLD | NEW |