| 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 #import "base/mac/scoped_nsobject.h" |
| 12 #import "base/strings/sys_string_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
| 15 #include "skia/ext/skia_utils_mac.h" | 16 #include "skia/ext/skia_utils_mac.h" |
| 16 #include "ui/base/l10n/l10n_util_mac.h" | 17 #include "ui/base/l10n/l10n_util_mac.h" |
| 17 #include "ui/gfx/image/image_skia_util_mac.h" | 18 #include "ui/gfx/image/image_skia_util_mac.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // The Cocoa implementation of ExtensionUninstallDialog. This has a less | 22 // The Cocoa implementation of ExtensionUninstallDialog. This has a less |
| (...skipping 28 matching lines...) Expand all Loading... |
| 50 // Default to accept when triggered via chrome://extensions page. | 51 // Default to accept when triggered via chrome://extensions page. |
| 51 if (triggering_extension_) { | 52 if (triggering_extension_) { |
| 52 [continueButton setKeyEquivalent:@""]; | 53 [continueButton setKeyEquivalent:@""]; |
| 53 [cancelButton setKeyEquivalent:@"\r"]; | 54 [cancelButton setKeyEquivalent:@"\r"]; |
| 54 } | 55 } |
| 55 | 56 |
| 56 [alert setMessageText:base::SysUTF8ToNSString(GetHeadingText())]; | 57 [alert setMessageText:base::SysUTF8ToNSString(GetHeadingText())]; |
| 57 [alert setAlertStyle:NSWarningAlertStyle]; | 58 [alert setAlertStyle:NSWarningAlertStyle]; |
| 58 [alert setIcon:gfx::NSImageFromImageSkia(icon_)]; | 59 [alert setIcon:gfx::NSImageFromImageSkia(icon_)]; |
| 59 | 60 |
| 60 if ([alert runModal] == NSAlertFirstButtonReturn) | 61 base::scoped_nsobject<NSButton> reportAbuseCheckbox; |
| 62 if (ShouldShowReportAbuseCheckbox()) { |
| 63 reportAbuseCheckbox.reset([[NSButton alloc] initWithFrame:NSZeroRect]); |
| 64 [reportAbuseCheckbox setButtonType:NSSwitchButton]; |
| 65 [reportAbuseCheckbox setTitle:l10n_util::GetNSString( |
| 66 IDS_EXTENSION_PROMPT_UNINSTALL_REPORT_ABUSE)]; |
| 67 [reportAbuseCheckbox sizeToFit]; |
| 68 [alert setAccessoryView:reportAbuseCheckbox]; |
| 69 } |
| 70 |
| 71 if ([alert runModal] == NSAlertFirstButtonReturn) { |
| 72 if (reportAbuseCheckbox.get() && [reportAbuseCheckbox state] == NSOnState) |
| 73 HandleReportAbuse(); |
| 61 delegate_->ExtensionUninstallAccepted(); | 74 delegate_->ExtensionUninstallAccepted(); |
| 62 else | 75 } else { |
| 63 delegate_->ExtensionUninstallCanceled(); | 76 delegate_->ExtensionUninstallCanceled(); |
| 77 } |
| 64 } | 78 } |
| 65 | 79 |
| 66 } // namespace | 80 } // namespace |
| 67 | 81 |
| 68 // static | 82 // static |
| 69 extensions::ExtensionUninstallDialog* | 83 extensions::ExtensionUninstallDialog* |
| 70 extensions::ExtensionUninstallDialog::Create(Profile* profile, | 84 extensions::ExtensionUninstallDialog::Create(Profile* profile, |
| 71 gfx::NativeWindow parent, | 85 gfx::NativeWindow parent, |
| 72 Delegate* delegate) { | 86 Delegate* delegate) { |
| 73 return new ExtensionUninstallDialogCocoa(profile, delegate); | 87 return new ExtensionUninstallDialogCocoa(profile, delegate); |
| 74 } | 88 } |
| OLD | NEW |