| 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 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.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 #include "ui/gfx/image/image_skia_util_mac.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // The Cocoa implementation of ExtensionUninstallDialog. This has a less | 23 // The Cocoa implementation of ExtensionUninstallDialog. This has a less |
| 23 // complex life cycle than the Views and GTK implementations because the | 24 // complex life cycle than the Views and GTK implementations because the |
| 24 // dialog blocks the page from navigating away and destroying the dialog, | 25 // dialog blocks the page from navigating away and destroying the dialog, |
| 25 // so there's no way for the dialog to outlive its delegate. | 26 // so there's no way for the dialog to outlive its delegate. |
| 26 class ExtensionUninstallDialogCocoa : public ExtensionUninstallDialog { | 27 class ExtensionUninstallDialogCocoa : public ExtensionUninstallDialog { |
| 27 public: | 28 public: |
| 28 ExtensionUninstallDialogCocoa(Browser* browser, Delegate* delegate); | 29 ExtensionUninstallDialogCocoa(Browser* browser, Delegate* delegate); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 48 [continueButton setKeyEquivalent:@""]; | 49 [continueButton setKeyEquivalent:@""]; |
| 49 | 50 |
| 50 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( | 51 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( |
| 51 IDS_CANCEL)]; | 52 IDS_CANCEL)]; |
| 52 [cancelButton setKeyEquivalent:@"\r"]; | 53 [cancelButton setKeyEquivalent:@"\r"]; |
| 53 | 54 |
| 54 [alert setMessageText:l10n_util::GetNSStringF( | 55 [alert setMessageText:l10n_util::GetNSStringF( |
| 55 IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, | 56 IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, |
| 56 UTF8ToUTF16(extension_->name()))]; | 57 UTF8ToUTF16(extension_->name()))]; |
| 57 [alert setAlertStyle:NSWarningAlertStyle]; | 58 [alert setAlertStyle:NSWarningAlertStyle]; |
| 58 [alert setIcon:gfx::SkBitmapToNSImage(icon_)]; | 59 [alert setIcon:gfx::NSImageFromImageSkia(icon_)]; |
| 59 | 60 |
| 60 if ([alert runModal] == NSAlertFirstButtonReturn) | 61 if ([alert runModal] == NSAlertFirstButtonReturn) |
| 61 delegate_->ExtensionUninstallAccepted(); | 62 delegate_->ExtensionUninstallAccepted(); |
| 62 else | 63 else |
| 63 delegate_->ExtensionUninstallCanceled(); | 64 delegate_->ExtensionUninstallCanceled(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 } // namespace | 67 } // namespace |
| 67 | 68 |
| 68 // static | 69 // static |
| 69 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( | 70 ExtensionUninstallDialog* ExtensionUninstallDialog::Create( |
| 70 Browser* browser, Delegate* delegate) { | 71 Browser* browser, Delegate* delegate) { |
| 71 return new ExtensionUninstallDialogCocoa(browser, delegate); | 72 return new ExtensionUninstallDialogCocoa(browser, delegate); |
| 72 } | 73 } |
| OLD | NEW |