Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(961)

Side by Side Diff: chrome/browser/extensions/extension_context_menu_model.cc

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: replace missing extension_system include Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_action.h" 8 #include "chrome/browser/extensions/extension_action.h"
9 #include "chrome/browser/extensions/extension_action_manager.h" 9 #include "chrome/browser/extensions/extension_action_manager.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 false); 106 false);
107 browser_->OpenURL(params); 107 browser_->OpenURL(params);
108 break; 108 break;
109 } 109 }
110 case CONFIGURE: 110 case CONFIGURE:
111 DCHECK(!extension->options_url().is_empty()); 111 DCHECK(!extension->options_url().is_empty());
112 extensions::ExtensionSystem::Get(profile_)->process_manager()-> 112 extensions::ExtensionSystem::Get(profile_)->process_manager()->
113 OpenOptionsPage(extension, browser_); 113 OpenOptionsPage(extension, browser_);
114 break; 114 break;
115 case HIDE: { 115 case HIDE: {
116 ExtensionService* extension_service = profile_->GetExtensionService(); 116 ExtensionService* extension_service =
117 extensions::ExtensionSystem::Get(profile_)->extension_service();
117 extension_service->extension_prefs()-> 118 extension_service->extension_prefs()->
118 SetBrowserActionVisibility(extension, false); 119 SetBrowserActionVisibility(extension, false);
119 break; 120 break;
120 } 121 }
121 case UNINSTALL: { 122 case UNINSTALL: {
122 AddRef(); // Balanced in Accepted() and Canceled() 123 AddRef(); // Balanced in Accepted() and Canceled()
123 extension_uninstall_dialog_.reset( 124 extension_uninstall_dialog_.reset(
124 ExtensionUninstallDialog::Create(browser_, this)); 125 ExtensionUninstallDialog::Create(browser_, this));
125 extension_uninstall_dialog_->ConfirmUninstall(extension); 126 extension_uninstall_dialog_->ConfirmUninstall(extension);
126 break; 127 break;
127 } 128 }
128 case MANAGE: { 129 case MANAGE: {
129 chrome::ShowExtensions(browser_); 130 chrome::ShowExtensions(browser_);
130 break; 131 break;
131 } 132 }
132 case INSPECT_POPUP: { 133 case INSPECT_POPUP: {
133 delegate_->InspectPopup(extension_action_); 134 delegate_->InspectPopup(extension_action_);
134 break; 135 break;
135 } 136 }
136 default: 137 default:
137 NOTREACHED() << "Unknown option"; 138 NOTREACHED() << "Unknown option";
138 break; 139 break;
139 } 140 }
140 } 141 }
141 142
142 void ExtensionContextMenuModel::ExtensionUninstallAccepted() { 143 void ExtensionContextMenuModel::ExtensionUninstallAccepted() {
143 if (GetExtension()) 144 if (GetExtension()) {
144 profile_->GetExtensionService()->UninstallExtension(extension_id_, false, 145 extensions::ExtensionSystem::Get(profile_)->extension_service()->
145 NULL); 146 UninstallExtension(extension_id_, false, NULL);
146 147 }
147 Release(); 148 Release();
148 } 149 }
149 150
150 void ExtensionContextMenuModel::ExtensionUninstallCanceled() { 151 void ExtensionContextMenuModel::ExtensionUninstallCanceled() {
151 Release(); 152 Release();
152 } 153 }
153 154
154 ExtensionContextMenuModel::~ExtensionContextMenuModel() {} 155 ExtensionContextMenuModel::~ExtensionContextMenuModel() {}
155 156
156 void ExtensionContextMenuModel::InitMenu(const Extension* extension) { 157 void ExtensionContextMenuModel::InitMenu(const Extension* extension) {
(...skipping 14 matching lines...) Expand all
171 AddSeparator(ui::NORMAL_SEPARATOR); 172 AddSeparator(ui::NORMAL_SEPARATOR);
172 AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS_MENU_ITEM); 173 AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS_MENU_ITEM);
173 AddItem(UNINSTALL, l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); 174 AddItem(UNINSTALL, l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL));
174 if (extension_action_manager->GetBrowserAction(*extension)) 175 if (extension_action_manager->GetBrowserAction(*extension))
175 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON); 176 AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON);
176 AddSeparator(ui::NORMAL_SEPARATOR); 177 AddSeparator(ui::NORMAL_SEPARATOR);
177 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSIONS); 178 AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSIONS);
178 } 179 }
179 180
180 const Extension* ExtensionContextMenuModel::GetExtension() const { 181 const Extension* ExtensionContextMenuModel::GetExtension() const {
181 ExtensionService* extension_service = profile_->GetExtensionService(); 182 ExtensionService* extension_service =
183 extensions::ExtensionSystem::Get(profile_)->extension_service();
182 return extension_service->GetExtensionById(extension_id_, false); 184 return extension_service->GetExtensionById(extension_id_, false);
183 } 185 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/browser/extensions/extension_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698