summaryrefslogtreecommitdiffstats
path: root/views/controls/tabbed_pane
diff options
context:
space:
mode:
Diffstat (limited to 'views/controls/tabbed_pane')
-rw-r--r--views/controls/tabbed_pane/tabbed_pane.cc18
-rw-r--r--views/controls/tabbed_pane/tabbed_pane.h24
2 files changed, 14 insertions, 28 deletions
diff --git a/views/controls/tabbed_pane/tabbed_pane.cc b/views/controls/tabbed_pane/tabbed_pane.cc
index 1091407..eb9f971 100644
--- a/views/controls/tabbed_pane/tabbed_pane.cc
+++ b/views/controls/tabbed_pane/tabbed_pane.cc
@@ -5,13 +5,11 @@
#include "views/controls/tabbed_pane/tabbed_pane.h"
#include "base/logging.h"
-#include "ui/base/accessibility/accessible_view_state.h"
// TODO(avi): remove when not needed
#include "base/utf_string_conversions.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "views/controls/native/native_view_host.h"
#include "views/controls/tabbed_pane/native_tabbed_pane_wrapper.h"
-#include "views/widget/widget.h"
namespace views {
@@ -40,6 +38,7 @@ void TabbedPane::AddTabAtIndex(int index,
bool select_if_first_tab) {
native_tabbed_pane_->AddTabAtIndex(index, title, contents,
select_if_first_tab);
+ contents->SetAccessibleName(WideToUTF16Hack(title));
PreferredSizeChanged();
}
@@ -61,10 +60,6 @@ void TabbedPane::SelectTabAt(int index) {
native_tabbed_pane_->SelectTabAt(index);
}
-void TabbedPane::SetAccessibleName(const string16& name) {
- accessible_name_ = name;
-}
-
int TabbedPane::GetTabCount() {
return native_tabbed_pane_->GetTabCount();
}
@@ -123,10 +118,8 @@ void TabbedPane::OnFocus() {
native_tabbed_pane_->SetFocus();
View* selected_tab = GetSelectedTab();
- if (selected_tab) {
- selected_tab->GetWidget()->NotifyAccessibilityEvent(
- selected_tab, ui::AccessibilityTypes::EVENT_FOCUS, true);
- }
+ if (selected_tab)
+ selected_tab->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS);
}
else
View::OnFocus(); // Will focus the RootView window (so we still get
@@ -138,9 +131,8 @@ void TabbedPane::OnPaintFocusBorder(gfx::Canvas* canvas) {
View::OnPaintFocusBorder(canvas);
}
-void TabbedPane::GetAccessibleState(ui::AccessibleViewState* state) {
- state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST;
- state->name = accessible_name_;
+AccessibilityTypes::Role TabbedPane::GetAccessibleRole() {
+ return AccessibilityTypes::ROLE_PAGETABLIST;
}
gfx::Size TabbedPane::GetPreferredSize() {
diff --git a/views/controls/tabbed_pane/tabbed_pane.h b/views/controls/tabbed_pane/tabbed_pane.h
index a968d36..4fdb727 100644
--- a/views/controls/tabbed_pane/tabbed_pane.h
+++ b/views/controls/tabbed_pane/tabbed_pane.h
@@ -14,6 +14,7 @@ class NativeTabbedPaneWrapper;
// The TabbedPane class is a view that shows tabs. When the user clicks on a
// tab, the associated view is displayed.
+
class TabbedPane : public View {
public:
TabbedPane();
@@ -62,20 +63,16 @@ class TabbedPane : public View {
Listener* listener() const { return listener_; }
- void SetAccessibleName(const string16& name);
-
// View overrides:
- virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child)
- OVERRIDE;
+ virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
// Handles Ctrl+Tab and Ctrl+Shift+Tab navigation of pages.
- virtual bool AcceleratorPressed(const views::Accelerator& accelerator)
- OVERRIDE;
- virtual std::string GetClassName() const OVERRIDE;
- virtual void Layout() OVERRIDE;
- virtual void OnFocus() OVERRIDE;
- virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
- virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
- virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
+ virtual std::string GetClassName() const;
+ virtual void Layout();
+ virtual void OnFocus();
+ virtual void OnPaintFocusBorder(gfx::Canvas* canvas);
+ virtual AccessibilityTypes::Role GetAccessibleRole();
+ virtual gfx::Size GetPreferredSize();
NativeTabbedPaneWrapper* native_wrapper() const {
return native_tabbed_pane_;
@@ -99,9 +96,6 @@ class TabbedPane : public View {
// The listener we notify about tab selection changes.
Listener* listener_;
- // The accessible name of this view.
- string16 accessible_name_;
-
DISALLOW_COPY_AND_ASSIGN(TabbedPane);
};