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 "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" |
6 | 6 |
7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 22 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
23 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
25 #include "chrome/common/extensions/extension_action.h" | 25 #include "chrome/common/extensions/extension_action.h" |
26 #include "chrome/common/extensions/extension_constants.h" | 26 #include "chrome/common/extensions/extension_constants.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
29 #include "content/public/browser/notification_observer.h" | 29 #include "content/public/browser/notification_observer.h" |
30 #include "content/public/browser/notification_details.h" | 30 #include "content/public/browser/notification_details.h" |
31 #include "content/public/browser/notification_source.h" | 31 #include "content/public/browser/notification_source.h" |
32 #include "grit/chromium_strings.h" | |
33 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
34 #include "ui/base/l10n/l10n_util.h" | |
35 #include "ui/base/l10n/l10n_util_mac.h" | 33 #include "ui/base/l10n/l10n_util_mac.h" |
36 | 34 |
37 // A class that loads the extension icon on the I/O thread before showing the | 35 // A class that loads the extension icon on the I/O thread before showing the |
38 // confirmation dialog to uninstall the given extension. | 36 // confirmation dialog to uninstall the given extension. |
39 // Also acts as the extension's UI delegate in order to display the dialog. | 37 // Also acts as the extension's UI delegate in order to display the dialog. |
40 class AsyncUninstaller : public ExtensionUninstallDialog::Delegate { | 38 class AsyncUninstaller : public ExtensionUninstallDialog::Delegate { |
41 public: | 39 public: |
42 AsyncUninstaller(const Extension* extension, Profile* profile) | 40 AsyncUninstaller(const Extension* extension, Profile* profile) |
43 : extension_(extension), | 41 : extension_(extension), |
44 profile_(profile) { | 42 profile_(profile) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if ((self = [super initWithTitle:@""])) { | 161 if ((self = [super initWithTitle:@""])) { |
164 action_ = action; | 162 action_ = action; |
165 extension_ = extension; | 163 extension_ = extension; |
166 profile_ = profile; | 164 profile_ = profile; |
167 | 165 |
168 NSArray* menuItems = [NSArray arrayWithObjects: | 166 NSArray* menuItems = [NSArray arrayWithObjects: |
169 base::SysUTF8ToNSString(extension->name()), | 167 base::SysUTF8ToNSString(extension->name()), |
170 [NSMenuItem separatorItem], | 168 [NSMenuItem separatorItem], |
171 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_OPTIONS), | 169 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_OPTIONS), |
172 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_DISABLE), | 170 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_DISABLE), |
173 l10n_util::GetNSStringFWithFixup( | 171 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_UNINSTALL), |
174 IDS_EXTENSIONS_UNINSTALL, | |
175 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)), | |
176 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_HIDE_BUTTON), | 172 l10n_util::GetNSStringWithFixup(IDS_EXTENSIONS_HIDE_BUTTON), |
177 [NSMenuItem separatorItem], | 173 [NSMenuItem separatorItem], |
178 l10n_util::GetNSStringWithFixup(IDS_MANAGE_EXTENSIONS), | 174 l10n_util::GetNSStringWithFixup(IDS_MANAGE_EXTENSIONS), |
179 nil]; | 175 nil]; |
180 | 176 |
181 for (id item in menuItems) { | 177 for (id item in menuItems) { |
182 if ([item isKindOfClass:[NSMenuItem class]]) { | 178 if ([item isKindOfClass:[NSMenuItem class]]) { |
183 [self addItem:item]; | 179 [self addItem:item]; |
184 } else if ([item isKindOfClass:[NSString class]]) { | 180 } else if ([item isKindOfClass:[NSString class]]) { |
185 NSMenuItem* itemObj = [self addItemWithTitle:item | 181 NSMenuItem* itemObj = [self addItemWithTitle:item |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 317 } |
322 return YES; | 318 return YES; |
323 } | 319 } |
324 | 320 |
325 - (void)invalidateProfile { | 321 - (void)invalidateProfile { |
326 observer_.reset(); | 322 observer_.reset(); |
327 profile_ = NULL; | 323 profile_ = NULL; |
328 } | 324 } |
329 | 325 |
330 @end | 326 @end |
OLD | NEW |