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

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

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Fix test Created 4 years, 1 month 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
« no previous file with comments | « ui/views/controls/button/button.h ('k') | ui/views/controls/button/checkbox.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.h" 5 #include "ui/views/controls/button/button.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_node_data.h"
9 9
10 namespace views { 10 namespace views {
11 11
12 //////////////////////////////////////////////////////////////////////////////// 12 ////////////////////////////////////////////////////////////////////////////////
13 // Button, static public: 13 // Button, static public:
14 14
15 // static 15 // static
16 Button::ButtonState Button::GetButtonStateFrom(ui::NativeTheme::State state) { 16 Button::ButtonState Button::GetButtonStateFrom(ui::NativeTheme::State state) {
17 switch (state) { 17 switch (state) {
18 case ui::NativeTheme::kDisabled: return Button::STATE_DISABLED; 18 case ui::NativeTheme::kDisabled: return Button::STATE_DISABLED;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 bool Button::GetTooltipText(const gfx::Point& p, 56 bool Button::GetTooltipText(const gfx::Point& p,
57 base::string16* tooltip) const { 57 base::string16* tooltip) const {
58 if (tooltip_text_.empty()) 58 if (tooltip_text_.empty())
59 return false; 59 return false;
60 60
61 *tooltip = tooltip_text_; 61 *tooltip = tooltip_text_;
62 return true; 62 return true;
63 } 63 }
64 64
65 void Button::GetAccessibleState(ui::AXViewState* state) { 65 void Button::GetAccessibleNodeData(ui::AXNodeData* node_data) {
66 state->role = ui::AX_ROLE_BUTTON; 66 node_data->role = ui::AX_ROLE_BUTTON;
67 state->name = accessible_name_; 67 node_data->SetName(accessible_name_);
68 } 68 }
69 69
70 //////////////////////////////////////////////////////////////////////////////// 70 ////////////////////////////////////////////////////////////////////////////////
71 // Button, protected: 71 // Button, protected:
72 72
73 Button::Button(ButtonListener* listener) 73 Button::Button(ButtonListener* listener)
74 : listener_(listener), 74 : listener_(listener),
75 tag_(-1) { 75 tag_(-1) {
76 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); 76 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
77 } 77 }
78 78
79 void Button::NotifyClick(const ui::Event& event) { 79 void Button::NotifyClick(const ui::Event& event) {
80 // We can be called when there is no listener, in cases like double clicks on 80 // We can be called when there is no listener, in cases like double clicks on
81 // menu buttons etc. 81 // menu buttons etc.
82 if (listener_) 82 if (listener_)
83 listener_->ButtonPressed(this, event); 83 listener_->ButtonPressed(this, event);
84 } 84 }
85 85
86 void Button::OnClickCanceled(const ui::Event& event) {} 86 void Button::OnClickCanceled(const ui::Event& event) {}
87 87
88 } // namespace views 88 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/button.h ('k') | ui/views/controls/button/checkbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698