summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 02:48:47 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 02:48:47 +0000
commit6bc82df2292c668b40dff3ba260c90f263a5bf5d (patch)
tree25b53fb6f75a101d0fe1ea96e4c94d3937ff925a /chrome/browser
parentd27c133619e31d7e237a7e799ae3a00a03652285 (diff)
downloadchromium_src-6bc82df2292c668b40dff3ba260c90f263a5bf5d.zip
chromium_src-6bc82df2292c668b40dff3ba260c90f263a5bf5d.tar.gz
chromium_src-6bc82df2292c668b40dff3ba260c90f263a5bf5d.tar.bz2
Merge 32980 - o Updates the browser action buttons when a tab is changed. This is needed for tabspecific 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 TBR=andybons@chromium.org Review URL: http://codereview.chromium.org/448004 git-svn-id: svn://svn.chromium.org/chrome/branches/249/src@33262 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/cocoa/extensions/browser_actions_controller.h3
-rw-r--r--chrome/browser/cocoa/extensions/browser_actions_controller.mm11
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm4
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 6617c87..5ab614a 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -300,6 +300,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 {