| 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 a17f3d8cde36d18dbab3e47d97209012f9400896..ca4e70e55e051a8be645f60958c960ebe8a5dea8 100644
|
| --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
|
| +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
|
| @@ -18,6 +18,7 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/sessions/session_tab_helper.h"
|
| #include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/ui/browser_list.h"
|
| #include "chrome/browser/ui/browser_window.h"
|
| #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h"
|
| #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h"
|
| @@ -139,6 +140,8 @@ const CGFloat kBrowserActionBubbleYOffset = 3.0;
|
|
|
| // Handles when the given BrowserActionButton object is clicked.
|
| - (void)browserActionClicked:(BrowserActionButton*)button;
|
| +- (void)browserActionClicked:(BrowserActionButton*)button
|
| + andGrant:(BOOL)shouldGrant;
|
|
|
| // Returns whether the given extension should be displayed. Only displays
|
| // incognito-enabled extensions in incognito mode. Otherwise returns YES.
|
| @@ -238,6 +241,22 @@ class ExtensionServiceObserverBridge : public content::NotificationObserver,
|
| [owner_ resizeContainerAndAnimate:NO];
|
| }
|
|
|
| + virtual void BrowserActionShowPopup(const Extension* extension) OVERRIDE {
|
| + // Do not override other popups and only show in active window.
|
| + ExtensionPopupController* popup = [ExtensionPopupController popup];
|
| + if (popup ||
|
| + BrowserList::GetInstance(chrome::GetActiveDesktop())->GetLastActive() !=
|
| + browser_) {
|
| + return;
|
| + }
|
| +
|
| + BrowserActionButton* button = [owner_ buttonForExtension:extension];
|
| + if (button) {
|
| + [owner_ browserActionClicked:button
|
| + andGrant:false];
|
| + }
|
| + }
|
| +
|
| private:
|
| // The object we need to inform when we get a notification. Weak. Owns us.
|
| BrowserActionsController* owner_;
|
| @@ -739,10 +758,12 @@ class ExtensionServiceObserverBridge : public content::NotificationObserver,
|
| }
|
| }
|
|
|
| -- (void)browserActionClicked:(BrowserActionButton*)button {
|
| +- (void)browserActionClicked:(BrowserActionButton*)button
|
| + andGrant:(BOOL)shouldGrant {
|
| const Extension* extension = [button extension];
|
| GURL popupUrl;
|
| - switch (toolbarModel_->ExecuteBrowserAction(extension, browser_, &popupUrl)) {
|
| + switch (toolbarModel_->ExecuteBrowserAction(extension, browser_, &popupUrl,
|
| + shouldGrant)) {
|
| case ExtensionToolbarModel::ACTION_NONE:
|
| break;
|
| case ExtensionToolbarModel::ACTION_SHOW_POPUP: {
|
| @@ -757,6 +778,11 @@ class ExtensionServiceObserverBridge : public content::NotificationObserver,
|
| }
|
| }
|
|
|
| +- (void)browserActionClicked:(BrowserActionButton*)button {
|
| + [self browserActionClicked:button
|
| + andGrant:true];
|
| +}
|
| +
|
| - (BOOL)shouldDisplayBrowserAction:(const Extension*)extension {
|
| // Only display incognito-enabled extensions while in incognito mode.
|
| return
|
|
|