Index: chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc |
diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc |
index f6ccf1bdac6306cd94d8b2bf617824c2c7bf642c..787887da308801aab5061aa506f089a4beeeaa70 100644 |
--- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc |
+++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc |
@@ -34,7 +34,7 @@ |
#include "chrome/browser/ui/tab_contents/tab_contents.h" |
#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/extensions/extension.h" |
-#include "chrome/common/extensions/extension_action.h" |
+#include "chrome/browser/extensions/extension_action.h" |
#include "chrome/common/extensions/extension_manifest_constants.h" |
#include "chrome/common/extensions/extension_resource.h" |
#include "content/public/browser/notification_details.h" |
@@ -117,11 +117,11 @@ class BrowserActionButton : public content::NotificationObserver, |
gtk_container_add(GTK_CONTAINER(alignment_.get()), button()); |
gtk_widget_show(button()); |
- DCHECK(extension_->browser_action()); |
+ DCHECK(browser_action()); |
// The Browser Action API does not allow the default icon path to be |
// changed at runtime, so we can load this now and cache it. |
- std::string path = extension_->browser_action()->default_icon_path(); |
+ std::string path = browser_action()->default_icon_path(); |
if (!path.empty()) { |
tracker_.LoadImage(extension_, extension_->GetResource(path), |
gfx::Size(Extension::kBrowserActionIconMaxSize, |
@@ -152,7 +152,7 @@ class BrowserActionButton : public content::NotificationObserver, |
registrar_.Add( |
this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, |
- content::Source<ExtensionAction>(extension->browser_action())); |
+ content::Source<ExtensionAction>(browser_action())); |
registrar_.Add( |
this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
content::Source<Profile>( |
@@ -222,8 +222,7 @@ class BrowserActionButton : public content::NotificationObserver, |
void OnImageLoaded(const gfx::Image& image, |
const std::string& extension_id, |
int index) OVERRIDE { |
- extension_->browser_action()->CacheIcon( |
- extension_->browser_action()->default_icon_path(), image); |
+ browser_action()->CacheIcon(browser_action()->default_icon_path(), image); |
UpdateState(); |
} |
@@ -234,23 +233,23 @@ class BrowserActionButton : public content::NotificationObserver, |
if (tab_id < 0) |
return; |
- std::string tooltip = extension_->browser_action()->GetTitle(tab_id); |
+ std::string tooltip = browser_action()->GetTitle(tab_id); |
if (tooltip.empty()) |
gtk_widget_set_has_tooltip(button(), FALSE); |
else |
gtk_widget_set_tooltip_text(button(), tooltip.c_str()); |
- gfx::Image image = extension_->browser_action()->GetIcon(tab_id); |
+ gfx::Image image = browser_action()->GetIcon(tab_id); |
if (!image.IsEmpty()) |
SetImage(image.ToGdkPixbuf()); |
- bool enabled = extension_->browser_action()->GetIsVisible(tab_id); |
+ bool enabled = browser_action()->GetIsVisible(tab_id); |
gtk_widget_set_sensitive(button(), enabled); |
gtk_widget_queue_draw(button()); |
} |
gfx::Image GetIcon() { |
- return extension_->browser_action()->GetIcon( |
+ return browser_action()->GetIcon( |
toolbar_->GetCurrentTabId()); |
} |
@@ -343,7 +342,7 @@ class BrowserActionButton : public content::NotificationObserver, |
if (tab_id < 0) |
return FALSE; |
- ExtensionAction* action = button->extension_->browser_action(); |
+ ExtensionAction* action = button->browser_action(); |
if (action->GetBadgeText(tab_id).empty()) |
return FALSE; |
@@ -444,6 +443,10 @@ class BrowserActionButton : public content::NotificationObserver, |
} |
} |
+ ExtensionAction* browser_action() { |
+ return GetBrowserAction(toolbar_->browser()->profile(), *extension_); |
+ } |
+ |
// The toolbar containing this button. |
BrowserActionsToolbarGtk* toolbar_; |
@@ -799,7 +802,8 @@ bool BrowserActionsToolbarGtk::IsCommandIdChecked(int command_id) const { |
bool BrowserActionsToolbarGtk::IsCommandIdEnabled(int command_id) const { |
const Extension* extension = model_->toolbar_items()[command_id]; |
- return extension->browser_action()->GetIsVisible(GetCurrentTabId()); |
+ return GetBrowserAction(profile_, *extension)-> |
+ GetIsVisible(GetCurrentTabId()); |
} |
bool BrowserActionsToolbarGtk::GetAcceleratorForCommandId( |