diff options
author | idanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 19:06:12 +0000 |
---|---|---|
committer | idanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 19:06:12 +0000 |
commit | 28a45c708dd128ee9e61c547f7d10cd55530f374 (patch) | |
tree | 107498b717ba720eca02df2eddfe034055f4469a /chrome/browser/views/toolbar_view.cc | |
parent | 6b01318fe807d9a6dca2a31ce7f0242ef3c93453 (diff) | |
download | chromium_src-28a45c708dd128ee9e61c547f7d10cd55530f374.zip chromium_src-28a45c708dd128ee9e61c547f7d10cd55530f374.tar.gz chromium_src-28a45c708dd128ee9e61c547f7d10cd55530f374.tar.bz2 |
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=ben@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12383 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/toolbar_view.cc')
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 13 |
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 |