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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: response to sky Created 8 years, 1 month 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 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h"
6 6
7 #include "base/prefs/public/pref_change_registrar.h" 7 #include "base/prefs/public/pref_change_registrar.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/extensions/extension_action.h" 9 #include "chrome/browser/extensions/extension_action.h"
10 #include "chrome/browser/extensions/extension_action_manager.h" 10 #include "chrome/browser/extensions/extension_action_manager.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 profile_(browser->profile()) { 55 profile_(browser->profile()) {
56 extension_uninstall_dialog_.reset( 56 extension_uninstall_dialog_.reset(
57 ExtensionUninstallDialog::Create(browser, this)); 57 ExtensionUninstallDialog::Create(browser, this));
58 extension_uninstall_dialog_->ConfirmUninstall(extension_); 58 extension_uninstall_dialog_->ConfirmUninstall(extension_);
59 } 59 }
60 60
61 ~AsyncUninstaller() {} 61 ~AsyncUninstaller() {}
62 62
63 // ExtensionUninstallDialog::Delegate: 63 // ExtensionUninstallDialog::Delegate:
64 virtual void ExtensionUninstallAccepted() { 64 virtual void ExtensionUninstallAccepted() {
65 profile_->GetExtensionService()-> 65 extensions::ExtensionSystem::Get(profile_)->extension_service()->
66 UninstallExtension(extension_->id(), false, NULL); 66 UninstallExtension(extension_->id(), false, NULL);
67 } 67 }
68 virtual void ExtensionUninstallCanceled() {} 68 virtual void ExtensionUninstallCanceled() {}
69 69
70 private: 70 private:
71 // The extension that we're loading the icon for. Weak. 71 // The extension that we're loading the icon for. Weak.
72 const Extension* extension_; 72 const Extension* extension_;
73 73
74 // The current profile. Weak. 74 // The current profile. Weak.
75 Profile* profile_; 75 Profile* profile_;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 DCHECK(!extension_->options_url().is_empty()); 162 DCHECK(!extension_->options_url().is_empty());
163 extensions::ExtensionSystem::Get(browser_->profile())->process_manager()-> 163 extensions::ExtensionSystem::Get(browser_->profile())->process_manager()->
164 OpenOptionsPage(extension_, browser_); 164 OpenOptionsPage(extension_, browser_);
165 break; 165 break;
166 } 166 }
167 case kExtensionContextUninstall: { 167 case kExtensionContextUninstall: {
168 uninstaller_.reset(new AsyncUninstaller(extension_, browser_)); 168 uninstaller_.reset(new AsyncUninstaller(extension_, browser_));
169 break; 169 break;
170 } 170 }
171 case kExtensionContextHide: { 171 case kExtensionContextHide: {
172 ExtensionService* extension_service = 172 ExtensionService* extension_service = extensions::ExtensionSystem::Get(
173 browser_->profile()->GetExtensionService(); 173 browser_->profile())->extension_service();
174 extension_service->extension_prefs()-> 174 extension_service->extension_prefs()->
175 SetBrowserActionVisibility(extension_, false); 175 SetBrowserActionVisibility(extension_, false);
176 break; 176 break;
177 } 177 }
178 case kExtensionContextManage: { 178 case kExtensionContextManage: {
179 chrome::ShowExtensions(browser_); 179 chrome::ShowExtensions(browser_);
180 break; 180 break;
181 } 181 }
182 default: 182 default:
183 NOTREACHED(); 183 NOTREACHED();
184 break; 184 break;
185 } 185 }
186 } 186 }
187 187
188 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { 188 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem {
189 if ([menuItem tag] == kExtensionContextOptions) { 189 if ([menuItem tag] == kExtensionContextOptions) {
190 // Disable 'Options' if there are no options to set. 190 // Disable 'Options' if there are no options to set.
191 return extension_->options_url().spec().length() > 0; 191 return extension_->options_url().spec().length() > 0;
192 } 192 }
193 return YES; 193 return YES;
194 } 194 }
195 195
196 @end 196 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698