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_context_menu_model.h" | 5 #include "chrome/browser/extensions/extension_context_menu_model.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_tab_util.h" | 9 #include "chrome/browser/extensions/extension_tab_util.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
14 #include "chrome/common/extensions/extension_action.h" | 14 #include "chrome/common/extensions/extension_action.h" |
15 #include "chrome/common/extensions/extension_constants.h" | 15 #include "chrome/common/extensions/extension_constants.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
18 #include "grit/chromium_strings.h" | |
19 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
20 #include "ui/base/l10n/l10n_util.h" | |
21 | 19 |
22 enum MenuEntries { | 20 enum MenuEntries { |
23 NAME = 0, | 21 NAME = 0, |
24 CONFIGURE, | 22 CONFIGURE, |
25 HIDE, | 23 HIDE, |
26 DISABLE, | 24 DISABLE, |
27 UNINSTALL, | 25 UNINSTALL, |
28 MANAGE, | 26 MANAGE, |
29 INSPECT_POPUP | 27 INSPECT_POPUP |
30 }; | 28 }; |
(...skipping 27 matching lines...) Expand all Loading... |
58 const Extension* extension = GetExtension(); | 56 const Extension* extension = GetExtension(); |
59 | 57 |
60 // The extension pointer should only be null if the extension was uninstalled, | 58 // The extension pointer should only be null if the extension was uninstalled, |
61 // and since the menu just opened, it should still be installed. | 59 // and since the menu just opened, it should still be installed. |
62 DCHECK(extension); | 60 DCHECK(extension); |
63 | 61 |
64 AddItem(NAME, UTF8ToUTF16(extension->name())); | 62 AddItem(NAME, UTF8ToUTF16(extension->name())); |
65 AddSeparator(); | 63 AddSeparator(); |
66 AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS); | 64 AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS); |
67 AddItemWithStringId(DISABLE, IDS_EXTENSIONS_DISABLE); | 65 AddItemWithStringId(DISABLE, IDS_EXTENSIONS_DISABLE); |
68 AddItem(UNINSTALL, l10n_util::GetStringFUTF16(IDS_EXTENSIONS_UNINSTALL, | 66 AddItemWithStringId(UNINSTALL, IDS_EXTENSIONS_UNINSTALL); |
69 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); | |
70 if (extension->browser_action()) | 67 if (extension->browser_action()) |
71 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); | 68 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); |
72 AddSeparator(); | 69 AddSeparator(); |
73 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSIONS); | 70 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSIONS); |
74 } | 71 } |
75 | 72 |
76 bool ExtensionContextMenuModel::IsCommandIdChecked(int command_id) const { | 73 bool ExtensionContextMenuModel::IsCommandIdChecked(int command_id) const { |
77 return false; | 74 return false; |
78 } | 75 } |
79 | 76 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 159 } |
163 | 160 |
164 void ExtensionContextMenuModel::ExtensionUninstallCanceled() { | 161 void ExtensionContextMenuModel::ExtensionUninstallCanceled() { |
165 Release(); | 162 Release(); |
166 } | 163 } |
167 | 164 |
168 const Extension* ExtensionContextMenuModel::GetExtension() const { | 165 const Extension* ExtensionContextMenuModel::GetExtension() const { |
169 ExtensionService* extension_service = profile_->GetExtensionService(); | 166 ExtensionService* extension_service = profile_->GetExtensionService(); |
170 return extension_service->GetExtensionById(extension_id_, false); | 167 return extension_service->GetExtensionById(extension_id_, false); |
171 } | 168 } |
OLD | NEW |