Index: chrome/browser/ui/views/browser_actions_container.cc |
diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc |
index eab721e90e9d2e8a4b78b715fde6be620026db65..e8f813b4398e86bdeb5f0d2ef28da9f227c4ca0c 100644 |
--- a/chrome/browser/ui/views/browser_actions_container.cc |
+++ b/chrome/browser/ui/views/browser_actions_container.cc |
@@ -127,11 +127,6 @@ void BrowserActionsContainer::Init() { |
SetContainerWidth(); |
} |
-int BrowserActionsContainer::GetCurrentTabId() const { |
- TabContents* tab = chrome::GetActiveTabContents(browser_); |
- return tab ? tab->restore_tab_helper()->session_id().id() : -1; |
-} |
- |
BrowserActionView* BrowserActionsContainer::GetBrowserActionView( |
ExtensionAction* action) { |
for (BrowserActionViews::iterator i(browser_action_views_.begin()); |
@@ -157,7 +152,7 @@ void BrowserActionsContainer::CreateBrowserActionViews() { |
if (!ShouldDisplayBrowserAction(*i)) |
continue; |
- BrowserActionView* view = new BrowserActionView(*i, this); |
+ BrowserActionView* view = new BrowserActionView(*i, browser_, this); |
browser_action_views_.push_back(view); |
AddChildView(view); |
} |
@@ -168,12 +163,6 @@ void BrowserActionsContainer::DeleteBrowserActionViews() { |
STLDeleteElements(&browser_action_views_); |
} |
-void BrowserActionsContainer::OnBrowserActionVisibilityChanged() { |
- SetVisible(!browser_action_views_.empty()); |
- owner_view_->Layout(); |
- owner_view_->SchedulePaint(); |
-} |
- |
size_t BrowserActionsContainer::VisibleBrowserActions() const { |
size_t visible_actions = 0; |
for (size_t i = 0; i < browser_action_views_.size(); ++i) { |
@@ -183,19 +172,6 @@ size_t BrowserActionsContainer::VisibleBrowserActions() const { |
return visible_actions; |
} |
-void BrowserActionsContainer::OnBrowserActionExecuted( |
- BrowserActionButton* button) { |
- const Extension* extension = button->extension(); |
- GURL popup_url; |
- switch (model_->ExecuteBrowserAction(extension, browser_, &popup_url)) { |
- case ExtensionToolbarModel::ACTION_NONE: |
- break; |
- case ExtensionToolbarModel::ACTION_SHOW_POPUP: |
- ShowPopup(button, popup_url); |
- break; |
- } |
-} |
- |
gfx::Size BrowserActionsContainer::GetPreferredSize() { |
if (browser_action_views_.empty()) |
return gfx::Size(ToolbarView::kStandardSpacing, 0); |
@@ -477,6 +453,38 @@ void BrowserActionsContainer::OnWidgetClosing(views::Widget* widget) { |
} |
} |
+Browser* BrowserActionsContainer::GetBrowser() const { |
+ return browser_; |
+} |
+ |
+int BrowserActionsContainer::GetCurrentTabId() const { |
+ TabContents* tab = chrome::GetActiveTabContents(browser_); |
+ return tab ? tab->restore_tab_helper()->session_id().id() : -1; |
+} |
+ |
+void BrowserActionsContainer::OnBrowserActionExecuted( |
+ BrowserActionButton* button) { |
+ const Extension* extension = button->extension(); |
+ GURL popup_url; |
+ switch (model_->ExecuteBrowserAction(extension, browser_, &popup_url)) { |
+ case ExtensionToolbarModel::ACTION_NONE: |
+ break; |
+ case ExtensionToolbarModel::ACTION_SHOW_POPUP: |
+ ShowPopup(button, popup_url); |
+ break; |
+ } |
+} |
+ |
+void BrowserActionsContainer::OnBrowserActionVisibilityChanged() { |
+ SetVisible(!browser_action_views_.empty()); |
+ owner_view_->Layout(); |
+ owner_view_->SchedulePaint(); |
+} |
+ |
+gfx::Size BrowserActionsContainer::GetViewContentOffset() const { |
+ return gfx::Size(0, ToolbarView::kVertSpacing); |
+} |
+ |
void BrowserActionsContainer::MoveBrowserAction(const std::string& extension_id, |
size_t new_index) { |
ExtensionService* service = profile_->GetExtensionService(); |
@@ -593,7 +601,7 @@ void BrowserActionsContainer::BrowserActionAdded(const Extension* extension, |
// Add the new browser action to the vector and the view hierarchy. |
if (profile_->IsOffTheRecord()) |
index = model_->OriginalIndexToIncognito(index); |
- BrowserActionView* view = new BrowserActionView(extension, this); |
+ BrowserActionView* view = new BrowserActionView(extension, browser_, this); |
browser_action_views_.insert(browser_action_views_.begin() + index, view); |
AddChildViewAt(view, index); |