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

Side by Side Diff: ui/views/controls/button/button_dropdown.cc

Issue 8909002: views: Convert IsEnabled() to just enabled() since it's just a simple accessor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « ui/views/accessible_pane_view.cc ('k') | ui/views/controls/button/custom_button.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/views/controls/button/button_dropdown.h" 5 #include "ui/views/controls/button/button_dropdown.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 ButtonDropDown::~ButtonDropDown() { 42 ButtonDropDown::~ButtonDropDown() {
43 } 43 }
44 44
45 //////////////////////////////////////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////////////////
46 // 46 //
47 // ButtonDropDown - Events 47 // ButtonDropDown - Events
48 // 48 //
49 //////////////////////////////////////////////////////////////////////////////// 49 ////////////////////////////////////////////////////////////////////////////////
50 50
51 bool ButtonDropDown::OnMousePressed(const MouseEvent& event) { 51 bool ButtonDropDown::OnMousePressed(const MouseEvent& event) {
52 if (IsEnabled() && IsTriggerableEvent(event) && HitTest(event.location())) { 52 if (enabled() && IsTriggerableEvent(event) && HitTest(event.location())) {
53 // Store the y pos of the mouse coordinates so we can use them later to 53 // Store the y pos of the mouse coordinates so we can use them later to
54 // determine if the user dragged the mouse down (which should pop up the 54 // determine if the user dragged the mouse down (which should pop up the
55 // drag down menu immediately, instead of waiting for the timer) 55 // drag down menu immediately, instead of waiting for the timer)
56 y_position_on_lbuttondown_ = event.y(); 56 y_position_on_lbuttondown_ = event.y();
57 57
58 // Schedule a task that will show the menu. 58 // Schedule a task that will show the menu.
59 MessageLoop::current()->PostDelayedTask( 59 MessageLoop::current()->PostDelayedTask(
60 FROM_HERE, 60 FROM_HERE,
61 base::Bind(&ButtonDropDown::ShowDropDownMenu, 61 base::Bind(&ButtonDropDown::ShowDropDownMenu,
62 show_menu_factory_.GetWeakPtr(), 62 show_menu_factory_.GetWeakPtr(),
(...skipping 21 matching lines...) Expand all
84 84
85 void ButtonDropDown::OnMouseReleased(const MouseEvent& event) { 85 void ButtonDropDown::OnMouseReleased(const MouseEvent& event) {
86 if (IsTriggerableEvent(event) || 86 if (IsTriggerableEvent(event) ||
87 (event.IsRightMouseButton() && !HitTest(event.location()))) { 87 (event.IsRightMouseButton() && !HitTest(event.location()))) {
88 ImageButton::OnMouseReleased(event); 88 ImageButton::OnMouseReleased(event);
89 } 89 }
90 90
91 if (IsTriggerableEvent(event)) 91 if (IsTriggerableEvent(event))
92 show_menu_factory_.InvalidateWeakPtrs(); 92 show_menu_factory_.InvalidateWeakPtrs();
93 93
94 if (IsEnabled() && event.IsRightMouseButton() && HitTest(event.location())) { 94 if (enabled() && event.IsRightMouseButton() && HitTest(event.location())) {
95 show_menu_factory_.InvalidateWeakPtrs(); 95 show_menu_factory_.InvalidateWeakPtrs();
96 ShowDropDownMenu(GetWidget()->GetNativeView()); 96 ShowDropDownMenu(GetWidget()->GetNativeView());
97 } 97 }
98 } 98 }
99 99
100 std::string ButtonDropDown::GetClassName() const { 100 std::string ButtonDropDown::GetClassName() const {
101 return kViewClassName; 101 return kViewClassName;
102 } 102 }
103 103
104 void ButtonDropDown::OnMouseExited(const MouseEvent& event) { 104 void ButtonDropDown::OnMouseExited(const MouseEvent& event) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 SetState(BS_NORMAL); 185 SetState(BS_NORMAL);
186 } 186 }
187 187
188 //////////////////////////////////////////////////////////////////////////////// 188 ////////////////////////////////////////////////////////////////////////////////
189 // 189 //
190 // ButtonDropDown - Accessibility 190 // ButtonDropDown - Accessibility
191 // 191 //
192 //////////////////////////////////////////////////////////////////////////////// 192 ////////////////////////////////////////////////////////////////////////////////
193 193
194 } // namespace views 194 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/accessible_pane_view.cc ('k') | ui/views/controls/button/custom_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698