Index: chrome/browser/cocoa/extensions/browser_actions_controller.mm |
diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/cocoa/extensions/browser_actions_controller.mm |
index cc73d61923869502655760af0efb23598f2a3804..c3cd111f817fb70eb2ff4c0dc39b63330bb9ce7a 100644 |
--- a/chrome/browser/cocoa/extensions/browser_actions_controller.mm |
+++ b/chrome/browser/cocoa/extensions/browser_actions_controller.mm |
@@ -30,6 +30,7 @@ NSString* const kBrowserActionsChangedNotification = @"BrowserActionsChanged"; |
- (void)removeActionButtonForExtension:(Extension*)extension; |
- (void)repositionActionButtons; |
- (int)currentTabId; |
+- (bool)shouldDisplayBrowserAction:(Extension*)extension; |
@end |
// A helper class to proxy extension notifications to the view controller's |
@@ -139,6 +140,9 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, |
if (!extension->browser_action()) |
return; |
+ if (![self shouldDisplayBrowserAction:extension]) |
+ return; |
+ |
// Show the container if it's the first button. Otherwise it will be shown |
// already. |
if ([buttons_ count] == 0) |
@@ -266,4 +270,10 @@ class ExtensionsServiceObserverBridge : public NotificationObserver, |
return [buttonOrder_ objectAtIndex:(NSUInteger)index]; |
} |
+- (bool)shouldDisplayBrowserAction:(Extension*)extension { |
+ return (!profile_->IsOffTheRecord() || |
+ profile_->GetExtensionsService()-> |
+ IsIncognitoEnabled(extension->id())); |
+} |
+ |
@end |