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

Side by Side Diff: ui/views/controls/tabbed_pane/tabbed_pane.h

Issue 2578303003: a11y: Add a11y information to views::Tab and manually ignore its a11y children. (Closed)
Patch Set: Rebase Created 3 years, 11 months 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/BUILD.gn ('k') | ui/views/controls/tabbed_pane/tabbed_pane.cc » ('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) 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 #ifndef UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_ 5 #ifndef UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_
6 #define UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_ 6 #define UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "ui/views/view.h" 11 #include "ui/views/view.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 class Label; 15 class Label;
16 class Tab; 16 class Tab;
17 class TabbedPaneListener; 17 class TabbedPaneListener;
18 class TabStrip; 18 class TabStrip;
19 19
20 namespace test {
21 class TabbedPaneAccessibilityMacTest;
22 class TabbedPaneTest;
23 }
24
20 // TabbedPane is a view that shows tabs. When the user clicks on a tab, the 25 // TabbedPane is a view that shows tabs. When the user clicks on a tab, the
21 // associated view is displayed. 26 // associated view is displayed.
22 class VIEWS_EXPORT TabbedPane : public View { 27 class VIEWS_EXPORT TabbedPane : public View {
23 public: 28 public:
24 // Internal class name. 29 // Internal class name.
25 static const char kViewClassName[]; 30 static const char kViewClassName[];
26 31
27 TabbedPane(); 32 TabbedPane();
28 ~TabbedPane() override; 33 ~TabbedPane() override;
29 34
(...skipping 24 matching lines...) Expand all
54 void SelectTab(Tab* tab); 59 void SelectTab(Tab* tab);
55 60
56 // Overridden from View: 61 // Overridden from View:
57 gfx::Size GetPreferredSize() const override; 62 gfx::Size GetPreferredSize() const override;
58 const char* GetClassName() const override; 63 const char* GetClassName() const override;
59 64
60 private: 65 private:
61 friend class FocusTraversalTest; 66 friend class FocusTraversalTest;
62 friend class Tab; 67 friend class Tab;
63 friend class TabStrip; 68 friend class TabStrip;
64 FRIEND_TEST_ALL_PREFIXES(TabbedPaneTest, AddAndSelect); 69 friend class test::TabbedPaneTest;
65 FRIEND_TEST_ALL_PREFIXES(TabbedPaneTest, ArrowKeyBindings); 70 friend class test::TabbedPaneAccessibilityMacTest;
66
67 // Get the Tab (the tabstrip view, not its content) at the valid |index|.
68 Tab* GetTabAt(int index);
69 71
70 // Get the Tab (the tabstrip view, not its content) at the selected index. 72 // Get the Tab (the tabstrip view, not its content) at the selected index.
71 Tab* GetSelectedTab(); 73 Tab* GetSelectedTab();
72 74
73 // Returns the content View of the currently selected Tab. 75 // Returns the content View of the currently selected Tab.
74 View* GetSelectedTabContentView(); 76 View* GetSelectedTabContentView();
75 77
76 // Moves the selection by |delta| tabs, where negative delta means leftwards 78 // Moves the selection by |delta| tabs, where negative delta means leftwards
77 // and positive delta means rightwards. Returns whether the selection could be 79 // and positive delta means rightwards. Returns whether the selection could be
78 // moved by that amount; the only way this can fail is if there is only one 80 // moved by that amount; the only way this can fail is if there is only one
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 bool selected() const { return contents_->visible(); } 116 bool selected() const { return contents_->visible(); }
115 void SetSelected(bool selected); 117 void SetSelected(bool selected);
116 118
117 // Overridden from View: 119 // Overridden from View:
118 bool OnMousePressed(const ui::MouseEvent& event) override; 120 bool OnMousePressed(const ui::MouseEvent& event) override;
119 void OnMouseEntered(const ui::MouseEvent& event) override; 121 void OnMouseEntered(const ui::MouseEvent& event) override;
120 void OnMouseExited(const ui::MouseEvent& event) override; 122 void OnMouseExited(const ui::MouseEvent& event) override;
121 void OnGestureEvent(ui::GestureEvent* event) override; 123 void OnGestureEvent(ui::GestureEvent* event) override;
122 gfx::Size GetPreferredSize() const override; 124 gfx::Size GetPreferredSize() const override;
123 const char* GetClassName() const override; 125 const char* GetClassName() const override;
126 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
127 bool HandleAccessibleAction(const ui::AXActionData& action_data) override;
124 void OnFocus() override; 128 void OnFocus() override;
125 void OnBlur() override; 129 void OnBlur() override;
126 bool OnKeyPressed(const ui::KeyEvent& event) override; 130 bool OnKeyPressed(const ui::KeyEvent& event) override;
127 131
128 protected: 132 protected:
129 Label* title() { return title_; } 133 Label* title() { return title_; }
130 134
131 // Called whenever |tab_state_| changes. 135 // Called whenever |tab_state_| changes.
132 virtual void OnStateChanged(); 136 virtual void OnStateChanged();
133 137
134 private: 138 private:
135 enum TabState { 139 enum TabState {
136 TAB_INACTIVE, 140 TAB_INACTIVE,
137 TAB_ACTIVE, 141 TAB_ACTIVE,
138 TAB_HOVERED, 142 TAB_HOVERED,
139 }; 143 };
140 144
141 void SetState(TabState tab_state); 145 void SetState(TabState tab_state);
142 146
143 TabbedPane* tabbed_pane_; 147 TabbedPane* tabbed_pane_;
144 Label* title_; 148 Label* title_;
145 gfx::Size preferred_title_size_; 149 gfx::Size preferred_title_size_;
146 TabState tab_state_; 150 TabState tab_state_;
147 // The content view associated with this tab. 151 // The content view associated with this tab.
148 View* contents_; 152 View* contents_;
149 153
150 DISALLOW_COPY_AND_ASSIGN(Tab); 154 DISALLOW_COPY_AND_ASSIGN(Tab);
151 }; 155 };
152 156
157 // The tab strip shown above the tab contents.
158 class TabStrip : public View {
159 public:
160 // Internal class name.
161 static const char kViewClassName[];
162
163 TabStrip();
164 ~TabStrip() override;
165
166 // Called by TabStrip when the selected tab changes. This function is only
167 // called if |from_tab| is not null, i.e., there was a previously selected
168 // tab.
169 virtual void OnSelectedTabChanged(Tab* from_tab, Tab* to_tab);
170
171 // Overridden from View:
172 const char* GetClassName() const override;
173 void OnPaintBorder(gfx::Canvas* canvas) override;
174
175 Tab* GetSelectedTab() const;
176 Tab* GetTabAtDeltaFromSelected(int delta) const;
177 Tab* GetTabAtIndex(int index) const;
178 int GetSelectedTabIndex() const;
179
180 private:
181 DISALLOW_COPY_AND_ASSIGN(TabStrip);
182 };
183
153 } // namespace views 184 } // namespace views
154 185
155 #endif // UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_ 186 #endif // UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_
OLDNEW
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/controls/tabbed_pane/tabbed_pane.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698