| 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/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 14 #include "extensions/common/extension.h" | 14 #include "extensions/common/extension.h" |
| 15 #include "skia/ext/skia_utils_mac.h" | 15 #include "skia/ext/skia_utils_mac.h" |
| 16 #include "ui/base/l10n/l10n_util_mac.h" | 16 #include "ui/base/l10n/l10n_util_mac.h" |
| 17 #include "ui/gfx/image/image_skia_util_mac.h" | 17 #include "ui/gfx/image/image_skia_util_mac.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // The Cocoa implementation of ExtensionUninstallDialog. This has a less | 21 // The Cocoa implementation of ExtensionUninstallDialog. This has a less |
| 22 // complex life cycle than the Views and GTK implementations because the | 22 // complex life cycle than the Views and GTK implementations because the |
| 23 // dialog blocks the page from navigating away and destroying the dialog, | 23 // dialog blocks the page from navigating away and destroying the dialog, |
| 24 // so there's no way for the dialog to outlive its delegate. | 24 // so there's no way for the dialog to outlive its delegate. |
| 25 class ExtensionUninstallDialogCocoa | 25 class ExtensionUninstallDialogCocoa |
| 26 : public extensions::ExtensionUninstallDialog { | 26 : public extensions::ExtensionUninstallDialog { |
| 27 public: | 27 public: |
| 28 ExtensionUninstallDialogCocoa(Profile* profile, | 28 ExtensionUninstallDialogCocoa(Profile* profile, Delegate* delegate); |
| 29 gfx::NativeWindow parent, | |
| 30 Delegate* delegate); | |
| 31 virtual ~ExtensionUninstallDialogCocoa() OVERRIDE; | 29 virtual ~ExtensionUninstallDialogCocoa() OVERRIDE; |
| 32 | 30 |
| 33 private: | 31 private: |
| 34 virtual void Show() OVERRIDE; | 32 virtual void Show() OVERRIDE; |
| 35 }; | 33 }; |
| 36 | 34 |
| 37 ExtensionUninstallDialogCocoa::ExtensionUninstallDialogCocoa( | 35 ExtensionUninstallDialogCocoa::ExtensionUninstallDialogCocoa( |
| 38 Profile* profile, | 36 Profile* profile, |
| 39 gfx::NativeWindow parent, | |
| 40 extensions::ExtensionUninstallDialog::Delegate* delegate) | 37 extensions::ExtensionUninstallDialog::Delegate* delegate) |
| 41 : extensions::ExtensionUninstallDialog(profile, parent, delegate) { | 38 : extensions::ExtensionUninstallDialog(profile, delegate) { |
| 42 } | 39 } |
| 43 | 40 |
| 44 ExtensionUninstallDialogCocoa::~ExtensionUninstallDialogCocoa() {} | 41 ExtensionUninstallDialogCocoa::~ExtensionUninstallDialogCocoa() {} |
| 45 | 42 |
| 46 void ExtensionUninstallDialogCocoa::Show() { | 43 void ExtensionUninstallDialogCocoa::Show() { |
| 47 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; | 44 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; |
| 48 | 45 |
| 49 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString( | 46 NSButton* continueButton = [alert addButtonWithTitle:l10n_util::GetNSString( |
| 50 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON)]; | 47 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON)]; |
| 51 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( | 48 NSButton* cancelButton = [alert addButtonWithTitle:l10n_util::GetNSString( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 66 delegate_->ExtensionUninstallCanceled(); | 63 delegate_->ExtensionUninstallCanceled(); |
| 67 } | 64 } |
| 68 | 65 |
| 69 } // namespace | 66 } // namespace |
| 70 | 67 |
| 71 // static | 68 // static |
| 72 extensions::ExtensionUninstallDialog* | 69 extensions::ExtensionUninstallDialog* |
| 73 extensions::ExtensionUninstallDialog::Create(Profile* profile, | 70 extensions::ExtensionUninstallDialog::Create(Profile* profile, |
| 74 gfx::NativeWindow parent, | 71 gfx::NativeWindow parent, |
| 75 Delegate* delegate) { | 72 Delegate* delegate) { |
| 76 return new ExtensionUninstallDialogCocoa(profile, parent, delegate); | 73 return new ExtensionUninstallDialogCocoa(profile, delegate); |
| 77 } | 74 } |
| OLD | NEW |