OLD | NEW |
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/button.h" | 5 #include "chrome/views/controls/button/button.h" |
6 | 6 |
7 namespace views { | 7 namespace views { |
8 | 8 |
9 //////////////////////////////////////////////////////////////////////////////// | 9 //////////////////////////////////////////////////////////////////////////////// |
10 // Button, public: | 10 // Button, public: |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 bool Button::GetAccessibleName(std::wstring* name) { | 39 bool Button::GetAccessibleName(std::wstring* name) { |
40 if (!accessible_name_.empty()) { | 40 if (!accessible_name_.empty()) { |
41 *name = accessible_name_; | 41 *name = accessible_name_; |
42 return true; | 42 return true; |
43 } | 43 } |
44 return false; | 44 return false; |
45 } | 45 } |
46 | 46 |
| 47 bool Button::GetAccessibleRole(AccessibilityTypes::Role* role) { |
| 48 *role = AccessibilityTypes::ROLE_PUSHBUTTON; |
| 49 return true; |
| 50 } |
| 51 |
47 void Button::SetAccessibleKeyboardShortcut(const std::wstring& shortcut) { | 52 void Button::SetAccessibleKeyboardShortcut(const std::wstring& shortcut) { |
48 accessible_shortcut_.assign(shortcut); | 53 accessible_shortcut_.assign(shortcut); |
49 } | 54 } |
50 | 55 |
51 void Button::SetAccessibleName(const std::wstring& name) { | 56 void Button::SetAccessibleName(const std::wstring& name) { |
52 accessible_name_.assign(name); | 57 accessible_name_.assign(name); |
53 } | 58 } |
54 | 59 |
55 //////////////////////////////////////////////////////////////////////////////// | 60 //////////////////////////////////////////////////////////////////////////////// |
56 // Button, protected: | 61 // Button, protected: |
57 | 62 |
58 Button::Button(ButtonListener* listener) | 63 Button::Button(ButtonListener* listener) |
59 : listener_(listener), | 64 : listener_(listener), |
60 tag_(-1), | 65 tag_(-1), |
61 mouse_event_flags_(0) { | 66 mouse_event_flags_(0) { |
62 } | 67 } |
63 | 68 |
64 void Button::NotifyClick(int mouse_event_flags) { | 69 void Button::NotifyClick(int mouse_event_flags) { |
65 mouse_event_flags_ = mouse_event_flags; | 70 mouse_event_flags_ = mouse_event_flags; |
66 // We can be called when there is no listener, in cases like double clicks on | 71 // We can be called when there is no listener, in cases like double clicks on |
67 // menu buttons etc. | 72 // menu buttons etc. |
68 if (listener_) | 73 if (listener_) |
69 listener_->ButtonPressed(this); | 74 listener_->ButtonPressed(this); |
70 // NOTE: don't attempt to reset mouse_event_flags_ as the listener may have | 75 // NOTE: don't attempt to reset mouse_event_flags_ as the listener may have |
71 // deleted us. | 76 // deleted us. |
72 } | 77 } |
73 | 78 |
74 } // namespace views | 79 } // namespace views |
OLD | NEW |