OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/button/menu_button.h" | 5 #include "views/controls/button/menu_button.h" |
6 | 6 |
7 #include "app/drag_drop_types.h" | 7 #include "app/drag_drop_types.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 if (GetDragOperations(e.location()) != DragDropTypes::DRAG_NONE && | 213 if (GetDragOperations(e.location()) != DragDropTypes::DRAG_NONE && |
214 state() != BS_DISABLED && !canceled && !InDrag() && | 214 state() != BS_DISABLED && !canceled && !InDrag() && |
215 e.IsOnlyLeftMouseButton() && HitTest(e.location())) { | 215 e.IsOnlyLeftMouseButton() && HitTest(e.location())) { |
216 Activate(); | 216 Activate(); |
217 } else { | 217 } else { |
218 TextButton::OnMouseReleased(e, canceled); | 218 TextButton::OnMouseReleased(e, canceled); |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 bool MenuButton::OnKeyPressed(const KeyEvent& e) { | 222 bool MenuButton::OnKeyPressed(const KeyEvent& e) { |
223 if (e.GetKeyCode() == app::VKEY_SPACE || | 223 if (e.GetKeyCode() == ui::VKEY_SPACE || |
224 e.GetKeyCode() == app::VKEY_RETURN || | 224 e.GetKeyCode() == ui::VKEY_RETURN || |
225 e.GetKeyCode() == app::VKEY_UP || | 225 e.GetKeyCode() == ui::VKEY_UP || |
226 e.GetKeyCode() == app::VKEY_DOWN) { | 226 e.GetKeyCode() == ui::VKEY_DOWN) { |
227 bool result = Activate(); | 227 bool result = Activate(); |
228 if (GetFocusManager()->GetFocusedView() == NULL) | 228 if (GetFocusManager()->GetFocusedView() == NULL) |
229 RequestFocus(); | 229 RequestFocus(); |
230 return result; | 230 return result; |
231 } | 231 } |
232 return false; | 232 return false; |
233 } | 233 } |
234 | 234 |
235 bool MenuButton::OnKeyReleased(const KeyEvent& e) { | 235 bool MenuButton::OnKeyReleased(const KeyEvent& e) { |
236 // Override CustomButton's implementation, which presses the button when | 236 // Override CustomButton's implementation, which presses the button when |
(...skipping 29 matching lines...) Expand all Loading... |
266 | 266 |
267 AccessibilityTypes::State MenuButton::GetAccessibleState() { | 267 AccessibilityTypes::State MenuButton::GetAccessibleState() { |
268 return AccessibilityTypes::STATE_HASPOPUP; | 268 return AccessibilityTypes::STATE_HASPOPUP; |
269 } | 269 } |
270 | 270 |
271 std::string MenuButton::GetClassName() const { | 271 std::string MenuButton::GetClassName() const { |
272 return kViewClassName; | 272 return kViewClassName; |
273 } | 273 } |
274 | 274 |
275 } // namespace views | 275 } // namespace views |
OLD | NEW |