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

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

Issue 567037: Initial work on making extensions work in incognito mode. (Closed)
Patch Set: added experimental requirement 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
« no previous file with comments | « no previous file | chrome/browser/extensions/browser_action_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | chrome/browser/extensions/browser_action_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698