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

Unified Diff: chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm

Issue 161293002: mac: Allows extensions to hide the bookmark page menu item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make sure changes only apply to OSX. Created 6 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/ui/cocoa/extensions/browser_actions_controller.mm
diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
index cd5aa2739d4bbacaa94066e2ede11ab20f4d6c2a..7e53734c90932355bae75ccd053a1c3274450c90 100644
--- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
@@ -212,17 +212,7 @@ class ExtensionServiceObserverBridge : public content::NotificationObserver,
gfx::NativeWindow window = payload->second;
if (window != browser_->window()->GetNativeWindow())
break;
- ExtensionService* service = browser_->profile()->GetExtensionService();
- if (!service)
- break;
- const Extension* extension = service->GetExtensionById(extension_id,
- false);
- if (!extension)
- break;
- BrowserActionButton* button = [owner_ buttonForExtension:extension];
- // |button| can be nil when the browser action has its button hidden.
- if (button)
- [owner_ browserActionClicked:button];
+ [owner_ activateBrowserAction:extension_id];
break;
}
default:
@@ -452,6 +442,21 @@ class ExtensionServiceObserverBridge : public content::NotificationObserver,
return YES;
}
+- (void)activateBrowserAction:(const std::string&)extension_id {
+ ExtensionService* service = browser_->profile()->GetExtensionService();
+ if (!service)
+ return;
+
+ const Extension* extension = service->GetExtensionById(extension_id, false);
+ if (!extension)
+ return;
+
+ BrowserActionButton* button = [self buttonForExtension:extension];
+ // |button| can be nil when the browser action has its button hidden.
+ if (button)
+ [self browserActionClicked:button];
+}
+
#pragma mark -
#pragma mark NSMenuDelegate

Powered by Google App Engine
This is Rietveld 408576698