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