summaryrefslogtreecommitdiffstats
path: root/chrome/views
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/views
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/views')
-rw-r--r--chrome/views/controls/button/custom_button.cc5
-rw-r--r--chrome/views/controls/button/custom_button.h11
2 files changed, 14 insertions, 2 deletions
diff --git a/chrome/views/controls/button/custom_button.cc b/chrome/views/controls/button/custom_button.cc
index a01c0ab..4193918 100644
--- a/chrome/views/controls/button/custom_button.cc
+++ b/chrome/views/controls/button/custom_button.cc
@@ -82,13 +82,14 @@ bool CustomButton::IsFocusable() const {
CustomButton::CustomButton(ButtonListener* listener)
: Button(listener),
state_(BS_NORMAL),
- animate_on_state_change_(true) {
+ animate_on_state_change_(true),
+ triggerable_event_flags_(MouseEvent::EF_LEFT_BUTTON_DOWN) {
hover_animation_.reset(new ThrobAnimation(this));
hover_animation_->SetSlideDuration(kHoverFadeDurationMs);
}
bool CustomButton::IsTriggerableEvent(const MouseEvent& e) {
- return e.IsLeftMouseButton();
+ return (triggerable_event_flags_ & e.GetFlags()) != 0;
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/views/controls/button/custom_button.h b/chrome/views/controls/button/custom_button.h
index cb4db5d..db0bc9e 100644
--- a/chrome/views/controls/button/custom_button.h
+++ b/chrome/views/controls/button/custom_button.h
@@ -43,6 +43,14 @@ class CustomButton : public Button,
virtual bool IsEnabled() const;
virtual bool IsFocusable() const;
+ void set_triggerable_event_flags(int triggerable_event_flags) {
+ triggerable_event_flags_ = triggerable_event_flags;
+ }
+
+ int triggerable_event_flags() const {
+ return triggerable_event_flags_;
+ }
+
protected:
// Construct the Button with a Listener. See comment for Button's ctor.
explicit CustomButton(ButtonListener* listener);
@@ -86,6 +94,9 @@ class CustomButton : public Button,
// throbbing.
bool animate_on_state_change_;
+ // Mouse event flags which can trigger button actions.
+ int triggerable_event_flags_;
+
DISALLOW_COPY_AND_ASSIGN(CustomButton);
};