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 "gfx/canvas.h" | 10 #include "gfx/canvas.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 if (GetDragOperations(e.location()) != DragDropTypes::DRAG_NONE && | 212 if (GetDragOperations(e.location()) != DragDropTypes::DRAG_NONE && |
213 state() != BS_DISABLED && !canceled && !InDrag() && | 213 state() != BS_DISABLED && !canceled && !InDrag() && |
214 e.IsOnlyLeftMouseButton() && HitTest(e.location())) { | 214 e.IsOnlyLeftMouseButton() && HitTest(e.location())) { |
215 Activate(); | 215 Activate(); |
216 } else { | 216 } else { |
217 TextButton::OnMouseReleased(e, canceled); | 217 TextButton::OnMouseReleased(e, canceled); |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 bool MenuButton::OnKeyPressed(const KeyEvent& e) { | 221 bool MenuButton::OnKeyPressed(const KeyEvent& e) { |
222 if (e.GetKeyCode() == app::VKEY_SPACE || | 222 if (e.GetKeyCode() == base::VKEY_SPACE || |
223 e.GetKeyCode() == app::VKEY_RETURN || | 223 e.GetKeyCode() == base::VKEY_RETURN || |
224 e.GetKeyCode() == app::VKEY_UP || | 224 e.GetKeyCode() == base::VKEY_UP || |
225 e.GetKeyCode() == app::VKEY_DOWN) { | 225 e.GetKeyCode() == base::VKEY_DOWN) { |
226 bool result = Activate(); | 226 bool result = Activate(); |
227 if (GetFocusManager()->GetFocusedView() == NULL) | 227 if (GetFocusManager()->GetFocusedView() == NULL) |
228 RequestFocus(); | 228 RequestFocus(); |
229 return result; | 229 return result; |
230 } | 230 } |
231 return false; | 231 return false; |
232 } | 232 } |
233 | 233 |
234 bool MenuButton::OnKeyReleased(const KeyEvent& e) { | 234 bool MenuButton::OnKeyReleased(const KeyEvent& e) { |
235 // Override CustomButton's implementation, which presses the button when | 235 // Override CustomButton's implementation, which presses the button when |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 *state = AccessibilityTypes::STATE_HASPOPUP; | 275 *state = AccessibilityTypes::STATE_HASPOPUP; |
276 return true; | 276 return true; |
277 } | 277 } |
278 | 278 |
279 std::string MenuButton::GetClassName() const { | 279 std::string MenuButton::GetClassName() const { |
280 return kViewClassName; | 280 return kViewClassName; |
281 } | 281 } |
282 | 282 |
283 } // namespace views | 283 } // namespace views |
OLD | NEW |