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

Unified Diff: chrome/browser/ui/views/location_bar/action_box_button_view.cc

Issue 10533086: Action box menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Action box menu Created 8 years, 5 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/ui/views/location_bar/action_box_button_view.cc
diff --git a/chrome/browser/ui/views/location_bar/action_box_button_view.cc b/chrome/browser/ui/views/location_bar/action_box_button_view.cc
index b53bd1597e75e9e1fbb04ca9cbfb7a887468e89c..1778b32ac1484b397bfd6c2b98f4d6a57116a626 100644
--- a/chrome/browser/ui/views/location_bar/action_box_button_view.cc
+++ b/chrome/browser/ui/views/location_bar/action_box_button_view.cc
@@ -8,7 +8,12 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/toolbar/action_box_menu_model.h"
#include "chrome/browser/ui/view_ids.h"
+#include "chrome/browser/ui/views/action_box_menu.h"
#include "chrome/browser/ui/views/browser_dialogs.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -30,9 +35,12 @@ const SkColor kPushedBorderColor = SkColorSetRGB(191, 191, 191);
} // namespace
-ActionBoxButtonView::ActionBoxButtonView(ExtensionService* extension_service)
+ActionBoxButtonView::ActionBoxButtonView(Profile* profile,
+ Delegate* delegate)
: views::MenuButton(NULL, string16(), this, false),
- extension_service_(extension_service) {
+ profile_(profile),
+ delegate_(delegate),
+ bookmark_state_(false) {
set_id(VIEW_ID_ACTION_BOX_BUTTON);
SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_ACTION_BOX_BUTTON));
SetIcon(*ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(
@@ -73,5 +81,18 @@ void ActionBoxButtonView::GetAccessibleState(ui::AccessibleViewState* state) {
void ActionBoxButtonView::OnMenuButtonClicked(View* source,
const gfx::Point& point) {
- // TODO(yefim): Implement menu here.
+ ExtensionService* extension_service =
+ extensions::ExtensionSystem::Get(profile_)->extension_service();
+ if (!extension_service)
+ return;
+
+ Browser* browser = delegate_->GetBrowser();
+ if (!browser)
+ return;
+
+ ActionBoxMenuModel model(extension_service);
+ action_box_menu_.reset(new ActionBoxMenu(browser, &model, bookmark_state_));
beaudoin 2012/07/19 15:33:50 You're passing a pointer to a short-lived object i
yefimt 2012/07/19 20:00:15 Menu gets destroyed before model, but it bring a g
+ action_box_menu_->Init();
+ action_box_menu_->RunMenu(this);
+ action_box_menu_.reset();
}

Powered by Google App Engine
This is Rietveld 408576698