OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 SetState(BS_HOT); | 126 SetState(BS_HOT); |
127 } | 127 } |
128 | 128 |
129 void ButtonDropDown::GetAccessibleState(ui::AccessibleViewState* state) { | 129 void ButtonDropDown::GetAccessibleState(ui::AccessibleViewState* state) { |
130 CustomButton::GetAccessibleState(state); | 130 CustomButton::GetAccessibleState(state); |
131 state->role = ui::AccessibilityTypes::ROLE_BUTTONDROPDOWN; | 131 state->role = ui::AccessibilityTypes::ROLE_BUTTONDROPDOWN; |
132 state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); | 132 state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); |
133 state->state = ui::AccessibilityTypes::STATE_HASPOPUP; | 133 state->state = ui::AccessibilityTypes::STATE_HASPOPUP; |
134 } | 134 } |
135 | 135 |
136 bool ButtonDropDown::ShouldEnterPushedState(const Event& event) { | 136 bool ButtonDropDown::ShouldEnterPushedState(const ui::Event& event) { |
137 // Enter PUSHED state on press with Left or Right mouse button or on taps. | 137 // Enter PUSHED state on press with Left or Right mouse button or on taps. |
138 // Remain in this state while the context menu is open. | 138 // Remain in this state while the context menu is open. |
139 return event.type() == ui::ET_GESTURE_TAP || | 139 return event.type() == ui::ET_GESTURE_TAP || |
140 event.type() == ui::ET_GESTURE_TAP_DOWN || | 140 event.type() == ui::ET_GESTURE_TAP_DOWN || |
141 (event.IsMouseEvent() && ((ui::EF_LEFT_MOUSE_BUTTON | | 141 (event.IsMouseEvent() && ((ui::EF_LEFT_MOUSE_BUTTON | |
142 ui::EF_RIGHT_MOUSE_BUTTON) & event.flags()) != 0); | 142 ui::EF_RIGHT_MOUSE_BUTTON) & event.flags()) != 0); |
143 } | 143 } |
144 | 144 |
145 bool ButtonDropDown::ShouldShowMenu() { | 145 bool ButtonDropDown::ShouldShowMenu() { |
146 return true; | 146 return true; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 SetState(BS_NORMAL); | 212 SetState(BS_NORMAL); |
213 } | 213 } |
214 | 214 |
215 //////////////////////////////////////////////////////////////////////////////// | 215 //////////////////////////////////////////////////////////////////////////////// |
216 // | 216 // |
217 // ButtonDropDown - Accessibility | 217 // ButtonDropDown - Accessibility |
218 // | 218 // |
219 //////////////////////////////////////////////////////////////////////////////// | 219 //////////////////////////////////////////////////////////////////////////////// |
220 | 220 |
221 } // namespace views | 221 } // namespace views |
OLD | NEW |