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

Side by Side Diff: chrome/views/controls/button/custom_button.cc

Issue 17428: Issue 358: Can't open a new tab by middle-clicking home button... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/views/controls/button/custom_button.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/views/controls/button/custom_button.h" 5 #include "chrome/views/controls/button/custom_button.h"
6 6
7 #include "base/keyboard_codes.h" 7 #include "base/keyboard_codes.h"
8 #include "chrome/common/drag_drop_types.h" 8 #include "chrome/common/drag_drop_types.h"
9 #include "chrome/common/gfx/chrome_canvas.h" 9 #include "chrome/common/gfx/chrome_canvas.h"
10 #include "chrome/common/throb_animation.h" 10 #include "chrome/common/throb_animation.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 bool CustomButton::IsFocusable() const { 75 bool CustomButton::IsFocusable() const {
76 return (state_ != BS_DISABLED) && View::IsFocusable(); 76 return (state_ != BS_DISABLED) && View::IsFocusable();
77 } 77 }
78 78
79 //////////////////////////////////////////////////////////////////////////////// 79 ////////////////////////////////////////////////////////////////////////////////
80 // CustomButton, protected: 80 // CustomButton, protected:
81 81
82 CustomButton::CustomButton(ButtonListener* listener) 82 CustomButton::CustomButton(ButtonListener* listener)
83 : Button(listener), 83 : Button(listener),
84 state_(BS_NORMAL), 84 state_(BS_NORMAL),
85 animate_on_state_change_(true) { 85 animate_on_state_change_(true),
86 triggerable_event_flags_(MouseEvent::EF_LEFT_BUTTON_DOWN) {
86 hover_animation_.reset(new ThrobAnimation(this)); 87 hover_animation_.reset(new ThrobAnimation(this));
87 hover_animation_->SetSlideDuration(kHoverFadeDurationMs); 88 hover_animation_->SetSlideDuration(kHoverFadeDurationMs);
88 } 89 }
89 90
90 bool CustomButton::IsTriggerableEvent(const MouseEvent& e) { 91 bool CustomButton::IsTriggerableEvent(const MouseEvent& e) {
91 return e.IsLeftMouseButton(); 92 return (triggerable_event_flags_ & e.GetFlags()) != 0;
92 } 93 }
93 94
94 //////////////////////////////////////////////////////////////////////////////// 95 ////////////////////////////////////////////////////////////////////////////////
95 // CustomButton, View overrides (protected): 96 // CustomButton, View overrides (protected):
96 97
97 bool CustomButton::AcceleratorPressed(const Accelerator& accelerator) { 98 bool CustomButton::AcceleratorPressed(const Accelerator& accelerator) {
98 if (enabled_) { 99 if (enabled_) {
99 SetState(BS_NORMAL); 100 SetState(BS_NORMAL);
100 NotifyClick(0); 101 NotifyClick(0);
101 return true; 102 return true;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 236
236 bool CustomButton::IsHighlighted() const { 237 bool CustomButton::IsHighlighted() const {
237 return state_ == BS_HOT; 238 return state_ == BS_HOT;
238 } 239 }
239 240
240 bool CustomButton::IsPushed() const { 241 bool CustomButton::IsPushed() const {
241 return state_ == BS_PUSHED; 242 return state_ == BS_PUSHED;
242 } 243 }
243 244
244 } // namespace views 245 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/controls/button/custom_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698