| 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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 10 #include "chrome/browser/extensions/extension_action.h" | 10 #include "chrome/browser/extensions/extension_action.h" |
| 11 #include "chrome/browser/extensions/extension_action_manager.h" | 11 #include "chrome/browser/extensions/extension_action_manager.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/extension_tab_util.h" | 13 #include "chrome/browser/extensions/extension_tab_util.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" |
| 16 #include "chrome/browser/ui/chrome_pages.h" | 17 #include "chrome/browser/ui/chrome_pages.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
| 19 #include "chrome/common/extensions/manifest_url_handler.h" | 20 #include "chrome/common/extensions/manifest_url_handler.h" |
| 20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 22 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 23 #include "extensions/browser/extension_prefs.h" | 24 #include "extensions/browser/extension_prefs.h" |
| 24 #include "extensions/browser/extension_system.h" | 25 #include "extensions/browser/extension_system.h" |
| 25 #include "extensions/browser/management_policy.h" | 26 #include "extensions/browser/management_policy.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 break; | 119 break; |
| 119 case HIDE: { | 120 case HIDE: { |
| 120 extensions::ExtensionActionAPI::SetBrowserActionVisibility( | 121 extensions::ExtensionActionAPI::SetBrowserActionVisibility( |
| 121 extensions::ExtensionPrefs::Get(profile_), extension->id(), false); | 122 extensions::ExtensionPrefs::Get(profile_), extension->id(), false); |
| 122 break; | 123 break; |
| 123 } | 124 } |
| 124 case UNINSTALL: { | 125 case UNINSTALL: { |
| 125 AddRef(); // Balanced in Accepted() and Canceled() | 126 AddRef(); // Balanced in Accepted() and Canceled() |
| 126 extension_uninstall_dialog_.reset( | 127 extension_uninstall_dialog_.reset( |
| 127 extensions::ExtensionUninstallDialog::Create( | 128 extensions::ExtensionUninstallDialog::Create( |
| 128 profile_, browser_, this)); | 129 profile_, chrome::FindWindowForBrowser(browser_), this)); |
| 129 extension_uninstall_dialog_->ConfirmUninstall(extension); | 130 extension_uninstall_dialog_->ConfirmUninstall(extension); |
| 130 break; | 131 break; |
| 131 } | 132 } |
| 132 case MANAGE: { | 133 case MANAGE: { |
| 133 chrome::ShowExtensions(browser_, extension->id()); | 134 chrome::ShowExtensions(browser_, extension->id()); |
| 134 break; | 135 break; |
| 135 } | 136 } |
| 136 case INSPECT_POPUP: { | 137 case INSPECT_POPUP: { |
| 137 delegate_->InspectPopup(extension_action_); | 138 delegate_->InspectPopup(extension_action_); |
| 138 break; | 139 break; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); | 181 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); |
| 181 AddSeparator(ui::NORMAL_SEPARATOR); | 182 AddSeparator(ui::NORMAL_SEPARATOR); |
| 182 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSION); | 183 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSION); |
| 183 } | 184 } |
| 184 | 185 |
| 185 const Extension* ExtensionContextMenuModel::GetExtension() const { | 186 const Extension* ExtensionContextMenuModel::GetExtension() const { |
| 186 ExtensionService* extension_service = | 187 ExtensionService* extension_service = |
| 187 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 188 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 188 return extension_service->GetExtensionById(extension_id_, false); | 189 return extension_service->GetExtensionById(extension_id_, false); |
| 189 } | 190 } |
| OLD | NEW |