summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/toolbar_view.cc
diff options
context:
space:
mode:
authoridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 23:27:29 +0000
committeridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 23:27:29 +0000
commit485fba4e0ffed47471580592533ea060239a7f7b (patch)
tree170aabf3134295001a605c17ad192be8dd72a079 /chrome/browser/views/toolbar_view.cc
parent53703f7d80d3a691af68bcfd7f83f59b965fb642 (diff)
downloadchromium_src-485fba4e0ffed47471580592533ea060239a7f7b.zip
chromium_src-485fba4e0ffed47471580592533ea060239a7f7b.tar.gz
chromium_src-485fba4e0ffed47471580592533ea060239a7f7b.tar.bz2
Redone http://codereview.chromium.org/42571
Issue 6477: Support modifier clicks on UI elements Mouse event flags transformed to WindoOpenDisposition so that browser commands can all inteterpert event modifiers. Implemented home, forward and backwards middle-click andshift middle click. Previously working on issue 358 which was market a duplicate and concerned with the home and tabstrip subset of this behavior: Can't open a new tab by middle-clicking home button. No functionality has been lost or altered, only the use ofmodifiers give access to increased functionality. BUG=6477 TBR=maruel Review URL: http://codereview.chromium.org/53020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12403 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/toolbar_view.cc')
-rw-r--r--chrome/browser/views/toolbar_view.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index 5695eac..78a8ae6 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/user_data_manager.h"
#include "chrome/browser/views/bookmark_menu_button.h"
#include "chrome/browser/views/dom_view.h"
+#include "chrome/browser/views/event_utils.h"
#include "chrome/browser/views/go_button.h"
#include "chrome/browser/views/location_bar_view.h"
#include "chrome/browser/views/theme_helpers.h"
@@ -133,6 +134,8 @@ void BrowserToolbarView::CreateLeftSideControls() {
ResourceBundle &rb = ResourceBundle::GetSharedInstance();
back_ = new views::ButtonDropDown(this, back_menu_model_.get());
+ back_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
+ views::Event::EF_MIDDLE_BUTTON_DOWN);
back_->set_tag(IDC_BACK);
back_->SetImageAlignment(views::ImageButton::ALIGN_RIGHT,
views::ImageButton::ALIGN_TOP);
@@ -148,6 +151,8 @@ void BrowserToolbarView::CreateLeftSideControls() {
AddChildView(back_);
forward_ = new views::ButtonDropDown(this, forward_menu_model_.get());
+ forward_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
+ views::Event::EF_MIDDLE_BUTTON_DOWN);
forward_->set_tag(IDC_FORWARD);
forward_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_FORWARD));
@@ -176,6 +181,8 @@ void BrowserToolbarView::CreateLeftSideControls() {
AddChildView(reload_);
home_ = new views::ImageButton(this);
+ home_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
+ views::Event::EF_MIDDLE_BUTTON_DOWN);
home_->set_tag(IDC_HOME);
home_->SetImage(views::CustomButton::BS_NORMAL, rb.GetBitmapNamed(IDR_HOME));
home_->SetImage(views::CustomButton::BS_HOT, rb.GetBitmapNamed(IDR_HOME_H));
@@ -218,7 +225,7 @@ void BrowserToolbarView::CreateCenterStack(Profile *profile) {
location_bar_->Init();
// The Go button.
- go_ = new GoButton(location_bar_, browser_->command_updater());
+ go_ = new GoButton(location_bar_, browser_);
go_->SetImage(views::CustomButton::BS_NORMAL, rb.GetBitmapNamed(IDR_GO));
go_->SetImage(views::CustomButton::BS_HOT, rb.GetBitmapNamed(IDR_GO_H));
go_->SetImage(views::CustomButton::BS_PUSHED, rb.GetBitmapNamed(IDR_GO_P));
@@ -832,7 +839,9 @@ void BrowserToolbarView::EnabledStateChangedForCommand(int id, bool enabled) {
}
void BrowserToolbarView::ButtonPressed(views::Button* sender) {
- browser_->ExecuteCommand(sender->tag());
+ browser_->ExecuteCommandWithDisposition(
+ sender->tag(),
+ event_utils::DispositionFromEventFlags(sender->mouse_event_flags()));
}
// static