| 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 9 #include "chrome/browser/extensions/extension_action.h" | 10 #include "chrome/browser/extensions/extension_action.h" |
| 10 #include "chrome/browser/extensions/extension_action_manager.h" | 11 #include "chrome/browser/extensions/extension_action_manager.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_system.h" | 13 #include "chrome/browser/extensions/extension_system.h" |
| 13 #include "chrome/browser/extensions/extension_tab_util.h" | 14 #include "chrome/browser/extensions/extension_tab_util.h" |
| 14 #include "chrome/browser/extensions/management_policy.h" | 15 #include "chrome/browser/extensions/management_policy.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/chrome_pages.h" | 18 #include "chrome/browser/ui/chrome_pages.h" |
| 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 Referrer(), NEW_FOREGROUND_TAB, | 110 Referrer(), NEW_FOREGROUND_TAB, |
| 110 content::PAGE_TRANSITION_LINK, false); | 111 content::PAGE_TRANSITION_LINK, false); |
| 111 browser_->OpenURL(params); | 112 browser_->OpenURL(params); |
| 112 break; | 113 break; |
| 113 } | 114 } |
| 114 case CONFIGURE: | 115 case CONFIGURE: |
| 115 DCHECK(!extensions::ManifestURL::GetOptionsPage(extension).is_empty()); | 116 DCHECK(!extensions::ManifestURL::GetOptionsPage(extension).is_empty()); |
| 116 ExtensionTabUtil::OpenOptionsPage(extension, browser_); | 117 ExtensionTabUtil::OpenOptionsPage(extension, browser_); |
| 117 break; | 118 break; |
| 118 case HIDE: { | 119 case HIDE: { |
| 119 ExtensionService* extension_service = | 120 extensions::ExtensionActionAPI::SetBrowserActionVisibility( |
| 120 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 121 extensions::ExtensionSystem::Get(profile_)-> |
| 121 extension_service->extension_prefs()-> | 122 extension_service()->extension_prefs(), |
| 122 SetBrowserActionVisibility(extension, false); | 123 extension->id(), |
| 124 false); |
| 123 break; | 125 break; |
| 124 } | 126 } |
| 125 case UNINSTALL: { | 127 case UNINSTALL: { |
| 126 AddRef(); // Balanced in Accepted() and Canceled() | 128 AddRef(); // Balanced in Accepted() and Canceled() |
| 127 extension_uninstall_dialog_.reset( | 129 extension_uninstall_dialog_.reset( |
| 128 ExtensionUninstallDialog::Create(profile_, browser_, this)); | 130 ExtensionUninstallDialog::Create(profile_, browser_, this)); |
| 129 extension_uninstall_dialog_->ConfirmUninstall(extension); | 131 extension_uninstall_dialog_->ConfirmUninstall(extension); |
| 130 break; | 132 break; |
| 131 } | 133 } |
| 132 case MANAGE: { | 134 case MANAGE: { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); | 180 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); |
| 179 AddSeparator(ui::NORMAL_SEPARATOR); | 181 AddSeparator(ui::NORMAL_SEPARATOR); |
| 180 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSION); | 182 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSION); |
| 181 } | 183 } |
| 182 | 184 |
| 183 const Extension* ExtensionContextMenuModel::GetExtension() const { | 185 const Extension* ExtensionContextMenuModel::GetExtension() const { |
| 184 ExtensionService* extension_service = | 186 ExtensionService* extension_service = |
| 185 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 187 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 186 return extension_service->GetExtensionById(extension_id_, false); | 188 return extension_service->GetExtensionById(extension_id_, false); |
| 187 } | 189 } |
| OLD | NEW |