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

Unified Diff: chrome/browser/cocoa/extensions/extension_action_context_menu.mm

Issue 595017: [Mac] Use the ExtensionToolbarModel for ordering of the Browser Actions. Prep... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove redundant profile object. Created 10 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/extensions/extension_action_context_menu.mm
===================================================================
--- chrome/browser/cocoa/extensions/extension_action_context_menu.mm (revision 38554)
+++ chrome/browser/cocoa/extensions/extension_action_context_menu.mm (working copy)
@@ -105,9 +105,10 @@
};
} // namespace
-- (id)initWithExtension:(Extension*)extension {
+- (id)initWithExtension:(Extension*)extension profile:(Profile*)profile {
if ((self = [super initWithTitle:@""])) {
extension_ = extension;
+ profile_ = profile;
NSArray* menuItems = [NSArray arrayWithObjects:
base::SysUTF8ToNSString(extension->name()),
@@ -148,13 +149,10 @@
}
- (void)dispatch:(id)menuItem {
- Browser* browser = BrowserList::GetLastActive();
- // GetLastActive() returns NULL during testing.
+ Browser* browser = BrowserList::FindBrowserWithProfile(profile_);
if (!browser)
return;
- Profile* profile = browser->profile();
-
NSMenuItem* item = (NSMenuItem*)menuItem;
switch ([item tag]) {
case kExtensionContextName: {
@@ -170,8 +168,10 @@
break;
}
case kExtensionContextDisable: {
- ExtensionsService* extension_service = profile->GetExtensionsService();
- extension_service->DisableExtension(extension_->id());
+ ExtensionsService* extensionService = profile_->GetExtensionsService();
+ if (!extensionService)
+ return; // Incognito mode.
+ extensionService->DisableExtension(extension_->id());
break;
}
case kExtensionContextUninstall: {

Powered by Google App Engine
This is Rietveld 408576698