| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 PopupDelegate* delegate) | 35 PopupDelegate* delegate) |
| 36 : ALLOW_THIS_IN_INITIALIZER_LIST(SimpleMenuModel(this)), | 36 : ALLOW_THIS_IN_INITIALIZER_LIST(SimpleMenuModel(this)), |
| 37 extension_id_(extension->id()), | 37 extension_id_(extension->id()), |
| 38 browser_(browser), | 38 browser_(browser), |
| 39 profile_(browser->profile()), | 39 profile_(browser->profile()), |
| 40 delegate_(delegate) { | 40 delegate_(delegate) { |
| 41 InitMenu(extension); | 41 InitMenu(extension); |
| 42 | 42 |
| 43 if (profile_->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode) && | 43 if (profile_->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode) && |
| 44 delegate_) { | 44 delegate_) { |
| 45 AddSeparator(); | 45 AddSeparator(ui::NORMAL_SEPARATOR); |
| 46 AddItemWithStringId(INSPECT_POPUP, IDS_EXTENSION_ACTION_INSPECT_POPUP); | 46 AddItemWithStringId(INSPECT_POPUP, IDS_EXTENSION_ACTION_INSPECT_POPUP); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 ExtensionContextMenuModel::ExtensionContextMenuModel( | 50 ExtensionContextMenuModel::ExtensionContextMenuModel( |
| 51 const Extension* extension, | 51 const Extension* extension, |
| 52 Browser* browser) | 52 Browser* browser) |
| 53 : ALLOW_THIS_IN_INITIALIZER_LIST(SimpleMenuModel(this)), | 53 : ALLOW_THIS_IN_INITIALIZER_LIST(SimpleMenuModel(this)), |
| 54 extension_id_(extension->id()), | 54 extension_id_(extension->id()), |
| 55 browser_(browser), | 55 browser_(browser), |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 ExtensionContextMenuModel::~ExtensionContextMenuModel() {} | 158 ExtensionContextMenuModel::~ExtensionContextMenuModel() {} |
| 159 | 159 |
| 160 void ExtensionContextMenuModel::InitMenu(const Extension* extension) { | 160 void ExtensionContextMenuModel::InitMenu(const Extension* extension) { |
| 161 DCHECK(extension); | 161 DCHECK(extension); |
| 162 | 162 |
| 163 extension_action_ = extension->browser_action(); | 163 extension_action_ = extension->browser_action(); |
| 164 if (!extension_action_) | 164 if (!extension_action_) |
| 165 extension_action_ = extension->page_action(); | 165 extension_action_ = extension->page_action(); |
| 166 | 166 |
| 167 AddItem(NAME, UTF8ToUTF16(extension->name())); | 167 AddItem(NAME, UTF8ToUTF16(extension->name())); |
| 168 AddSeparator(); | 168 AddSeparator(ui::NORMAL_SEPARATOR); |
| 169 AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS_MENU_ITEM); | 169 AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS_MENU_ITEM); |
| 170 AddItemWithStringId(DISABLE, IDS_EXTENSIONS_DISABLE); | 170 AddItemWithStringId(DISABLE, IDS_EXTENSIONS_DISABLE); |
| 171 AddItem(UNINSTALL, l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); | 171 AddItem(UNINSTALL, l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); |
| 172 if (extension->browser_action()) | 172 if (extension->browser_action()) |
| 173 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); | 173 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); |
| 174 AddSeparator(); | 174 AddSeparator(ui::NORMAL_SEPARATOR); |
| 175 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSIONS); | 175 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSIONS); |
| 176 } | 176 } |
| 177 | 177 |
| 178 const Extension* ExtensionContextMenuModel::GetExtension() const { | 178 const Extension* ExtensionContextMenuModel::GetExtension() const { |
| 179 ExtensionService* extension_service = profile_->GetExtensionService(); | 179 ExtensionService* extension_service = profile_->GetExtensionService(); |
| 180 return extension_service->GetExtensionById(extension_id_, false); | 180 return extension_service->GetExtensionById(extension_id_, false); |
| 181 } | 181 } |
| OLD | NEW |