Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Unified Diff: chrome/browser/views/toolbar_view.cc

Issue 243001: Implement Browser Actions extensions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/toolbar_view.cc
===================================================================
--- chrome/browser/views/toolbar_view.cc (revision 27027)
+++ chrome/browser/views/toolbar_view.cc (working copy)
@@ -30,6 +30,7 @@
#include "chrome/browser/browser_theme_provider.h"
#include "chrome/browser/user_data_manager.h"
#include "chrome/browser/views/bookmark_menu_button.h"
+#include "chrome/browser/views/browser_actions_container.h"
#include "chrome/browser/views/event_utils.h"
#include "chrome/browser/views/go_button.h"
#include "chrome/browser/views/location_bar_view.h"
@@ -153,6 +154,7 @@
star_(NULL),
location_bar_(NULL),
go_(NULL),
+ browser_actions_(NULL),
page_menu_(NULL),
app_menu_(NULL),
bookmark_menu_(NULL),
@@ -513,14 +515,15 @@
child_y, star_->GetPreferredSize().width(), child_height);
int go_button_width = go_->GetPreferredSize().width();
+ int browser_actions_width = browser_actions_->GetPreferredSize().width();
int page_menu_width = page_menu_->GetPreferredSize().width();
int app_menu_width = app_menu_->GetPreferredSize().width();
int bookmark_menu_width = bookmark_menu_ ?
bookmark_menu_->GetPreferredSize().width() : 0;
int location_x = star_->x() + star_->width();
int available_width = width() - kPaddingRight - bookmark_menu_width -
- app_menu_width - page_menu_width - kMenuButtonOffset - go_button_width -
- location_x;
+ app_menu_width - page_menu_width - browser_actions_width -
+ kMenuButtonOffset - go_button_width - location_x;
location_bar_->SetBounds(location_x, child_y, std::max(available_width, 0),
child_height);
@@ -535,6 +538,10 @@
next_menu_x += bookmark_menu_width;
}
+ browser_actions_->SetBounds(
+ next_menu_x, child_y, browser_actions_width, child_height);
+ next_menu_x += browser_actions_width;
+
page_menu_->SetBounds(next_menu_x, child_y, page_menu_width, child_height);
next_menu_x += page_menu_width;
@@ -855,12 +862,13 @@
}
void ToolbarView::CreateRightSideControls(Profile* profile) {
+ browser_actions_ = new BrowserActionsContainer(profile, this);
+
page_menu_ = new views::MenuButton(NULL, std::wstring(), this, false);
page_menu_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_PAGE));
page_menu_->SetTooltipText(l10n_util::GetString(IDS_PAGEMENU_TOOLTIP));
page_menu_->SetID(VIEW_ID_PAGE_MENU);
-
app_menu_ = new views::MenuButton(NULL, std::wstring(), this, false);
app_menu_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_APP));
app_menu_->SetTooltipText(l10n_util::GetStringF(IDS_APPMENU_TOOLTIP,
@@ -876,6 +884,7 @@
LoadRightSideControlsImages();
+ AddChildView(browser_actions_);
AddChildView(page_menu_);
AddChildView(app_menu_);
}

Powered by Google App Engine
This is Rietveld 408576698