summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/extensions
diff options
context:
space:
mode:
authorandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 21:51:35 +0000
committerandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-21 21:51:35 +0000
commit56ff319f5dc3d6452e0b105c97016482aa56af02 (patch)
treeaa071f131b3fe4e2126eaa2eb51ee15ffd5fcc25 /chrome/browser/cocoa/extensions
parent1a68caf4706eb060eeb4710fb15dce698f220610 (diff)
downloadchromium_src-56ff319f5dc3d6452e0b105c97016482aa56af02.zip
chromium_src-56ff319f5dc3d6452e0b105c97016482aa56af02.tar.gz
chromium_src-56ff319f5dc3d6452e0b105c97016482aa56af02.tar.bz2
[Mac] Hide browser action buttons when they would otherwise overflow with the omnibar.
TEST=none BUG=29838 Review URL: http://codereview.chromium.org/553038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36789 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/extensions')
-rw-r--r--chrome/browser/cocoa/extensions/browser_actions_controller.h6
-rw-r--r--chrome/browser/cocoa/extensions/browser_actions_controller.mm9
2 files changed, 14 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.h b/chrome/browser/cocoa/extensions/browser_actions_controller.h
index 22d363a..97d5130 100644
--- a/chrome/browser/cocoa/extensions/browser_actions_controller.h
+++ b/chrome/browser/cocoa/extensions/browser_actions_controller.h
@@ -67,9 +67,13 @@ extern NSString* const kBrowserActionsChangedNotification;
// notification bridge.
- (void)browserActionVisibilityHasChanged;
+// Returns the current number of browser action buttons within the container,
+// whether or not they are displayed.
+- (int)buttonCount;
+
// Returns the current number of browser action buttons displayed in the
// container.
-- (int)buttonCount;
+- (int)visibleButtonCount;
// Executes the action designated by the extension.
- (void)browserActionClicked:(BrowserActionButton*)sender;
diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/cocoa/extensions/browser_actions_controller.mm
index 26a7ca6..fda32b6 100644
--- a/chrome/browser/cocoa/extensions/browser_actions_controller.mm
+++ b/chrome/browser/cocoa/extensions/browser_actions_controller.mm
@@ -210,6 +210,15 @@ class ExtensionsServiceObserverBridge : public NotificationObserver {
return [buttons_ count];
}
+- (int)visibleButtonCount {
+ int count = 0;
+ for (BrowserActionButton* button in [buttons_ allValues]) {
+ if (![button isHidden])
+ ++count;
+ }
+ return count;
+}
+
- (void)browserActionClicked:(BrowserActionButton*)sender {
ExtensionAction* action = [sender extension]->browser_action();
if (action->has_popup() && !popupController_) {