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

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: Review comments. 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
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
19 namespace test {
20 class TabbedPaneAccessibilityMacTest;
21 class TabbedPaneTest;
22 }
23
24 // The tab strip shown above the tab contents.
25 class TabStrip : public View {
tapted 2017/01/12 16:33:55 nit: move this down, after the declaration for `cl
Patti Lor 2017/01/13 05:48:38 Done, also added forward declaration for its use i
26 public:
27 // Internal class name.
28 static const char kViewClassName[];
29
30 TabStrip();
31 ~TabStrip() override;
32
33 // Called by TabStrip when the selected tab changes. This function is only
34 // called if |from_tab| is not null, i.e., there was a previously selected
35 // tab.
36 virtual void OnSelectedTabChanged(Tab* from_tab, Tab* to_tab);
37
38 // Overridden from View:
39 const char* GetClassName() const override;
40 void OnPaintBorder(gfx::Canvas* canvas) override;
41
42 Tab* GetSelectedTab() const;
43 Tab* GetTabAtDeltaFromSelected(int delta) const;
44 Tab* GetTabAtIndex(int index) const;
45 int GetSelectedTabIndex() const;
46
47 private:
48 DISALLOW_COPY_AND_ASSIGN(TabStrip);
49 };
19 50
20 // TabbedPane is a view that shows tabs. When the user clicks on a tab, the 51 // TabbedPane is a view that shows tabs. When the user clicks on a tab, the
21 // associated view is displayed. 52 // associated view is displayed.
22 class VIEWS_EXPORT TabbedPane : public View { 53 class VIEWS_EXPORT TabbedPane : public View {
23 public: 54 public:
24 // Internal class name. 55 // Internal class name.
25 static const char kViewClassName[]; 56 static const char kViewClassName[];
26 57
27 TabbedPane(); 58 TabbedPane();
28 ~TabbedPane() override; 59 ~TabbedPane() override;
(...skipping 25 matching lines...) Expand all
54 void SelectTab(Tab* tab); 85 void SelectTab(Tab* tab);
55 86
56 // Overridden from View: 87 // Overridden from View:
57 gfx::Size GetPreferredSize() const override; 88 gfx::Size GetPreferredSize() const override;
58 const char* GetClassName() const override; 89 const char* GetClassName() const override;
59 90
60 private: 91 private:
61 friend class FocusTraversalTest; 92 friend class FocusTraversalTest;
62 friend class Tab; 93 friend class Tab;
63 friend class TabStrip; 94 friend class TabStrip;
64 FRIEND_TEST_ALL_PREFIXES(TabbedPaneTest, AddAndSelect); 95 friend class test::TabbedPaneTest;
65 FRIEND_TEST_ALL_PREFIXES(TabbedPaneTest, ArrowKeyBindings); 96 friend class test::TabbedPaneAccessibilityMacTest;
66
67 // Get the Tab (the tabstrip view, not its content) at the valid |index|.
68 Tab* GetTabAt(int index);
tapted 2017/01/12 16:33:55 @sky: this was an orphaned declaration. Friended t
sky 2017/01/12 16:39:21 I'm ok with exposing the declaration.
Patti Lor 2017/01/13 05:48:38 Thanks Trent and sky, leaving as-is then :)
69 97
70 // Get the Tab (the tabstrip view, not its content) at the selected index. 98 // Get the Tab (the tabstrip view, not its content) at the selected index.
71 Tab* GetSelectedTab(); 99 Tab* GetSelectedTab();
72 100
73 // Returns the content View of the currently selected Tab. 101 // Returns the content View of the currently selected Tab.
74 View* GetSelectedTabContentView(); 102 View* GetSelectedTabContentView();
75 103
76 // Moves the selection by |delta| tabs, where negative delta means leftwards 104 // Moves the selection by |delta| tabs, where negative delta means leftwards
77 // and positive delta means rightwards. Returns whether the selection could be 105 // 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 106 // 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(); } 142 bool selected() const { return contents_->visible(); }
115 void SetSelected(bool selected); 143 void SetSelected(bool selected);
116 144
117 // Overridden from View: 145 // Overridden from View:
118 bool OnMousePressed(const ui::MouseEvent& event) override; 146 bool OnMousePressed(const ui::MouseEvent& event) override;
119 void OnMouseEntered(const ui::MouseEvent& event) override; 147 void OnMouseEntered(const ui::MouseEvent& event) override;
120 void OnMouseExited(const ui::MouseEvent& event) override; 148 void OnMouseExited(const ui::MouseEvent& event) override;
121 void OnGestureEvent(ui::GestureEvent* event) override; 149 void OnGestureEvent(ui::GestureEvent* event) override;
122 gfx::Size GetPreferredSize() const override; 150 gfx::Size GetPreferredSize() const override;
123 const char* GetClassName() const override; 151 const char* GetClassName() const override;
152 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
153 bool HandleAccessibleAction(const ui::AXActionData& action_data) override;
124 void OnFocus() override; 154 void OnFocus() override;
125 void OnBlur() override; 155 void OnBlur() override;
126 bool OnKeyPressed(const ui::KeyEvent& event) override; 156 bool OnKeyPressed(const ui::KeyEvent& event) override;
127 157
128 protected: 158 protected:
129 Label* title() { return title_; } 159 Label* title() { return title_; }
130 160
131 // Called whenever |tab_state_| changes. 161 // Called whenever |tab_state_| changes.
132 virtual void OnStateChanged(); 162 virtual void OnStateChanged();
133 163
(...skipping 12 matching lines...) Expand all
146 TabState tab_state_; 176 TabState tab_state_;
147 // The content view associated with this tab. 177 // The content view associated with this tab.
148 View* contents_; 178 View* contents_;
149 179
150 DISALLOW_COPY_AND_ASSIGN(Tab); 180 DISALLOW_COPY_AND_ASSIGN(Tab);
151 }; 181 };
152 182
153 } // namespace views 183 } // namespace views
154 184
155 #endif // UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_ 185 #endif // UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698