diff options
author | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-24 22:14:51 +0000 |
---|---|---|
committer | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-24 22:14:51 +0000 |
commit | b2667ea3baad8c791bf8692845f45346bdc9f7c7 (patch) | |
tree | d6d44c911f1053d3092d73b6102a5e35380d01b1 /chrome/browser | |
parent | 0faf2aa8df6e27a0ae8b720440df9907c52fdf31 (diff) | |
download | chromium_src-b2667ea3baad8c791bf8692845f45346bdc9f7c7.zip chromium_src-b2667ea3baad8c791bf8692845f45346bdc9f7c7.tar.gz chromium_src-b2667ea3baad8c791bf8692845f45346bdc9f7c7.tar.bz2 |
o Updates the browser action buttons when a tab is changed. This is needed for tab-specific browser action buttons.
o If a tooltip is not present on a browser action button, clear the tooltip of the button.
BUG=28719
TEST=Load chrome/test/data/extensions/api_test/browser_tab_specific_state, play around with it in different tabs and make sure that the state remains the same per tab.
Review URL: http://codereview.chromium.org/434047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32980 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/cocoa/extensions/browser_actions_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/extensions/browser_actions_controller.mm | 11 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.mm | 4 |
3 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.h b/chrome/browser/cocoa/extensions/browser_actions_controller.h index 08734bb..cbdc28f 100644 --- a/chrome/browser/cocoa/extensions/browser_actions_controller.h +++ b/chrome/browser/cocoa/extensions/browser_actions_controller.h @@ -57,6 +57,9 @@ extern NSString* const kBrowserActionsChangedNotification; // extensions service to the toolbar. - (void)createButtons; +// Update the display of all buttons. +- (void)update; + // Hides the browser action's popup menu (if one is present and visible). - (void)hidePopup; diff --git a/chrome/browser/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/cocoa/extensions/browser_actions_controller.mm index 5414c27..6dacbe0 100644 --- a/chrome/browser/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/cocoa/extensions/browser_actions_controller.mm @@ -214,8 +214,11 @@ class ExtensionImageTrackerBridge : public NotificationObserver, return; std::string tooltip = extension_->browser_action()->GetTitle(tabId); - if (!tooltip.empty()) + if (tooltip.empty()) { + [self setToolTip:nil]; + } else { [self setToolTip:base::SysUTF8ToNSString(tooltip)]; + } SkBitmap image = extension_->browser_action()->GetIcon(tabId); if (!image.isNull()) { @@ -318,6 +321,12 @@ class ExtensionsServiceObserverBridge : public NotificationObserver { return self; } +- (void)update { + for (BrowserActionButton* button in [buttons_ allValues]) { + [button updateState]; + } +} + - (void)hidePopup { [popupController_ close]; popupController_ = nil; diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index 97f693b..3b89ddc 100644 --- a/chrome/browser/cocoa/toolbar_controller.mm +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -304,6 +304,10 @@ class PrefObserverBridge : public NotificationObserver { - (void)updateToolbarWithContents:(TabContents*)tab shouldRestoreState:(BOOL)shouldRestore { locationBarView_->Update(tab, shouldRestore ? true : false); + + if (browserActionsController_.get()) { + [browserActionsController_ update]; + } } - (void)setStarredState:(BOOL)isStarred { |