diff options
139 files changed, 884 insertions, 1068 deletions
diff --git a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc index a498c36..40c60cb5d 100644 --- a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc +++ b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc @@ -17,9 +17,8 @@ #include "chrome/test/ui_test_utils.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" -#include "ui/base/accessibility/accessibility_types.h" #include "ui/base/l10n/l10n_util.h" -#include "views/accessibility/native_view_accessibility_win.h" +#include "views/accessibility/view_accessibility.h" #include "views/widget/root_view.h" #include "views/widget/widget_win.h" #include "views/window/window.h" @@ -29,7 +28,7 @@ namespace { VARIANT id_self = {VT_I4, CHILDID_SELF}; // Dummy class to force creation of ATL module, needed by COM to instantiate -// NativeViewAccessibilityWin. +// ViewAccessibility. class TestAtlModule : public CAtlDllModuleT<TestAtlModule> {}; TestAtlModule test_atl_module_; @@ -87,9 +86,7 @@ class BrowserViewsAccessibilityTest : public InProcessBrowserTest { ASSERT_TRUE(NULL != view); TestAccessibilityInfo( - views::NativeViewAccessibilityWin::GetAccessibleForView(view), - name, - role); + ViewAccessibility::GetAccessibleForView(view), name, role); } @@ -256,8 +253,8 @@ IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, EXPECT_STREQ( aboutChromeWindow->GetDelegate()->GetWindowTitle().c_str(), UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_CHROME_TITLE)).c_str()); - EXPECT_EQ(aboutChromeWindow->GetDelegate()->GetAccessibleRole(), - ui::AccessibilityTypes::ROLE_DIALOG); + EXPECT_EQ(aboutChromeWindow->GetDelegate()->accessible_role(), + AccessibilityTypes::ROLE_DIALOG); // Also test the accessibility object directly. IAccessible* acc_obj = NULL; diff --git a/chrome/browser/autocomplete/autocomplete_accessibility.cc b/chrome/browser/autocomplete/autocomplete_accessibility.cc index 48b59bf..05cc6c0 100644 --- a/chrome/browser/autocomplete/autocomplete_accessibility.cc +++ b/chrome/browser/autocomplete/autocomplete_accessibility.cc @@ -8,7 +8,7 @@ #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "views/accessibility/native_view_accessibility_win.h" +#include "views/accessibility/view_accessibility.h" #include "views/view.h" HRESULT AutocompleteAccessibility::Initialize( @@ -59,8 +59,8 @@ STDMETHODIMP AutocompleteAccessibility::get_accParent(IDispatch** disp_parent) { } // Retrieve the IDispatch interface for the parent view. - *disp_parent = views::NativeViewAccessibilityWin::GetAccessibleForView( - edit_box_->parent_view()); + *disp_parent = + ViewAccessibility::GetAccessibleForView(edit_box_->parent_view()); // Increment the reference count for the retrieved interface. (*disp_parent)->AddRef(); return S_OK; diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_views.cc b/chrome/browser/autocomplete/autocomplete_edit_view_views.cc index aa302e7..355d192 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_views.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_views.cc @@ -20,7 +20,6 @@ #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "net/base/escape.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/font.h" @@ -272,11 +271,6 @@ void AutocompleteEditViewViews::Layout() { height() - insets.height()); } -void AutocompleteEditViewViews::GetAccessibleState( - ui::AccessibleViewState* state) { - state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); -} - //////////////////////////////////////////////////////////////////////////////// // AutocompleteEditViewViews, AutocopmleteEditView implementation: diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_views.h b/chrome/browser/autocomplete/autocomplete_edit_view_views.h index fbc8b31..f58915b 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_views.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_views.h @@ -67,7 +67,6 @@ class AutocompleteEditViewViews : public views::View, // Implements views::View virtual bool OnMousePressed(const views::MouseEvent& event); virtual void Layout(); - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // Implement the AutocompleteEditView interface. virtual AutocompleteEditModel* model(); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index a4b4475..26fd11d 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -735,10 +735,8 @@ void AutocompleteEditViewWin::ClosePopup() { void AutocompleteEditViewWin::SetFocus() { ::SetFocus(m_hWnd); - parent_view_->GetWidget()->NotifyAccessibilityEvent( - parent_view_, - ui::AccessibilityTypes::EVENT_FOCUS, - false); + parent_view_-> + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS, false); } IAccessible* AutocompleteEditViewWin::GetIAccessible() { @@ -908,12 +906,12 @@ bool AutocompleteEditViewWin::OnAfterPossibleChangeInternal( if (text_differs) { // Note that a TEXT_CHANGED event implies that the cursor/selection // probably changed too, so we don't need to send both. - parent_view_->GetWidget()->NotifyAccessibilityEvent( - parent_view_, ui::AccessibilityTypes::EVENT_TEXT_CHANGED, true); + parent_view_->NotifyAccessibilityEvent( + AccessibilityTypes::EVENT_TEXT_CHANGED); } else if (selection_differs) { // Notify assistive technology that the cursor or selection changed. - parent_view_->GetWidget()->NotifyAccessibilityEvent( - parent_view_, ui::AccessibilityTypes::EVENT_SELECTION_CHANGED, true); + parent_view_->NotifyAccessibilityEvent( + AccessibilityTypes::EVENT_SELECTION_CHANGED); } else if (delete_at_end_pressed_) { controller_->OnChanged(); } diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index c3f1ec6..5e522f7 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -388,8 +388,8 @@ class DownloadTest : public InProcessBrowserTest { // - Add a member function to the |DownloadShelf| interface class, that // indicates how many members it has. // - Add a member function to |DownloadShelf| to get the status text - // of a given member (for example, via the name in |DownloadItemView|'s - // GetAccessibleState() member function), by index. + // of a given member (for example, via |DownloadItemView|'s + // GetAccessibleName() member function), by index. // - Iterate over browser->window()->GetDownloadShelf()'s members // to see if any match the status text we want. Start with the last one. diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 2bb8c48..2a81d33 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -42,7 +42,7 @@ #include "ui/gfx/canvas_skia.h" #include "ui/gfx/gdi_util.h" #include "ui/gfx/rect.h" -#include "views/accessibility/native_view_accessibility_win.h" +#include "views/accessibility/view_accessibility.h" #include "views/focus/focus_manager.h" #include "views/focus/focus_util_win.h" // Included for views::kReflectedMessage - TODO(beng): move this to win_util.h! @@ -587,10 +587,9 @@ void RenderWidgetHostViewWin::Show() { // Save away our HWND in the parent window as a property so that the // accessibility code can find it. - accessibility_prop_.reset(new ViewProp( - GetParent(), - views::kViewsNativeHostPropForAccessibility, - m_hWnd)); + accessibility_prop_.reset(new ViewProp(GetParent(), + kViewsNativeHostPropForAccessibility, + m_hWnd)); DidBecomeSelected(); } @@ -865,10 +864,9 @@ LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) { static_cast<RenderWidgetHostView*>(this))); // Save away our HWND in the parent window as a property so that the // accessibility code can find it. - accessibility_prop_.reset(new ViewProp( - GetParent(), - views::kViewsNativeHostPropForAccessibility, - m_hWnd)); + accessibility_prop_.reset(new ViewProp(GetParent(), + kViewsNativeHostPropForAccessibility, + m_hWnd)); return 0; } diff --git a/chrome/browser/ui/views/accessibility_event_router_views.cc b/chrome/browser/ui/views/accessibility_event_router_views.cc index 5986d92..b296cac 100644 --- a/chrome/browser/ui/views/accessibility_event_router_views.cc +++ b/chrome/browser/ui/views/accessibility_event_router_views.cc @@ -13,7 +13,7 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/common/notification_type.h" -#include "ui/base/accessibility/accessible_view_state.h" +#include "views/accessibility/accessibility_types.h" #include "views/controls/button/custom_button.h" #include "views/controls/button/menu_button.h" #include "views/controls/button/native_button.h" @@ -43,38 +43,38 @@ AccessibilityEventRouterViews* AccessibilityEventRouterViews::GetInstance() { } void AccessibilityEventRouterViews::HandleAccessibilityEvent( - views::View* view, ui::AccessibilityTypes::Event event_type) { + views::View* view, AccessibilityTypes::Event event_type) { if (!ExtensionAccessibilityEventRouter::GetInstance()-> IsAccessibilityEnabled()) { return; } switch (event_type) { - case ui::AccessibilityTypes::EVENT_FOCUS: + case AccessibilityTypes::EVENT_FOCUS: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_CONTROL_FOCUSED); break; - case ui::AccessibilityTypes::EVENT_MENUSTART: - case ui::AccessibilityTypes::EVENT_MENUPOPUPSTART: + case AccessibilityTypes::EVENT_MENUSTART: + case AccessibilityTypes::EVENT_MENUPOPUPSTART: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_MENU_OPENED); break; - case ui::AccessibilityTypes::EVENT_MENUEND: - case ui::AccessibilityTypes::EVENT_MENUPOPUPEND: + case AccessibilityTypes::EVENT_MENUEND: + case AccessibilityTypes::EVENT_MENUPOPUPEND: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_MENU_CLOSED); break; - case ui::AccessibilityTypes::EVENT_TEXT_CHANGED: - case ui::AccessibilityTypes::EVENT_SELECTION_CHANGED: + case AccessibilityTypes::EVENT_TEXT_CHANGED: + case AccessibilityTypes::EVENT_SELECTION_CHANGED: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_TEXT_CHANGED); break; - case ui::AccessibilityTypes::EVENT_VALUE_CHANGED: + case AccessibilityTypes::EVENT_VALUE_CHANGED: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_CONTROL_ACTION); break; - case ui::AccessibilityTypes::EVENT_ALERT: - case ui::AccessibilityTypes::EVENT_NAME_CHANGED: + case AccessibilityTypes::EVENT_ALERT: + case AccessibilityTypes::EVENT_NAME_CHANGED: // TODO(dmazzoni): re-evaluate this list later and see // if supporting any of these would be useful feature requests or // they'd just be superfluous. @@ -88,9 +88,9 @@ void AccessibilityEventRouterViews::HandleAccessibilityEvent( // std::string AccessibilityEventRouterViews::GetViewName(views::View* view) { - ui::AccessibleViewState state; - view->GetAccessibleState(&state); - return UTF16ToUTF8(state.name); + string16 wname; + view->GetAccessibleName(&wname); + return UTF16ToUTF8(wname); } void AccessibilityEventRouterViews::DispatchAccessibilityNotification( @@ -202,11 +202,9 @@ bool AccessibilityEventRouterViews::IsMenuEvent( return true; while (view) { - ui::AccessibleViewState state; - view->GetAccessibleState(&state); - ui::AccessibilityTypes::Role role = state.role; - if (role == ui::AccessibilityTypes::ROLE_MENUITEM || - role == ui::AccessibilityTypes::ROLE_MENUPOPUP) { + AccessibilityTypes::Role role = view->GetAccessibleRole(); + if (role == AccessibilityTypes::ROLE_MENUITEM || + role == AccessibilityTypes::ROLE_MENUPOPUP) { return true; } view = view->parent(); diff --git a/chrome/browser/ui/views/accessibility_event_router_views.h b/chrome/browser/ui/views/accessibility_event_router_views.h index 6dfdf78..77b256d 100644 --- a/chrome/browser/ui/views/accessibility_event_router_views.h +++ b/chrome/browser/ui/views/accessibility_event_router_views.h @@ -13,7 +13,7 @@ #include "base/singleton.h" #include "base/task.h" #include "chrome/browser/accessibility_events.h" -#include "ui/base/accessibility/accessibility_types.h" +#include "views/accessibility/accessibility_types.h" class Profile; namespace views { @@ -54,7 +54,7 @@ class AccessibilityEventRouterViews { // Handle an accessibility event generated by a view. void HandleAccessibilityEvent( - views::View* view, ui::AccessibilityTypes::Event event_type); + views::View* view, AccessibilityTypes::Event event_type); private: AccessibilityEventRouterViews(); diff --git a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc index 7fb4751..caecfbb 100644 --- a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc +++ b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc @@ -46,7 +46,7 @@ class AccessibilityViewsDelegate : public views::ViewsDelegate { return false; } virtual void NotifyAccessibilityEvent( - views::View* view, ui::AccessibilityTypes::Event event_type) { + views::View* view, AccessibilityTypes::Event event_type) { AccessibilityEventRouterViews::GetInstance()->HandleAccessibilityEvent( view, event_type); } diff --git a/chrome/browser/ui/views/accessible_pane_view.cc b/chrome/browser/ui/views/accessible_pane_view.cc index 9dfa4a2..c6789bc 100644 --- a/chrome/browser/ui/views/accessible_pane_view.cc +++ b/chrome/browser/ui/views/accessible_pane_view.cc @@ -7,7 +7,6 @@ #include "chrome/browser/ui/views/accessible_pane_view.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/controls/button/menu_button.h" #include "views/controls/native/native_view_host.h" #include "views/focus/focus_search.h" @@ -193,8 +192,8 @@ void AccessiblePaneView::SetVisible(bool flag) { View::SetVisible(flag); } -void AccessiblePaneView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_PANE; +AccessibilityTypes::Role AccessiblePaneView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PANE; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/accessible_pane_view.h b/chrome/browser/ui/views/accessible_pane_view.h index 8f7d56c..349fc0d 100644 --- a/chrome/browser/ui/views/accessible_pane_view.h +++ b/chrome/browser/ui/views/accessible_pane_view.h @@ -41,20 +41,19 @@ class AccessiblePaneView : public views::View, virtual bool SetPaneFocusAndFocusDefault(int view_storage_id); // Overridden from views::View: - virtual FocusTraversable* GetPaneFocusTraversable() OVERRIDE; - virtual bool AcceleratorPressed(const views::Accelerator& accelerator) - OVERRIDE; - virtual void SetVisible(bool flag) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual FocusTraversable* GetPaneFocusTraversable(); + virtual bool AcceleratorPressed(const views::Accelerator& accelerator); + virtual void SetVisible(bool flag); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Overridden from views::FocusChangeListener: virtual void FocusWillChange(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now); // Overridden from views::FocusTraversable: - virtual views::FocusSearch* GetFocusSearch() OVERRIDE; - virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; - virtual View* GetFocusTraversableParentView() OVERRIDE; + virtual views::FocusSearch* GetFocusSearch(); + virtual FocusTraversable* GetFocusTraversableParent(); + virtual View* GetFocusTraversableParentView(); protected: // A subclass can override this to provide a default focusable child diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc index 28c3a31..78f19ab 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc @@ -86,9 +86,8 @@ void BookmarkBarInstructionsView::ViewHierarchyChanged(bool is_add, UpdateColors(); } -void BookmarkBarInstructionsView::GetAccessibleState( - ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_GROUPING; +AccessibilityTypes::Role BookmarkBarInstructionsView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void BookmarkBarInstructionsView::LinkActivated(views::Link* source, diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h index 675df4a..3b6bf13 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h @@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_VIEW_H_ #pragma once -#include "ui/base/accessibility/accessible_view_state.h" #include "views/controls/link.h" #include "views/view.h" @@ -36,16 +35,16 @@ class BookmarkBarInstructionsView : public views::View, explicit BookmarkBarInstructionsView(Delegate* delegate); // View overrides. - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void OnThemeChanged() OVERRIDE; + virtual gfx::Size GetPreferredSize(); + virtual void Layout(); + virtual void OnThemeChanged(); virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + views::View* child); + virtual AccessibilityTypes::Role GetAccessibleRole(); // LinkController. - virtual void LinkActivated(views::Link* source, int event_flags) OVERRIDE; + virtual void LinkActivated(views::Link* source, int event_flags); private: void UpdateColors(); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index d61b4ad..c1cb88d89 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -40,7 +40,6 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/l10n/l10n_util.h" @@ -298,7 +297,7 @@ class BookmarkBarView::ButtonSeparatorView : public views::View { ButtonSeparatorView() {} virtual ~ButtonSeparatorView() {} - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) { DetachableToolbarView::PaintVerticalDivider( canvas, kSeparatorStartX, height(), 1, DetachableToolbarView::kEdgeDividerColor, @@ -306,15 +305,14 @@ class BookmarkBarView::ButtonSeparatorView : public views::View { GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TOOLBAR)); } - virtual gfx::Size GetPreferredSize() OVERRIDE { + virtual gfx::Size GetPreferredSize() { // We get the full height of the bookmark bar, so that the height returned // here doesn't matter. return gfx::Size(kSeparatorWidth, 1); } - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE { - state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR); - state->role = ui::AccessibilityTypes::ROLE_SEPARATOR; + virtual AccessibilityTypes::Role GetAccessibleRole() { + return AccessibilityTypes::ROLE_SEPARATOR; } private: @@ -677,9 +675,12 @@ void BookmarkBarView::ShowContextMenu(const gfx::Point& p, ShowContextMenu(this, p, is_mouse_gesture); } -void BookmarkBarView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_TOOLBAR; - state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS); +bool BookmarkBarView::IsAccessibleViewTraversable(views::View* view) { + return view != bookmarks_separator_view_ && view != instructions_; +} + +AccessibilityTypes::Role BookmarkBarView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_TOOLBAR; } void BookmarkBarView::OnStateChanged() { @@ -880,6 +881,8 @@ void BookmarkBarView::Init() { AddChildView(other_bookmarked_button_); bookmarks_separator_view_ = new ButtonSeparatorView(); + bookmarks_separator_view_->SetAccessibleName( + l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR)); AddChildView(bookmarks_separator_view_); instructions_ = new BookmarkBarInstructionsView(this); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h index 214893c..5737e7c 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h @@ -109,36 +109,34 @@ class BookmarkBarView : public DetachableToolbarView, infobar_visible_ = infobar_visible; } - virtual bool IsOnTop() const; - // DetachableToolbarView methods: - virtual bool IsDetached() const OVERRIDE; - virtual double GetAnimationValue() const OVERRIDE; - virtual int GetToolbarOverlap() const OVERRIDE { + virtual bool IsDetached() const; + virtual bool IsOnTop() const; + virtual double GetAnimationValue() const; + virtual int GetToolbarOverlap() const { return GetToolbarOverlap(false); } // View methods: - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual gfx::Size GetMinimumSize() OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child) - OVERRIDE; - virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize(); + virtual gfx::Size GetMinimumSize(); + virtual void Layout(); + virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); + virtual void PaintChildren(gfx::Canvas* canvas); virtual bool GetDropFormats( int* formats, - std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; - virtual bool AreDropTypesRequired() OVERRIDE; - virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; - virtual void OnDragEntered(const views::DropTargetEvent& event) OVERRIDE; - virtual int OnDragUpdated(const views::DropTargetEvent& event) OVERRIDE; - virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE; - virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture) - OVERRIDE; + std::set<ui::OSExchangeData::CustomFormat>* custom_formats); + virtual bool AreDropTypesRequired(); + virtual bool CanDrop(const ui::OSExchangeData& data); + virtual void OnDragEntered(const views::DropTargetEvent& event); + virtual int OnDragUpdated(const views::DropTargetEvent& event); + virtual void OnDragExited(); + virtual int OnPerformDrop(const views::DropTargetEvent& event); + virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture); // AccessiblePaneView methods: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual bool IsAccessibleViewTraversable(views::View* view); + virtual AccessibilityTypes::Role GetAccessibleRole(); // ProfileSyncServiceObserver method. virtual void OnStateChanged(); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc index 9bb6721..49ea7e2 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc @@ -18,7 +18,6 @@ #include "chrome/test/ui_test_utils.h" #include "content/browser/tab_contents/page_navigator.h" #include "grit/generated_resources.h" -#include "ui/base/accessibility/accessibility_types.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/keycodes/keyboard_codes.h" #include "views/controls/button/menu_button.h" @@ -85,7 +84,7 @@ class ViewsDelegateImpl : public views::ViewsDelegate { } virtual void NotifyAccessibilityEvent( - views::View* view, ui::AccessibilityTypes::Event event_type) {} + views::View* view, AccessibilityTypes::Event event_type) {} #if defined(OS_WIN) virtual HICON GetDefaultWindowIcon() const { return 0; } diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index d85548f..6870f65 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -33,7 +33,6 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkTypeface.h" #include "third_party/skia/include/effects/SkGradientShader.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -171,6 +170,7 @@ void BrowserActionButton::UpdateState() { if (name.empty()) name = UTF8ToUTF16(extension()->name()); SetTooltipText(UTF16ToWideHack(name)); + SetAccessibleName(name); parent()->SchedulePaint(); } @@ -292,6 +292,8 @@ BrowserActionView::BrowserActionView(const Extension* extension, button_->SetDragController(panel_); AddChildView(button_); button_->UpdateState(); + SetAccessibleName( + l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION)); } BrowserActionView::~BrowserActionView() { @@ -317,10 +319,8 @@ gfx::Canvas* BrowserActionView::GetIconWithBadge() { return canvas; } -void BrowserActionView::GetAccessibleState(ui::AccessibleViewState* state) { - state->name = l10n_util::GetStringUTF16( - IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION); - state->role = ui::AccessibilityTypes::ROLE_GROUPING; +AccessibilityTypes::Role BrowserActionView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void BrowserActionView::Layout() { @@ -372,6 +372,8 @@ BrowserActionsContainer::BrowserActionsContainer(Browser* browser, resize_animation_.reset(new ui::SlideAnimation(this)); resize_area_ = new views::ResizeArea(this); + resize_area_->SetAccessibleName( + l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR)); AddChildView(resize_area_); chevron_ = new views::MenuButton(NULL, std::wstring(), this, false); @@ -381,6 +383,8 @@ BrowserActionsContainer::BrowserActionsContainer(Browser* browser, l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_CHEVRON)); chevron_->SetVisible(false); AddChildView(chevron_); + + SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS)); } BrowserActionsContainer::~BrowserActionsContainer() { @@ -737,10 +741,8 @@ void BrowserActionsContainer::OnThemeChanged() { LoadImages(); } -void BrowserActionsContainer::GetAccessibleState( - ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_GROUPING; - state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS); +AccessibilityTypes::Role BrowserActionsContainer::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void BrowserActionsContainer::RunMenu(View* source, const gfx::Point& pt) { diff --git a/chrome/browser/ui/views/browser_actions_container.h b/chrome/browser/ui/views/browser_actions_container.h index d803447..94c13139e 100644 --- a/chrome/browser/ui/views/browser_actions_container.h +++ b/chrome/browser/ui/views/browser_actions_container.h @@ -27,6 +27,7 @@ #include "views/view.h" class Browser; +class BrowserActionsContainer; class BrowserActionOverflowMenuController; class BrowserActionsContainer; class Extension; @@ -162,7 +163,7 @@ class BrowserActionView : public views::View { gfx::Canvas* GetIconWithBadge(); // Accessibility accessors, overridden from View. - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); private: virtual void Layout(); @@ -330,7 +331,7 @@ class BrowserActionsContainer virtual void OnDragExited(); virtual int OnPerformDrop(const views::DropTargetEvent& event); virtual void OnThemeChanged(); - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); // Overridden from views::ViewMenuDelegate: virtual void RunMenu(View* source, const gfx::Point& pt); diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc index ecd9e92..3771682 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.cc +++ b/chrome/browser/ui/views/chrome_views_delegate.cc @@ -114,7 +114,7 @@ bool ChromeViewsDelegate::GetSavedMaximizedState( } void ChromeViewsDelegate::NotifyAccessibilityEvent( - views::View* view, ui::AccessibilityTypes::Event event_type) { + views::View* view, AccessibilityTypes::Event event_type) { AccessibilityEventRouterViews::GetInstance()->HandleAccessibilityEvent( view, event_type); } diff --git a/chrome/browser/ui/views/chrome_views_delegate.h b/chrome/browser/ui/views/chrome_views_delegate.h index 952ae43..c48f07b 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.h +++ b/chrome/browser/ui/views/chrome_views_delegate.h @@ -8,7 +8,6 @@ #include "base/basictypes.h" #include "build/build_config.h" -#include "ui/base/accessibility/accessibility_types.h" #include "views/views_delegate.h" namespace views { @@ -33,7 +32,7 @@ class ChromeViewsDelegate : public views::ViewsDelegate { const std::wstring& window_name, bool* maximized) const; virtual void NotifyAccessibilityEvent( - views::View* view, ui::AccessibilityTypes::Event event_type); + views::View* view, AccessibilityTypes::Event event_type); #if defined(OS_WIN) virtual HICON GetDefaultWindowIcon() const; #endif diff --git a/chrome/browser/ui/views/download_item_view.cc b/chrome/browser/ui/views/download_item_view.cc index eaafa09..1783b16 100644 --- a/chrome/browser/ui/views/download_item_view.cc +++ b/chrome/browser/ui/views/download_item_view.cc @@ -20,7 +20,6 @@ #include "chrome/browser/ui/views/download_shelf_view.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -950,13 +949,15 @@ void DownloadItemView::ShowContextMenu(const gfx::Point& p, } } -void DownloadItemView::GetAccessibleState(ui::AccessibleViewState* state) { - state->name = accessible_name_; - state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; +AccessibilityTypes::Role DownloadItemView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PUSHBUTTON; +} + +AccessibilityTypes::State DownloadItemView::GetAccessibleState() { if (download_->safety_state() == DownloadItem::DANGEROUS) { - state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; + return AccessibilityTypes::STATE_UNAVAILABLE; } else { - state->state = ui::AccessibilityTypes::STATE_HASPOPUP; + return AccessibilityTypes::STATE_HASPOPUP; } } @@ -1078,6 +1079,9 @@ bool DownloadItemView::InDropDownButtonXCoordinateRange(int x) { } void DownloadItemView::UpdateAccessibleName() { + string16 current_name; + GetAccessibleName(¤t_name); + string16 new_name; if (download_->safety_state() == DownloadItem::DANGEROUS) { new_name = WideToUTF16Hack(dangerous_download_label_->GetText()); @@ -1086,13 +1090,12 @@ void DownloadItemView::UpdateAccessibleName() { download_->GetFileNameToReportUser().LossyDisplayName(); } - // If the name has changed, notify assistive technology that the name - // has changed so they can announce it immediately. - if (new_name != accessible_name_) { - accessible_name_ = new_name; - if (GetWidget()) { - GetWidget()->NotifyAccessibilityEvent( - this, ui::AccessibilityTypes::EVENT_NAME_CHANGED, true); - } + // If the name has changed, call SetAccessibleName and notify + // assistive technology that the name has changed so they can + // announce it immediately. + if (new_name != current_name) { + SetAccessibleName(new_name); + if (GetWidget()) + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_NAME_CHANGED); } } diff --git a/chrome/browser/ui/views/download_item_view.h b/chrome/browser/ui/views/download_item_view.h index 6994378..e8f427a 100644 --- a/chrome/browser/ui/views/download_item_view.h +++ b/chrome/browser/ui/views/download_item_view.h @@ -77,7 +77,8 @@ class DownloadItemView : public views::ButtonListener, virtual bool OnMouseDragged(const views::MouseEvent& event); virtual bool OnKeyPressed(const views::KeyEvent& e); virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture); - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); // ButtonListener implementation. virtual void ButtonPressed(views::Button* sender, const views::Event& event); @@ -278,9 +279,6 @@ class DownloadItemView : public views::ButtonListener, // might delete us). bool* deleted_; - // The name of this view as reported to assistive technology. - string16 accessible_name_; - DISALLOW_COPY_AND_ASSIGN(DownloadItemView); }; diff --git a/chrome/browser/ui/views/first_run_search_engine_view.cc b/chrome/browser/ui/views/first_run_search_engine_view.cc index d204d62c..0e6dd44 100644 --- a/chrome/browser/ui/views/first_run_search_engine_view.cc +++ b/chrome/browser/ui/views/first_run_search_engine_view.cc @@ -18,11 +18,10 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/ui/options/options_window.h" #include "grit/chromium_strings.h" -#include "grit/generated_resources.h" #include "grit/google_chrome_strings.h" +#include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" @@ -266,8 +265,7 @@ void FirstRunSearchEngineView::OnTemplateURLModelChanged() { // This will tell screenreaders that they should read the full text // of this dialog to the user now (rather than waiting for the user // to explore it). - GetWidget()->NotifyAccessibilityEvent( - this, ui::AccessibilityTypes::EVENT_ALERT, true); + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_ALERT); } gfx::Size FirstRunSearchEngineView::GetPreferredSize() { @@ -429,9 +427,8 @@ void FirstRunSearchEngineView::Layout() { } // if (search_engine_choices.size() > 0) } -void FirstRunSearchEngineView::GetAccessibleState( - ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_ALERT; +AccessibilityTypes::Role FirstRunSearchEngineView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_ALERT; } std::wstring FirstRunSearchEngineView::GetWindowTitle() const { diff --git a/chrome/browser/ui/views/first_run_search_engine_view.h b/chrome/browser/ui/views/first_run_search_engine_view.h index eee914c..5db011b 100644 --- a/chrome/browser/ui/views/first_run_search_engine_view.h +++ b/chrome/browser/ui/views/first_run_search_engine_view.h @@ -88,31 +88,29 @@ class FirstRunSearchEngineView virtual ~FirstRunSearchEngineView(); - bool IsAlwaysOnTop() const { return true; } - bool HasAlwaysOnTopMenu() const { return false; } - // Overridden from views::View: - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize(); + virtual void Layout(); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Overridden from views::WindowDelegate: - virtual std::wstring GetWindowTitle() const OVERRIDE; - views::View* GetContentsView() OVERRIDE { return this; } - bool CanResize() const OVERRIDE{ return false; } - bool CanMaximize() const OVERRIDE { return false; } + virtual std::wstring GetWindowTitle() const; + views::View* GetContentsView() { return this; } + bool CanResize() const { return false; } + bool CanMaximize() const { return false; } + bool IsAlwaysOnTop() const { return true; } + bool HasAlwaysOnTopMenu() const { return false; } // Overridden from views::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event) - OVERRIDE; + virtual void ButtonPressed(views::Button* sender, const views::Event& event); // Override from View so we can draw the gray background at dialog top. - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas); // Overridden from TemplateURLModelObserver. When the search engines have // loaded from the profile, we can populate the logos in the dialog box // to present to the user. - virtual void OnTemplateURLModelChanged() OVERRIDE; + virtual void OnTemplateURLModelChanged(); private: // Initializes the labels and controls in the view. @@ -143,3 +141,4 @@ class FirstRunSearchEngineView }; #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ + diff --git a/chrome/browser/ui/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc index 6476bc4..094e6c3 100644 --- a/chrome/browser/ui/views/frame/browser_root_view.cc +++ b/chrome/browser/ui/views/frame/browser_root_view.cc @@ -14,7 +14,6 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "grit/chromium_strings.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/l10n/l10n_util.h" @@ -23,7 +22,9 @@ BrowserRootView::BrowserRootView(BrowserView* browser_view, views::Widget* widget) : views::RootView(widget), browser_view_(browser_view), - forwarding_to_tab_strip_(false) { } + forwarding_to_tab_strip_(false) { + SetAccessibleName(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); +} bool BrowserRootView::GetDropFormats( int* formats, @@ -109,11 +110,6 @@ int BrowserRootView::OnPerformDrop(const views::DropTargetEvent& event) { return tabstrip()->OnPerformDrop(*mapped_event); } -void BrowserRootView::GetAccessibleState(ui::AccessibleViewState* state) { - RootView::GetAccessibleState(state); - state->name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); -} - bool BrowserRootView::ShouldForwardToTabStrip( const views::DropTargetEvent& event) { if (!tabstrip()->IsVisible()) diff --git a/chrome/browser/ui/views/frame/browser_root_view.h b/chrome/browser/ui/views/frame/browser_root_view.h index bba1c10..1fcccb5 100644 --- a/chrome/browser/ui/views/frame/browser_root_view.h +++ b/chrome/browser/ui/views/frame/browser_root_view.h @@ -25,17 +25,15 @@ class BrowserRootView : public views::RootView { // You must call set_tabstrip before this class will accept drops. BrowserRootView(BrowserView* browser_view, views::Widget* widget); - // Overridden from views::View: virtual bool GetDropFormats( int* formats, - std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; - virtual bool AreDropTypesRequired() OVERRIDE; - virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; - virtual void OnDragEntered(const views::DropTargetEvent& event) OVERRIDE; - virtual int OnDragUpdated(const views::DropTargetEvent& event) OVERRIDE; - virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + std::set<ui::OSExchangeData::CustomFormat>* custom_formats); + virtual bool AreDropTypesRequired(); + virtual bool CanDrop(const ui::OSExchangeData& data); + virtual void OnDragEntered(const views::DropTargetEvent& event); + virtual int OnDragUpdated(const views::DropTargetEvent& event); + virtual void OnDragExited(); + virtual int OnPerformDrop(const views::DropTargetEvent& event); private: // Returns true if the event should be forwarded to the tabstrip. diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 328b449..aba18fb 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -74,7 +74,6 @@ #include "grit/locale_settings.h" #include "grit/theme_resources.h" #include "grit/webkit_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" @@ -1826,9 +1825,8 @@ void BrowserView::ChildPreferredSizeChanged(View* child) { Layout(); } -void BrowserView::GetAccessibleState(ui::AccessibleViewState* state) { - state->name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); - state->role = ui::AccessibilityTypes::ROLE_CLIENT; +AccessibilityTypes::Role BrowserView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_CLIENT; } void BrowserView::InfoBarContainerSizeChanged(bool is_animating) { @@ -1857,6 +1855,8 @@ void BrowserView::InitTabStrip(TabStripModel* model) { new BrowserTabStripController(browser_.get(), model); tabstrip_ = CreateTabStrip(tabstrip_controller, UseVerticalTabs()); + + tabstrip_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_TABSTRIP)); AddChildView(tabstrip_); tabstrip_controller->InitFromModel(tabstrip_); @@ -1884,12 +1884,14 @@ void BrowserView::Init() { } LoadAccelerators(); + SetAccessibleName(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); InitTabStrip(browser_->tabstrip_model()); toolbar_ = new ToolbarView(browser_.get()); AddChildView(toolbar_); toolbar_->Init(browser_->profile()); + toolbar_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR)); infobar_container_ = new InfoBarContainer(this); AddChildView(infobar_container_); @@ -2020,6 +2022,8 @@ bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) { bookmark_bar_view_->SetProfile(contents->profile()); } bookmark_bar_view_->SetPageNavigator(contents->tab_contents()); + bookmark_bar_view_->SetAccessibleName( + l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS)); new_bookmark_bar_view = bookmark_bar_view_.get(); } return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_); diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 74a71b0..fecd185 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -414,14 +414,14 @@ class BrowserView : public BrowserBubbleHost, } // Overridden from views::View: - virtual std::string GetClassName() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; + virtual std::string GetClassName() const; + virtual void Layout(); + virtual void PaintChildren(gfx::Canvas* canvas); virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child) OVERRIDE; - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + views::View* child); + virtual void ChildPreferredSizeChanged(View* child); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Factory Methods. // Returns a new LayoutManager for this browser view. A subclass may diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index c68c571..3bdbd2c 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -16,7 +16,6 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/theme_provider.h" @@ -401,9 +400,8 @@ bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { return browser_view_->IsPositionInWindowCaption(browser_view_point); } -void OpaqueBrowserFrameView::GetAccessibleState( - ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; +AccessibilityTypes::Role OpaqueBrowserFrameView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_TITLEBAR; } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h index a001b5d..0303d3a 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h @@ -45,30 +45,28 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, virtual gfx::Rect GetBoundsForReservedArea() const; // Overridden from views::NonClientFrameView: - virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; - virtual bool AlwaysUseNativeFrame() const OVERRIDE; - virtual bool AlwaysUseCustomFrame() const OVERRIDE; + virtual gfx::Rect GetBoundsForClientView() const; + virtual bool AlwaysUseNativeFrame() const; + virtual bool AlwaysUseCustomFrame() const; virtual gfx::Rect GetWindowBoundsForClientBounds( - const gfx::Rect& client_bounds) const OVERRIDE; - virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; - virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) - OVERRIDE; - virtual void EnableClose(bool enable) OVERRIDE; - virtual void ResetWindowControls() OVERRIDE; + const gfx::Rect& client_bounds) const; + virtual int NonClientHitTest(const gfx::Point& point); + virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask); + virtual void EnableClose(bool enable); + virtual void ResetWindowControls(); // Overridden from views::View: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void Layout() OVERRIDE; - virtual bool HitTest(const gfx::Point& l) const OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas); + virtual void Layout(); + virtual bool HitTest(const gfx::Point& l) const; + virtual AccessibilityTypes::Role GetAccessibleRole(); // Overridden from views::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event) - OVERRIDE; + virtual void ButtonPressed(views::Button* sender, const views::Event& event); // Overridden from TabIconView::TabIconViewModel: - virtual bool ShouldTabIconViewAnimate() const OVERRIDE; - virtual SkBitmap GetFavIconForTabIconView() OVERRIDE; + virtual bool ShouldTabIconViewAnimate() const; + virtual SkBitmap GetFavIconForTabIconView(); private: // Returns the thickness of the border that makes up the window frame edges. diff --git a/chrome/browser/ui/views/infobars/infobar_container.cc b/chrome/browser/ui/views/infobars/infobar_container.cc index d8a1c72..20761aa 100644 --- a/chrome/browser/ui/views/infobars/infobar_container.cc +++ b/chrome/browser/ui/views/infobars/infobar_container.cc @@ -12,7 +12,6 @@ #include "chrome/common/notification_source.h" #include "content/browser/tab_contents/tab_contents.h" #include "grit/generated_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" InfoBarContainer::Delegate::~Delegate() { @@ -22,6 +21,7 @@ InfoBarContainer::InfoBarContainer(Delegate* delegate) : delegate_(delegate), tab_contents_(NULL) { SetID(VIEW_ID_INFO_BAR_CONTAINER); + SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_CONTAINER)); } InfoBarContainer::~InfoBarContainer() { @@ -109,9 +109,8 @@ void InfoBarContainer::Layout() { } } -void InfoBarContainer::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_GROUPING; - state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_CONTAINER); +AccessibilityTypes::Role InfoBarContainer::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void InfoBarContainer::Observe(NotificationType type, diff --git a/chrome/browser/ui/views/infobars/infobar_container.h b/chrome/browser/ui/views/infobars/infobar_container.h index 0715192..4dba347 100644 --- a/chrome/browser/ui/views/infobars/infobar_container.h +++ b/chrome/browser/ui/views/infobars/infobar_container.h @@ -68,14 +68,14 @@ class InfoBarContainer : public AccessiblePaneView, typedef std::set<InfoBarView*> InfoBars; // AccessiblePaneView: - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize(); + virtual void Layout(); + virtual AccessibilityTypes::Role GetAccessibleRole(); // NotificationObserver: virtual void Observe(NotificationType type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const NotificationDetails& details); // Removes an InfoBar for the specified delegate, in response to a // notification from the selected TabContents. The InfoBar's disappearance diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc index 97689bf..c973d2a 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.cc +++ b/chrome/browser/ui/views/infobars/infobar_view.cc @@ -13,7 +13,6 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "third_party/skia/include/effects/SkGradientShader.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -55,6 +54,9 @@ InfoBarView::InfoBarView(InfoBarDelegate* delegate) InfoBarDelegate::Type infobar_type = delegate->GetInfoBarType(); set_background(new InfoBarBackground(infobar_type)); + SetAccessibleName(l10n_util::GetStringUTF16( + (infobar_type == InfoBarDelegate::WARNING_TYPE) ? + IDS_ACCNAME_INFOBAR_WARNING : IDS_ACCNAME_INFOBAR_PAGE_ACTION)); animation_->SetTweenType(ui::Tween::LINEAR); } @@ -271,8 +273,7 @@ void InfoBarView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { #endif if (GetFocusManager()) GetFocusManager()->AddFocusChangeListener(this); - GetWidget()->NotifyAccessibilityEvent( - this, ui::AccessibilityTypes::EVENT_ALERT, true); + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_ALERT); if (close_button_ == NULL) { SkBitmap* image = delegate_->GetIcon(); @@ -363,11 +364,8 @@ int InfoBarView::OffsetY(const gfx::Size prefsize) const { return CenterY(prefsize) - (target_height_ - height()); } -void InfoBarView::GetAccessibleState(ui::AccessibleViewState* state) { - state->name = l10n_util::GetStringUTF16( - (delegate_->GetInfoBarType() == InfoBarDelegate::WARNING_TYPE) ? - IDS_ACCNAME_INFOBAR_WARNING : IDS_ACCNAME_INFOBAR_PAGE_ACTION); - state->role = ui::AccessibilityTypes::ROLE_ALERT; +AccessibilityTypes::Role InfoBarView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_ALERT; } gfx::Size InfoBarView::GetPreferredSize() { @@ -379,10 +377,8 @@ void InfoBarView::FocusWillChange(View* focused_before, View* focused_now) { // This will trigger some screen readers to read the entire contents of this // infobar. if (focused_before && focused_now && !this->Contains(focused_before) && - this->Contains(focused_now)) { - GetWidget()->NotifyAccessibilityEvent( - this, ui::AccessibilityTypes::EVENT_ALERT, true); - } + this->Contains(focused_now)) + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_ALERT); } void InfoBarView::AnimationEnded(const ui::Animation* animation) { diff --git a/chrome/browser/ui/views/infobars/infobar_view.h b/chrome/browser/ui/views/infobars/infobar_view.h index dbe847f..fe3655b 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.h +++ b/chrome/browser/ui/views/infobars/infobar_view.h @@ -106,16 +106,14 @@ class InfoBarView : public InfoBar, bool needs_elevation); // views::View: - virtual void Layout() OVERRIDE; - virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child) - OVERRIDE; + virtual void Layout(); + virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); // views::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event) - OVERRIDE; + virtual void ButtonPressed(views::Button* sender, const views::Event& event); // ui::AnimationDelegate: - virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; + virtual void AnimationProgressed(const ui::Animation* animation); // Returns the minimum width the content (that is, everything between the icon // and the close button) can be shrunk to. This is used to prevent the close @@ -149,15 +147,14 @@ class InfoBarView : public InfoBar, static const int kHorizontalPadding; // views::View: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual gfx::Size GetPreferredSize(); // views::FocusChangeListener: - virtual void FocusWillChange(View* focused_before, View* focused_now) - OVERRIDE; + virtual void FocusWillChange(View* focused_before, View* focused_now); // ui::AnimationDelegate: - virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; + virtual void AnimationEnded(const ui::Animation* animation); // Destroys the external focus tracker, if present. If |restore_focus| is // true, restores focus to the view tracked by the focus tracker before doing diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 6afd564..686c6f7 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -37,7 +37,6 @@ #include "content/browser/renderer_host/render_widget_host_view.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -173,6 +172,8 @@ void LocationBarView::Init() { location_entry_view_ = location_entry_->AddToView(this); location_entry_view_->SetID(VIEW_ID_AUTOCOMPLETE); + location_entry_view_->SetAccessibleName( + l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION)); selected_keyword_view_ = new SelectedKeywordView( kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, @@ -204,6 +205,8 @@ void LocationBarView::Init() { star_view_->SetVisible(true); } + SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION)); + // Initialize the location entry. We do this to avoid a black flash which is // visible when the location entry has just been initialized. Update(NULL); @@ -1052,9 +1055,8 @@ bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { #endif } -void LocationBarView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_GROUPING; - state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); +AccessibilityTypes::Role LocationBarView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void LocationBarView::WriteDragData(views::View* sender, diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 2226c3a..90607c8 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -208,7 +208,7 @@ class LocationBarView : public LocationBar, // Overridden from views::View: virtual std::string GetClassName() const OVERRIDE; virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; // Overridden from views::DragController: virtual void WriteDragData(View* sender, diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc index 1127067..1e7ca9a 100644 --- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc +++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc @@ -8,13 +8,12 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/extensions/extension_browser_event_router.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/platform_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" +#include "chrome/browser/platform_util.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_resource.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/controls/menu/menu_2.h" PageActionImageView::PageActionImageView(LocationBarView* owner, @@ -102,8 +101,8 @@ void PageActionImageView::ExecuteAction(int button, } } -void PageActionImageView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; +AccessibilityTypes::Role PageActionImageView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PUSHBUTTON; } bool PageActionImageView::OnMousePressed(const views::MouseEvent& event) { diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.h b/chrome/browser/ui/views/location_bar/page_action_image_view.h index 47c39fd..ed0f190 100644 --- a/chrome/browser/ui/views/location_bar/page_action_image_view.h +++ b/chrome/browser/ui/views/location_bar/page_action_image_view.h @@ -41,23 +41,21 @@ class PageActionImageView : public views::ImageView, } // Overridden from view. - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled) - OVERRIDE; - virtual bool OnKeyPressed(const views::KeyEvent& e) OVERRIDE; - virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture) - OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual bool OnMousePressed(const views::MouseEvent& event); + virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); + virtual bool OnKeyPressed(const views::KeyEvent& e); + virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture); // Overridden from ImageLoadingTracker. virtual void OnImageLoaded( - SkBitmap* image, ExtensionResource resource, int index) OVERRIDE; + SkBitmap* image, ExtensionResource resource, int index); // Overridden from ExtensionContextMenuModelModel::Delegate - virtual void InspectPopup(ExtensionAction* action) OVERRIDE; + virtual void InspectPopup(ExtensionAction* action); // Overridden from ExtensionPopup::Observer - virtual void ExtensionPopupIsClosing(ExtensionPopup* popup) OVERRIDE; + virtual void ExtensionPopupIsClosing(ExtensionPopup* popup); // Called to notify the PageAction that it should determine whether to be // visible or hidden. |contents| is the TabContents that is active, |url| is diff --git a/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc index fd6d717..75cc136 100644 --- a/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc +++ b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc @@ -6,7 +6,6 @@ #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" #include "chrome/common/extensions/extension.h" -#include "ui/base/accessibility/accessible_view_state.h" PageActionWithBadgeView::PageActionWithBadgeView( PageActionImageView* image_view) { @@ -14,9 +13,8 @@ PageActionWithBadgeView::PageActionWithBadgeView( AddChildView(image_view_); } -void PageActionWithBadgeView::GetAccessibleState( - ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_GROUPING; +AccessibilityTypes::Role PageActionWithBadgeView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } gfx::Size PageActionWithBadgeView::GetPreferredSize() { diff --git a/chrome/browser/ui/views/location_bar/page_action_with_badge_view.h b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.h index 06f145d..6071bad 100644 --- a/chrome/browser/ui/views/location_bar/page_action_with_badge_view.h +++ b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.h @@ -20,9 +20,8 @@ class PageActionWithBadgeView : public views::View { PageActionImageView* image_view() { return image_view_; } - // View overrides: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual gfx::Size GetPreferredSize(); void UpdateVisibility(TabContents* contents, const GURL& url); diff --git a/chrome/browser/ui/views/location_bar/star_view.cc b/chrome/browser/ui/views/location_bar/star_view.cc index 2e49fc7..886aec2 100644 --- a/chrome/browser/ui/views/location_bar/star_view.cc +++ b/chrome/browser/ui/views/location_bar/star_view.cc @@ -11,7 +11,6 @@ #include "chrome/browser/ui/views/browser_dialogs.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -28,13 +27,16 @@ StarView::~StarView() { void StarView::SetToggled(bool on) { SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16( on ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR))); + // Since StarView is an ImageView, the SetTooltipText changes the accessible + // name. To keep the accessible name unchanged, we need to set the accessible + // name right after we modify the tooltip text for this view. + SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_STAR)); SetImage(ResourceBundle::GetSharedInstance().GetBitmapNamed( on ? IDR_STAR_LIT : IDR_STAR)); } -void StarView::GetAccessibleState(ui::AccessibleViewState* state) { - state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_STAR); - state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; +AccessibilityTypes::Role StarView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PUSHBUTTON; } bool StarView::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { diff --git a/chrome/browser/ui/views/location_bar/star_view.h b/chrome/browser/ui/views/location_bar/star_view.h index f27f3f0..ad02f9e 100644 --- a/chrome/browser/ui/views/location_bar/star_view.h +++ b/chrome/browser/ui/views/location_bar/star_view.h @@ -27,19 +27,17 @@ class StarView : public views::ImageView, public InfoBubbleDelegate { private: // views::ImageView overrides: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip) - OVERRIDE; - virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled) - OVERRIDE; - virtual bool OnKeyPressed(const views::KeyEvent& e) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); + virtual bool OnMousePressed(const views::MouseEvent& event); + virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); + virtual bool OnKeyPressed(const views::KeyEvent& e); // InfoBubbleDelegate overrides: virtual void InfoBubbleClosing(InfoBubble* info_bubble, - bool closed_by_escape) OVERRIDE; - virtual bool CloseOnEscape() OVERRIDE; - virtual bool FadeInOnShow() OVERRIDE { return false; } + bool closed_by_escape); + virtual bool CloseOnEscape(); + virtual bool FadeInOnShow() { return false; } // The CommandUpdater for the Browser object that owns the location bar. CommandUpdater* command_updater_; diff --git a/chrome/browser/ui/views/options/general_page_view.cc b/chrome/browser/ui/views/options/general_page_view.cc index 621ffae..0996b4a 100644 --- a/chrome/browser/ui/views/options/general_page_view.cc +++ b/chrome/browser/ui/views/options/general_page_view.cc @@ -35,7 +35,6 @@ #include "chrome/installer/util/browser_distribution.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/combobox_model.h" #include "views/controls/button/radio_button.h" @@ -67,8 +66,8 @@ class OptionsGroupContents : public views::View { OptionsGroupContents() { } // views::View overrides: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE { - state->state = ui::AccessibilityTypes::ROLE_GROUPING; + virtual AccessibilityTypes::Role GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } private: diff --git a/chrome/browser/ui/views/options/options_group_view.cc b/chrome/browser/ui/views/options/options_group_view.cc index 7a7d741..f4a9670 100644 --- a/chrome/browser/ui/views/options/options_group_view.cc +++ b/chrome/browser/ui/views/options/options_group_view.cc @@ -9,9 +9,8 @@ #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" -#include "grit/generated_resources.h" #include "grit/locale_settings.h" -#include "ui/base/accessibility/accessible_view_state.h" +#include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" @@ -51,6 +50,9 @@ OptionsGroupView::OptionsGroupView(views::View* contents, description_label_->SetMultiLine(true); description_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); + + SetAccessibleName(WideToUTF16Hack(title)); + contents->SetAccessibleName(WideToUTF16Hack(title)); } OptionsGroupView::~OptionsGroupView() { @@ -68,9 +70,8 @@ int OptionsGroupView::GetContentsWidth() const { /////////////////////////////////////////////////////////////////////////////// // OptionsGroupView, views::View overrides: -void OptionsGroupView::GetAccessibleState(ui::AccessibleViewState* state) { - title_label_->GetAccessibleState(state); - state->role = ui::AccessibilityTypes::ROLE_GROUPING; +AccessibilityTypes::Role OptionsGroupView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void OptionsGroupView::OnPaint(gfx::Canvas* canvas) { diff --git a/chrome/browser/ui/views/options/options_group_view.h b/chrome/browser/ui/views/options/options_group_view.h index 2add3c4..1d32c0a 100644 --- a/chrome/browser/ui/views/options/options_group_view.h +++ b/chrome/browser/ui/views/options/options_group_view.h @@ -35,11 +35,11 @@ class OptionsGroupView : public views::View { protected: // views::View overrides: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual void OnPaint(gfx::Canvas* canvas); virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child) OVERRIDE; + views::View* child); private: void Init(); diff --git a/chrome/browser/ui/views/options/options_page_view.cc b/chrome/browser/ui/views/options/options_page_view.cc index 3cbf3a5..b81b3af 100644 --- a/chrome/browser/ui/views/options/options_page_view.cc +++ b/chrome/browser/ui/views/options/options_page_view.cc @@ -5,7 +5,6 @@ #include "chrome/browser/ui/views/options/options_page_view.h" #include "chrome/browser/metrics/user_metrics.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/widget/widget.h" /////////////////////////////////////////////////////////////////////////////// @@ -34,6 +33,6 @@ void OptionsPageView::ViewHierarchyChanged(bool is_add, } } -void OptionsPageView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_PAGETAB; +AccessibilityTypes::Role OptionsPageView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PAGETAB; } diff --git a/chrome/browser/ui/views/options/options_page_view.h b/chrome/browser/ui/views/options/options_page_view.h index de438a1..bbbc8c4 100644 --- a/chrome/browser/ui/views/options/options_page_view.h +++ b/chrome/browser/ui/views/options/options_page_view.h @@ -39,8 +39,8 @@ class OptionsPageView : public views::View, // views::View overrides: virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + views::View* child); + virtual AccessibilityTypes::Role GetAccessibleRole(); private: // Whether or not the control layout has been initialized for this page. diff --git a/chrome/browser/ui/views/options/options_window_view.cc b/chrome/browser/ui/views/options/options_window_view.cc index 91d4290..7126f7d 100644 --- a/chrome/browser/ui/views/options/options_window_view.cc +++ b/chrome/browser/ui/views/options/options_window_view.cc @@ -17,7 +17,6 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "views/controls/tabbed_pane/tabbed_pane.h" #include "views/widget/root_view.h" @@ -40,29 +39,29 @@ class OptionsWindowView : public views::View, void ShowOptionsPage(OptionsPage page, OptionsGroup highlight_group); // views::DialogDelegate implementation: - virtual int GetDialogButtons() const OVERRIDE { + virtual int GetDialogButtons() const { return MessageBoxFlags::DIALOGBUTTON_CANCEL; } - virtual std::wstring GetWindowTitle() const OVERRIDE; - virtual std::wstring GetWindowName() const OVERRIDE; - virtual void WindowClosing() OVERRIDE; - virtual bool Cancel() OVERRIDE; - virtual views::View* GetContentsView() OVERRIDE; - virtual bool ShouldRestoreWindowSize() const OVERRIDE; + virtual std::wstring GetWindowTitle() const; + virtual std::wstring GetWindowName() const; + virtual void WindowClosing(); + virtual bool Cancel(); + virtual views::View* GetContentsView(); + virtual bool ShouldRestoreWindowSize() const; // views::TabbedPane::Listener implementation: - virtual void TabSelectedAt(int index) OVERRIDE; + virtual void TabSelectedAt(int index); // views::View overrides: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual void Layout(); + virtual gfx::Size GetPreferredSize(); protected: // views::View overrides: virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child) OVERRIDE; + views::View* child); private: // Init the assorted Tabbed pages void Init(); @@ -167,8 +166,8 @@ void OptionsWindowView::TabSelectedAt(int index) { /////////////////////////////////////////////////////////////////////////////// // OptionsWindowView, views::View overrides: -void OptionsWindowView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_CLIENT; +AccessibilityTypes::Role OptionsWindowView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_CLIENT; } void OptionsWindowView::Layout() { diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc index 6ac2a5b8..f99517c 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc @@ -9,7 +9,6 @@ #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/tab_contents.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/focus/focus_manager.h" //////////////////////////////////////////////////////////////////////////////// @@ -131,9 +130,8 @@ void NativeTabContentsContainerGtk::AboutToRequestFocusFromTabTraversal( container_->tab_contents()->FocusThroughTabTraversal(reverse); } -void NativeTabContentsContainerGtk::GetAccessibleState( - ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_GROUPING; +AccessibilityTypes::Role NativeTabContentsContainerGtk::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h index 469f11e..004b689 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h @@ -33,7 +33,7 @@ class NativeTabContentsContainerGtk : public NativeTabContentsContainer, virtual void OnFocus() OVERRIDE; virtual void RequestFocus() OVERRIDE; virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; private: TabContentsContainer* container_; diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc index f0f7c9d..e4dfd02 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc @@ -10,7 +10,7 @@ #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/tab_contents.h" -#include "ui/base/accessibility/accessible_view_state.h" + #include "views/focus/focus_manager.h" //////////////////////////////////////////////////////////////////////////////// @@ -129,9 +129,8 @@ void NativeTabContentsContainerWin::AboutToRequestFocusFromTabTraversal( container_->tab_contents()->FocusThroughTabTraversal(reverse); } -void NativeTabContentsContainerWin::GetAccessibleState( - ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_GROUPING; +AccessibilityTypes::Role NativeTabContentsContainerWin::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h index 4d60be22..1cfb5b5 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h @@ -30,7 +30,7 @@ class NativeTabContentsContainerWin : public NativeTabContentsContainer, virtual void OnFocus() OVERRIDE; virtual void RequestFocus() OVERRIDE; virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; private: TabContentsContainer* container_; diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc index 7170163..9de15da 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc @@ -12,7 +12,6 @@ #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/tab_contents.h" -#include "ui/base/accessibility/accessible_view_state.h" //////////////////////////////////////////////////////////////////////////////// @@ -44,8 +43,8 @@ void TabContentsContainer::Observe(NotificationType type, //////////////////////////////////////////////////////////////////////////////// // TabContentsContainer, View overrides: -void TabContentsContainer::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_WINDOW; +AccessibilityTypes::Role TabContentsContainer::GetAccessibleRole() { + return AccessibilityTypes::ROLE_WINDOW; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container_native.h b/chrome/browser/ui/views/tab_contents/tab_contents_container_native.h index 94ab8bb..a845464 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container_native.h +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container_native.h @@ -44,16 +44,16 @@ class TabContentsContainer : public views::View, // Overridden from NotificationObserver: virtual void Observe(NotificationType type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const NotificationDetails& details); // Overridden from views::View: - virtual void Layout() OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual void Layout(); + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: // Overridden from views::View: virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child) OVERRIDE; + views::View* child); private: // Add or remove observers for events that we care about. diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container_views.h b/chrome/browser/ui/views/tab_contents/tab_contents_container_views.h index 7330f30..d5a79aa 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container_views.h +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container_views.h @@ -43,9 +43,9 @@ class TabContentsContainer : public views::View, // Overridden from NotificationObserver: virtual void Observe(NotificationType type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const NotificationDetails& details); - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); private: // Add or remove observers for events that we care about. diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc index e4a2643..9c99e47 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -9,15 +9,14 @@ #include "base/command_line.h" #include "base/utf_string_conversions.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/tabs/tab_controller.h" +#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_switches.h" #include "content/browser/tab_contents/tab_contents.h" #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/animation/throb_animation.h" #include "ui/base/l10n/l10n_util.h" @@ -213,6 +212,9 @@ void BaseTab::SetData(const TabRendererData& data) { ResetCrashedFavIcon(); } + // Sets the accessible name for the tab. + SetAccessibleName(data_.title); + DataChanged(old); Layout(); @@ -346,12 +348,11 @@ bool BaseTab::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { return false; } -void BaseTab::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_PAGETAB; - state->name = data_.title; +AccessibilityTypes::Role BaseTab::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PAGETAB; } -ui::ThemeProvider* BaseTab::GetThemeProvider() const { +ui::ThemeProvider* BaseTab::GetThemeProvider() { ui::ThemeProvider* tp = View::GetThemeProvider(); return tp ? tp : theme_provider_; } diff --git a/chrome/browser/ui/views/tabs/base_tab.h b/chrome/browser/ui/views/tabs/base_tab.h index 75d34fc..8a43f06 100644 --- a/chrome/browser/ui/views/tabs/base_tab.h +++ b/chrome/browser/ui/views/tabs/base_tab.h @@ -83,16 +83,15 @@ class BaseTab : public ui::AnimationDelegate, bool IsCloseable() const; // views::View overrides: - virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; - virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; + virtual void OnMouseEntered(const views::MouseEvent& event); + virtual void OnMouseExited(const views::MouseEvent& event); + virtual bool OnMousePressed(const views::MouseEvent& event); + virtual bool OnMouseDragged(const views::MouseEvent& event); virtual void OnMouseReleased(const views::MouseEvent& event, - bool canceled) OVERRIDE; - virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip) - OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual ThemeProvider* GetThemeProvider() const OVERRIDE; + bool canceled); + virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual ThemeProvider* GetThemeProvider(); protected: // Invoked from SetData after |data_| has been updated to the new data. @@ -120,18 +119,18 @@ class BaseTab : public ui::AnimationDelegate, void PaintTitle(gfx::Canvas* canvas, SkColor title_color); // Overridden from AnimationDelegate: - virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; - virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; - virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationCanceled(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, - const views::Event& event) OVERRIDE; + const views::Event& event); // views::ContextMenuController overrides: virtual void ShowContextMenu(views::View* source, const gfx::Point& p, - bool is_mouse_gesture) OVERRIDE; + bool is_mouse_gesture); // Returns the bounds of the title and icon. virtual const gfx::Rect& GetTitleBounds() const = 0; diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index e316db6..059c7e5 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -16,7 +16,6 @@ #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/animation_container.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/l10n/l10n_util.h" @@ -364,9 +363,8 @@ int TabStrip::OnPerformDrop(const DropTargetEvent& event) { return GetDropEffect(event); } -void TabStrip::GetAccessibleState(ui::AccessibleViewState* state) { - state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_TABSTRIP); - state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST; +AccessibilityTypes::Role TabStrip::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PAGETABLIST; } views::View* TabStrip::GetEventHandlerForPoint(const gfx::Point& point) { diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h index 45cdf45..7f0a339 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h @@ -56,30 +56,29 @@ class TabStrip : public BaseTabStrip, virtual void MouseMovedOutOfView(); // BaseTabStrip implementation: - virtual void SetBackgroundOffset(const gfx::Point& offset) OVERRIDE; - virtual bool IsPositionInWindowCaption(const gfx::Point& point) OVERRIDE; - virtual void PrepareForCloseAt(int model_index) OVERRIDE; - virtual void RemoveTabAt(int model_index) OVERRIDE; - virtual void SelectTabAt(int old_model_index, int new_model_index) OVERRIDE; - virtual void TabTitleChangedNotLoading(int model_index) OVERRIDE; - virtual void StartHighlight(int model_index) OVERRIDE; - virtual void StopAllHighlighting() OVERRIDE; - virtual BaseTab* CreateTabForDragging() OVERRIDE; + virtual void SetBackgroundOffset(const gfx::Point& offset); + virtual bool IsPositionInWindowCaption(const gfx::Point& point); + virtual void PrepareForCloseAt(int model_index); + virtual void RemoveTabAt(int model_index); + virtual void SelectTabAt(int old_model_index, int new_model_index); + virtual void TabTitleChangedNotLoading(int model_index); + virtual void StartHighlight(int model_index); + virtual void StopAllHighlighting(); + virtual BaseTab* CreateTabForDragging(); // views::View overrides: - virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; - virtual const views::View* GetViewByID(int id) const OVERRIDE; - virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual void PaintChildren(gfx::Canvas* canvas); + virtual const views::View* GetViewByID(int id) const; + virtual gfx::Size GetPreferredSize(); // NOTE: the drag and drop methods are invoked from FrameView. This is done to // allow for a drop region that extends outside the bounds of the TabStrip. - virtual void OnDragEntered(const views::DropTargetEvent& event) OVERRIDE; - virtual int OnDragUpdated(const views::DropTargetEvent& event) OVERRIDE; - virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual views::View* GetEventHandlerForPoint(const gfx::Point& point) - OVERRIDE; - virtual void OnThemeChanged() OVERRIDE; + virtual void OnDragEntered(const views::DropTargetEvent& event); + virtual int OnDragUpdated(const views::DropTargetEvent& event); + virtual void OnDragExited(); + virtual int OnPerformDrop(const views::DropTargetEvent& event); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual views::View* GetEventHandlerForPoint(const gfx::Point& point); + virtual void OnThemeChanged(); protected: // BaseTabStrip overrides: diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index cff8fe1..1eb475a 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -25,7 +25,6 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" @@ -307,9 +306,8 @@ bool ToolbarView::SetPaneFocus( return true; } -void ToolbarView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_TOOLBAR; - state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR); +AccessibilityTypes::Role ToolbarView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_TOOLBAR; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h index 42d803a..1aa143c 100644 --- a/chrome/browser/ui/views/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar_view.h @@ -78,8 +78,6 @@ class ToolbarView : public AccessiblePaneView, // Remove a menu listener. void RemoveMenuListener(views::MenuListener* listener); - virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel); - // Accessors... Browser* browser() const { return browser_; } BrowserActionsContainer* browser_actions() const { return browser_actions_; } @@ -88,44 +86,46 @@ class ToolbarView : public AccessiblePaneView, views::MenuButton* app_menu() const { return app_menu_; } // Overridden from AccessiblePaneView - virtual bool SetPaneFocus(int view_storage_id, View* initial_focus) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual bool SetPaneFocus(int view_storage_id, View* initial_focus); + virtual AccessibilityTypes::Role GetAccessibleRole(); + + // Overridden from Menu::Delegate: + virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel); // Overridden from views::MenuDelegate: - virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; + virtual void RunMenu(views::View* source, const gfx::Point& pt); // Overridden from LocationBarView::Delegate: - virtual TabContentsWrapper* GetTabContentsWrapper() OVERRIDE; - virtual InstantController* GetInstant() OVERRIDE; - virtual void OnInputInProgress(bool in_progress) OVERRIDE; + virtual TabContentsWrapper* GetTabContentsWrapper(); + virtual InstantController* GetInstant(); + virtual void OnInputInProgress(bool in_progress); // Overridden from CommandUpdater::CommandObserver: - virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; + virtual void EnabledStateChangedForCommand(int id, bool enabled); // Overridden from views::BaseButton::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event) - OVERRIDE; + virtual void ButtonPressed(views::Button* sender, const views::Event& event); // Overridden from NotificationObserver: virtual void Observe(NotificationType type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const NotificationDetails& details); // Overridden from ui::AcceleratorProvider: - virtual bool GetAcceleratorForCommandId( - int command_id, ui::Accelerator* accelerator) OVERRIDE; + virtual bool GetAcceleratorForCommandId(int command_id, + ui::Accelerator* accelerator); // Overridden from views::View: - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize(); + virtual void Layout(); + virtual void OnPaint(gfx::Canvas* canvas); virtual bool GetDropFormats( int* formats, - std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; - virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; - virtual int OnDragUpdated(const views::DropTargetEvent& event) OVERRIDE; - virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE; - virtual void OnThemeChanged() OVERRIDE; + std::set<OSExchangeData::CustomFormat>* custom_formats); + virtual bool CanDrop(const ui::OSExchangeData& data); + virtual int OnDragUpdated(const views::DropTargetEvent& event); + virtual int OnPerformDrop(const views::DropTargetEvent& event); + virtual void OnThemeChanged(); // The apparent horizontal space between most items, and the vertical padding // above and below them. @@ -137,8 +137,8 @@ class ToolbarView : public AccessiblePaneView, protected: // Overridden from AccessiblePaneView - virtual views::View* GetDefaultFocusableChild() OVERRIDE; - virtual void RemovePaneFocus() OVERRIDE; + virtual views::View* GetDefaultFocusableChild(); + virtual void RemovePaneFocus(); private: // Returns true if we should show the upgrade recommended dot. diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc index f983fb9..2720aca 100644 --- a/chrome/browser/ui/views/wrench_menu.cc +++ b/chrome/browser/ui/views/wrench_menu.cc @@ -570,6 +570,7 @@ WrenchMenu::WrenchMenu(Browser* browser) void WrenchMenu::Init(ui::MenuModel* model) { DCHECK(!root_.get()); root_.reset(new MenuItemView(this)); + root_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_APP)); root_->set_has_icons(true); // We have checks, radios and icons, set this // so we get the taller menu style. int next_id = 1; diff --git a/ui/base/accessibility/accessible_view_state.h b/ui/base/accessibility/accessible_view_state.h deleted file mode 100644 index 2f36a4b..0000000 --- a/ui/base/accessibility/accessible_view_state.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_BASE_ACCESSIBILITY_ACCESSIBLE_VIEW_STATE_H_ -#define UI_BASE_ACCESSIBILITY_ACCESSIBLE_VIEW_STATE_H_ -#pragma once - -#include "base/basictypes.h" -#include "base/string16.h" -#include "ui/base/accessibility/accessibility_types.h" - -namespace ui { - -//////////////////////////////////////////////////////////////////////////////// -// -// AccessibleViewState -// -// A cross-platform struct for storing the core accessibility information -// that should be provided about any UI view to assistive technology (AT). -// -//////////////////////////////////////////////////////////////////////////////// -struct AccessibleViewState { - public: - AccessibleViewState() - : role(AccessibilityTypes::ROLE_CLIENT), - state(0), - selection_start(-1), - selection_end(-1), - index(-1), - count(-1) { } - - // The view's role, like button or list box. - AccessibilityTypes::Role role; - - // The view's state, a bitmask containing fields such as checked - // (for a checkbox) and protected (for a password text box). - AccessibilityTypes::State state; - - // The view's name / label. - string16 name; - - // The view's value, for example the text content. - string16 value; - - // The name of the default action if the user clicks on this view. - string16 default_action; - - // The keyboard shortcut to activate this view, if any. - string16 keyboard_shortcut; - - // The selection start and end. Only applies to views with text content, - // such as a text box or combo box; start and end should be -1 otherwise. - int selection_start; - int selection_end; - - // The selected item's index and the count of the number of items. - // Only applies to views with multiple choices like a listbox; both - // index and count should be -1 otherwise. - int index; - int count; -}; - -} // namespace ui - -#endif // UI_BASE_ACCESSIBILITY_ACCESSIBLE_VIEW_STATE_H_ diff --git a/ui/base/ui_base.gypi b/ui/base/ui_base.gypi index cd66942..72bf8c1 100644 --- a/ui/base/ui_base.gypi +++ b/ui/base/ui_base.gypi @@ -57,8 +57,6 @@ '../third_party/icu/icu.gyp:icuuc', ], 'sources': [ - 'accessibility/accessibility_types.h', - 'accessibility/accessible_view_state.h', 'animation/animation.cc', 'animation/animation.h', 'animation/animation_container.cc', diff --git a/ui/base/accessibility/accessibility_types.h b/views/accessibility/accessibility_types.h index 62f3255..e55996e 100644 --- a/ui/base/accessibility/accessibility_types.h +++ b/views/accessibility/accessibility_types.h @@ -2,20 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_BASE_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_ -#define UI_BASE_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_ +#ifndef VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_ +#define VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_ #pragma once #include "base/basictypes.h" -namespace ui { - //////////////////////////////////////////////////////////////////////////////// // // AccessibilityTypes // -// Provides enumerations used to preserve platform-independence in -// accessibility functions. +// Provides enumerations used to preserve platform-independence in accessibility +// functions used in various Views, both in Browser\Views and Views. // //////////////////////////////////////////////////////////////////////////////// class AccessibilityTypes { @@ -103,6 +101,4 @@ class AccessibilityTypes { ~AccessibilityTypes() {} }; -} // namespace ui - -#endif // UI_BASE_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_ +#endif // VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_ diff --git a/views/accessibility/native_view_accessibility_win.cc b/views/accessibility/view_accessibility.cc index 07a459e..ae9f889 100644 --- a/views/accessibility/native_view_accessibility_win.cc +++ b/views/accessibility/view_accessibility.cc @@ -1,36 +1,28 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "views/accessibility/native_view_accessibility_win.h" +#include "views/accessibility/view_accessibility.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/view_prop.h" #include "views/controls/button/native_button.h" #include "views/widget/widget.h" #include "views/widget/widget_win.h" -using ui::AccessibilityTypes; - -namespace views { - const char kViewsNativeHostPropForAccessibility[] = "Views_NativeViewHostHWNDForAccessibility"; // static -scoped_refptr<NativeViewAccessibilityWin> NativeViewAccessibilityWin::Create( - views::View* view) { - CComObject<NativeViewAccessibilityWin>* instance = NULL; - HRESULT hr = CComObject<NativeViewAccessibilityWin>::CreateInstance( - &instance); +scoped_refptr<ViewAccessibility> ViewAccessibility::Create(views::View* view) { + CComObject<ViewAccessibility>* instance = NULL; + HRESULT hr = CComObject<ViewAccessibility>::CreateInstance(&instance); DCHECK(SUCCEEDED(hr)); instance->set_view(view); - return scoped_refptr<NativeViewAccessibilityWin>(instance); + return scoped_refptr<ViewAccessibility>(instance); } // static -IAccessible* NativeViewAccessibilityWin::GetAccessibleForView( - views::View* view) { +IAccessible* ViewAccessibility::GetAccessibleForView(views::View* view) { IAccessible* accessible = NULL; // First, check to see if the view is a native view. @@ -51,18 +43,18 @@ IAccessible* NativeViewAccessibilityWin::GetAccessibleForView( } } - // Finally, use our NativeViewAccessibilityWin implementation. - return view->GetNativeViewAccessibilityWin(); + // Finally, use our ViewAccessibility implementation. + return view->GetViewAccessibility(); } -NativeViewAccessibilityWin::NativeViewAccessibilityWin() : view_(NULL) { +ViewAccessibility::ViewAccessibility() : view_(NULL) { } -NativeViewAccessibilityWin::~NativeViewAccessibilityWin() { +ViewAccessibility::~ViewAccessibility() { } // TODO(ctguil): Handle case where child View is not contained by parent. -STDMETHODIMP NativeViewAccessibilityWin::accHitTest( +STDMETHODIMP ViewAccessibility::accHitTest( LONG x_left, LONG y_top, VARIANT* child) { if (!child) return E_INVALIDARG; @@ -92,7 +84,7 @@ STDMETHODIMP NativeViewAccessibilityWin::accHitTest( return S_OK; } -HRESULT NativeViewAccessibilityWin::accDoDefaultAction(VARIANT var_id) { +HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) { if (!IsValidId(var_id)) return E_INVALIDARG; @@ -108,7 +100,7 @@ HRESULT NativeViewAccessibilityWin::accDoDefaultAction(VARIANT var_id) { return DISP_E_MEMBERNOTFOUND; } -STDMETHODIMP NativeViewAccessibilityWin::accLocation( +STDMETHODIMP ViewAccessibility::accLocation( LONG* x_left, LONG* y_top, LONG* width, LONG* height, VARIANT var_id) { if (!IsValidId(var_id) || !x_left || !y_top || !width || !height) return E_INVALIDARG; @@ -120,8 +112,8 @@ STDMETHODIMP NativeViewAccessibilityWin::accLocation( *width = view_->width(); *height = view_->height(); gfx::Point topleft(view_->bounds().origin()); - views::View::ConvertPointToScreen( - view_->parent() ? view_->parent() : view_, &topleft); + views::View::ConvertPointToScreen(view_->parent() ? view_->parent() : view_, + &topleft); *x_left = topleft.x(); *y_top = topleft.y(); } else { @@ -130,8 +122,8 @@ STDMETHODIMP NativeViewAccessibilityWin::accLocation( return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::accNavigate( - LONG nav_dir, VARIANT start, VARIANT* end) { +STDMETHODIMP ViewAccessibility::accNavigate(LONG nav_dir, VARIANT start, + VARIANT* end) { if (start.vt != VT_I4 || !end) return E_INVALIDARG; @@ -231,7 +223,7 @@ STDMETHODIMP NativeViewAccessibilityWin::accNavigate( return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accChild(VARIANT var_child, +STDMETHODIMP ViewAccessibility::get_accChild(VARIANT var_child, IDispatch** disp_child) { if (var_child.vt != VT_I4 || !disp_child) return E_INVALIDARG; @@ -274,7 +266,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accChild(VARIANT var_child, return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accChildCount(LONG* child_count) { +STDMETHODIMP ViewAccessibility::get_accChildCount(LONG* child_count) { if (!child_count || !view_) return E_INVALIDARG; @@ -285,7 +277,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accChildCount(LONG* child_count) { return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accDefaultAction( +STDMETHODIMP ViewAccessibility::get_accDefaultAction( VARIANT var_id, BSTR* def_action) { if (!IsValidId(var_id) || !def_action) return E_INVALIDARG; @@ -293,9 +285,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accDefaultAction( if (!view_) return E_FAIL; - ui::AccessibleViewState state; - view_->GetAccessibleState(&state); - string16 temp_action = state.default_action; + string16 temp_action = view_->GetAccessibleDefaultAction(); if (!temp_action.empty()) { *def_action = SysAllocString(temp_action.c_str()); @@ -306,8 +296,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accDefaultAction( return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accDescription( - VARIANT var_id, BSTR* desc) { +STDMETHODIMP ViewAccessibility::get_accDescription(VARIANT var_id, BSTR* desc) { if (!IsValidId(var_id) || !desc) return E_INVALIDARG; @@ -326,7 +315,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accDescription( return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accFocus(VARIANT* focus_child) { +STDMETHODIMP ViewAccessibility::get_accFocus(VARIANT* focus_child) { if (!focus_child) return E_INVALIDARG; @@ -353,7 +342,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accFocus(VARIANT* focus_child) { return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accKeyboardShortcut( +STDMETHODIMP ViewAccessibility::get_accKeyboardShortcut( VARIANT var_id, BSTR* acc_key) { if (!IsValidId(var_id) || !acc_key) return E_INVALIDARG; @@ -361,9 +350,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accKeyboardShortcut( if (!view_) return E_FAIL; - ui::AccessibleViewState state; - view_->GetAccessibleState(&state); - string16 temp_key = state.keyboard_shortcut; + string16 temp_key = view_->GetAccessibleKeyboardShortcut(); if (!temp_key.empty()) { *acc_key = SysAllocString(temp_key.c_str()); @@ -374,18 +361,17 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accKeyboardShortcut( return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accName( - VARIANT var_id, BSTR* name) { +STDMETHODIMP ViewAccessibility::get_accName(VARIANT var_id, BSTR* name) { if (!IsValidId(var_id) || !name) return E_INVALIDARG; if (!view_) return E_FAIL; + string16 temp_name; + // Retrieve the current view's name. - ui::AccessibleViewState state; - view_->GetAccessibleState(&state); - string16 temp_name = state.name; + view_->GetAccessibleName(&temp_name); if (!temp_name.empty()) { // Return name retrieved. *name = SysAllocString(temp_name.c_str()); @@ -397,8 +383,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accName( return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accParent( - IDispatch** disp_parent) { +STDMETHODIMP ViewAccessibility::get_accParent(IDispatch** disp_parent) { if (!disp_parent) return E_INVALIDARG; @@ -415,9 +400,9 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accParent( return S_FALSE; } - // For a View that has no parent (e.g. root), point the accessible parent - // to the default implementation, to interface with Windows' hierarchy - // and to support calls from e.g. WindowFromAccessibleObject. + // For a View that has no parent (e.g. root), point the accessible parent to + // the default implementation, to interface with Windows' hierarchy and to + // support calls from e.g. WindowFromAccessibleObject. HRESULT hr = ::AccessibleObjectFromWindow(view_->GetWidget()->GetNativeView(), OBJID_WINDOW, IID_IAccessible, @@ -436,23 +421,19 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accParent( return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accRole( - VARIANT var_id, VARIANT* role) { +STDMETHODIMP ViewAccessibility::get_accRole(VARIANT var_id, VARIANT* role) { if (!IsValidId(var_id) || !role) return E_INVALIDARG; if (!view_) return E_FAIL; - ui::AccessibleViewState state; - view_->GetAccessibleState(&state); role->vt = VT_I4; - role->lVal = MSAARole(state.role); + role->lVal = MSAARole(view_->GetAccessibleRole()); return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accState( - VARIANT var_id, VARIANT* state) { +STDMETHODIMP ViewAccessibility::get_accState(VARIANT var_id, VARIANT* state) { if (!IsValidId(var_id) || !state) return E_INVALIDARG; @@ -471,8 +452,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accState( return S_OK; } -STDMETHODIMP NativeViewAccessibilityWin::get_accValue( - VARIANT var_id, BSTR* value) { +STDMETHODIMP ViewAccessibility::get_accValue(VARIANT var_id, BSTR* value) { if (!IsValidId(var_id) || !value) return E_INVALIDARG; @@ -480,9 +460,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accValue( return E_FAIL; // Retrieve the current view's value. - ui::AccessibleViewState state; - view_->GetAccessibleState(&state); - string16 temp_value = state.value; + string16 temp_value = view_->GetAccessibleValue(); if (!temp_value.empty()) { // Return value retrieved. @@ -498,7 +476,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accValue( // Helper functions. -bool NativeViewAccessibilityWin::IsNavDirNext(int nav_dir) const { +bool ViewAccessibility::IsNavDirNext(int nav_dir) const { if (nav_dir == NAVDIR_RIGHT || nav_dir == NAVDIR_DOWN || nav_dir == NAVDIR_NEXT) { return true; @@ -506,8 +484,8 @@ bool NativeViewAccessibilityWin::IsNavDirNext(int nav_dir) const { return false; } -bool NativeViewAccessibilityWin::IsValidNav( - int nav_dir, int start_id, int lower_bound, int upper_bound) const { +bool ViewAccessibility::IsValidNav(int nav_dir, int start_id, int lower_bound, + int upper_bound) const { if (IsNavDirNext(nav_dir)) { if ((start_id + 1) > upper_bound) { return false; @@ -520,14 +498,13 @@ bool NativeViewAccessibilityWin::IsValidNav( return true; } -bool NativeViewAccessibilityWin::IsValidId(const VARIANT& child) const { +bool ViewAccessibility::IsValidId(const VARIANT& child) const { // View accessibility returns an IAccessible for each view so we only support // the CHILDID_SELF id. return (VT_I4 == child.vt) && (CHILDID_SELF == child.lVal); } -void NativeViewAccessibilityWin::SetState( - VARIANT* msaa_state, views::View* view) { +void ViewAccessibility::SetState(VARIANT* msaa_state, views::View* view) { // Ensure the output param is initialized to zero. msaa_state->lVal = 0; @@ -547,32 +524,28 @@ void NativeViewAccessibilityWin::SetState( msaa_state->lVal |= STATE_SYSTEM_FOCUSED; // Add on any view-specific states. - ui::AccessibleViewState view_state; - view->GetAccessibleState(&view_state); - msaa_state->lVal |= MSAAState(view_state.state); + msaa_state->lVal |= MSAAState(view->GetAccessibleState()); } // IAccessible functions not supported. -STDMETHODIMP NativeViewAccessibilityWin::get_accSelection(VARIANT* selected) { +STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) { if (selected) selected->vt = VT_EMPTY; return E_NOTIMPL; } -STDMETHODIMP NativeViewAccessibilityWin::accSelect( - LONG flagsSelect, VARIANT var_id) { +STDMETHODIMP ViewAccessibility::accSelect(LONG flagsSelect, VARIANT var_id) { return E_NOTIMPL; } -STDMETHODIMP NativeViewAccessibilityWin::get_accHelp( - VARIANT var_id, BSTR* help) { +STDMETHODIMP ViewAccessibility::get_accHelp(VARIANT var_id, BSTR* help) { if (help) *help = NULL; return E_NOTIMPL; } -STDMETHODIMP NativeViewAccessibilityWin::get_accHelpTopic( +STDMETHODIMP ViewAccessibility::get_accHelpTopic( BSTR* help_file, VARIANT var_id, LONG* topic_id) { if (help_file) { *help_file = NULL; @@ -583,19 +556,17 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accHelpTopic( return E_NOTIMPL; } -STDMETHODIMP NativeViewAccessibilityWin::put_accName( - VARIANT var_id, BSTR put_name) { +STDMETHODIMP ViewAccessibility::put_accName(VARIANT var_id, BSTR put_name) { // Deprecated. return E_NOTIMPL; } -STDMETHODIMP NativeViewAccessibilityWin::put_accValue( - VARIANT var_id, BSTR put_val) { +STDMETHODIMP ViewAccessibility::put_accValue(VARIANT var_id, BSTR put_val) { // Deprecated. return E_NOTIMPL; } -int32 NativeViewAccessibilityWin::MSAAEvent(AccessibilityTypes::Event event) { +int32 ViewAccessibility::MSAAEvent(AccessibilityTypes::Event event) { switch (event) { case AccessibilityTypes::EVENT_ALERT: return EVENT_SYSTEM_ALERT; @@ -624,7 +595,7 @@ int32 NativeViewAccessibilityWin::MSAAEvent(AccessibilityTypes::Event event) { } } -int32 NativeViewAccessibilityWin::MSAARole(AccessibilityTypes::Role role) { +int32 ViewAccessibility::MSAARole(AccessibilityTypes::Role role) { switch (role) { case AccessibilityTypes::ROLE_ALERT: return ROLE_SYSTEM_ALERT; @@ -689,7 +660,7 @@ return ROLE_SYSTEM_ALERT; } } -int32 NativeViewAccessibilityWin::MSAAState(AccessibilityTypes::State state) { +int32 ViewAccessibility::MSAAState(AccessibilityTypes::State state) { int32 msaa_state = 0; if (state & AccessibilityTypes::STATE_CHECKED) msaa_state |= STATE_SYSTEM_CHECKED; @@ -725,7 +696,7 @@ int32 NativeViewAccessibilityWin::MSAAState(AccessibilityTypes::State state) { } // static -HRESULT NativeViewAccessibilityWin::GetNativeIAccessibleInterface( +HRESULT ViewAccessibility::GetNativeIAccessibleInterface( views::NativeViewHost* native_host, IAccessible** accessible) { if (!native_host || !accessible) return E_INVALIDARG; @@ -741,7 +712,7 @@ HRESULT NativeViewAccessibilityWin::GetNativeIAccessibleInterface( } // static -HRESULT NativeViewAccessibilityWin::GetNativeIAccessibleInterface( +HRESULT ViewAccessibility::GetNativeIAccessibleInterface( HWND native_view_window , IAccessible** accessible) { if (IsWindow(native_view_window)) { LRESULT ret = SendMessage(native_view_window, WM_GETOBJECT, 0, @@ -752,5 +723,3 @@ HRESULT NativeViewAccessibilityWin::GetNativeIAccessibleInterface( return E_FAIL; } - -} // namespace views diff --git a/views/accessibility/native_view_accessibility_win.h b/views/accessibility/view_accessibility.h index 2e947e1..9e2d7b8 100644 --- a/views/accessibility/native_view_accessibility_win.h +++ b/views/accessibility/view_accessibility.h @@ -1,9 +1,9 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ -#define VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ +#ifndef VIEWS_ACCESSIBILITY_VIEW_ACCESSIBILITY_H_ +#define VIEWS_ACCESSIBILITY_VIEW_ACCESSIBILITY_H_ #pragma once #include <atlbase.h> @@ -12,37 +12,34 @@ #include <oleacc.h> #include "base/scoped_ptr.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/controls/native/native_view_host.h" #include "views/view.h" -namespace views { - //////////////////////////////////////////////////////////////////////////////// // -// NativeViewAccessibilityWin +// ViewAccessibility // // Class implementing the MSAA IAccessible COM interface for a generic View, // providing accessibility to be used by screen readers and other assistive // technology (AT). // //////////////////////////////////////////////////////////////////////////////// -class ATL_NO_VTABLE NativeViewAccessibilityWin +class ATL_NO_VTABLE ViewAccessibility : public CComObjectRootEx<CComMultiThreadModel>, public IDispatchImpl<IAccessible, &IID_IAccessible, &LIBID_Accessibility> { public: - BEGIN_COM_MAP(NativeViewAccessibilityWin) + BEGIN_COM_MAP(ViewAccessibility) COM_INTERFACE_ENTRY2(IDispatch, IAccessible) COM_INTERFACE_ENTRY(IAccessible) END_COM_MAP() // Create method for view accessibility. - static scoped_refptr<NativeViewAccessibilityWin> Create(views::View* view); + static scoped_refptr<ViewAccessibility> Create(views::View* view); // Returns the IAccessible interface for a view. static IAccessible* GetAccessibleForView(views::View* view); - virtual ~NativeViewAccessibilityWin(); + virtual ~ViewAccessibility(); void set_view(views::View* view) { view_ = view; } @@ -115,18 +112,18 @@ class ATL_NO_VTABLE NativeViewAccessibilityWin // Returns a conversion from the event (as defined in accessibility_types.h) // to an MSAA event. - static int32 MSAAEvent(ui::AccessibilityTypes::Event event); + static int32 MSAAEvent(AccessibilityTypes::Event event); // Returns a conversion from the Role (as defined in accessibility_types.h) // to an MSAA role. - static int32 MSAARole(ui::AccessibilityTypes::Role role); + static int32 MSAARole(AccessibilityTypes::Role role); // Returns a conversion from the State (as defined in accessibility_types.h) // to MSAA states set. - static int32 MSAAState(ui::AccessibilityTypes::State state); + static int32 MSAAState(AccessibilityTypes::State state); private: - NativeViewAccessibilityWin(); + ViewAccessibility(); // Determines navigation direction for accNavigate, based on left, up and // previous being mapped all to previous and right, down, next being mapped @@ -160,11 +157,9 @@ class ATL_NO_VTABLE NativeViewAccessibilityWin // Member View needed for view-specific calls. views::View* view_; - DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibilityWin); + DISALLOW_COPY_AND_ASSIGN(ViewAccessibility); }; extern const char kViewsNativeHostPropForAccessibility[]; -} // namespace views - -#endif // VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ +#endif // VIEWS_ACCESSIBILITY_VIEW_ACCESSIBILITY_H_ diff --git a/views/controls/button/button.cc b/views/controls/button/button.cc index 6d18204..7b6cc75 100644 --- a/views/controls/button/button.cc +++ b/views/controls/button/button.cc @@ -3,9 +3,7 @@ // found in the LICENSE file. #include "views/controls/button/button.h" - #include "base/utf_string_conversions.h" -#include "ui/base/accessibility/accessible_view_state.h" namespace views { @@ -20,12 +18,8 @@ void Button::SetTooltipText(const std::wstring& tooltip_text) { TooltipTextChanged(); } -void Button::SetAccessibleName(const string16& name) { - accessible_name_ = name; -} - -void Button::SetAccessibleKeyboardShortcut(const string16& shortcut) { - accessible_shortcut_ = shortcut; +void Button::SetAccessibleKeyboardShortcut(const std::wstring& shortcut) { + accessible_shortcut_ = WideToUTF16Hack(shortcut); } //////////////////////////////////////////////////////////////////////////////// @@ -39,10 +33,12 @@ bool Button::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { return true; } -void Button::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; - state->name = accessible_name_; - state->keyboard_shortcut = accessible_shortcut_; +string16 Button::GetAccessibleKeyboardShortcut() { + return accessible_shortcut_; +} + +AccessibilityTypes::Role Button::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PUSHBUTTON; } //////////////////////////////////////////////////////////////////////////////// diff --git a/views/controls/button/button.h b/views/controls/button/button.h index 0c9c6c7..263e45f 100644 --- a/views/controls/button/button.h +++ b/views/controls/button/button.h @@ -36,13 +36,13 @@ class Button : public View { int mouse_event_flags() const { return mouse_event_flags_; } - void SetAccessibleName(const string16& name); - void SetAccessibleKeyboardShortcut(const string16& shortcut); + void SetAccessibleKeyboardShortcut(const std::wstring& shortcut); // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual string16 GetAccessibleKeyboardShortcut() OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; protected: // Construct the Button with a Listener. The listener can be NULL. This can be @@ -61,7 +61,6 @@ class Button : public View { string16 tooltip_text_; // Accessibility data. - string16 accessible_name_; string16 accessible_shortcut_; // The id tag associated with this button. Used to disambiguate buttons in diff --git a/views/controls/button/button_dropdown.cc b/views/controls/button/button_dropdown.cc index a5f7ab1..d2f69e2 100644 --- a/views/controls/button/button_dropdown.cc +++ b/views/controls/button/button_dropdown.cc @@ -8,7 +8,6 @@ #include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "grit/app_strings.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "views/controls/menu/view_menu_delegate.h" #include "views/widget/widget.h" @@ -166,11 +165,16 @@ void ButtonDropDown::ShowDropDownMenu(gfx::NativeView window) { // //////////////////////////////////////////////////////////////////////////////// -void ButtonDropDown::GetAccessibleState(ui::AccessibleViewState* state) { - CustomButton::GetAccessibleState(state); - state->role = ui::AccessibilityTypes::ROLE_BUTTONDROPDOWN; - state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); - state->state = ui::AccessibilityTypes::STATE_HASPOPUP; +string16 ButtonDropDown::GetAccessibleDefaultAction() { + return l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); +} + +AccessibilityTypes::Role ButtonDropDown::GetAccessibleRole() { + return AccessibilityTypes::ROLE_BUTTONDROPDOWN; +} + +AccessibilityTypes::State ButtonDropDown::GetAccessibleState() { + return AccessibilityTypes::STATE_HASPOPUP; } } // namespace views diff --git a/views/controls/button/button_dropdown.h b/views/controls/button/button_dropdown.h index 32f2c5c..07b8276 100644 --- a/views/controls/button/button_dropdown.h +++ b/views/controls/button/button_dropdown.h @@ -26,7 +26,9 @@ class ButtonDropDown : public ImageButton { virtual ~ButtonDropDown(); // Accessibility accessors, overridden from View. - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual string16 GetAccessibleDefaultAction() OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; + virtual AccessibilityTypes::State GetAccessibleState() OVERRIDE; private: // Overridden from CustomButton diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc index 2a34cc5..719dfd8 100644 --- a/views/controls/button/checkbox.cc +++ b/views/controls/button/checkbox.cc @@ -5,7 +5,6 @@ #include "views/controls/button/checkbox.h" #include "base/logging.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas.h" #include "views/controls/label.h" @@ -159,10 +158,12 @@ void Checkbox::OnBlur() { label_->set_paint_as_focused(false); } -void Checkbox::GetAccessibleState(ui::AccessibleViewState* state) { - Button::GetAccessibleState(state); - state->role = ui::AccessibilityTypes::ROLE_CHECKBUTTON; - state->state = checked() ? ui::AccessibilityTypes::STATE_CHECKED : 0; +AccessibilityTypes::Role Checkbox::GetAccessibleRole() { + return AccessibilityTypes::ROLE_CHECKBUTTON; +} + +AccessibilityTypes::State Checkbox::GetAccessibleState() { + return checked() ? AccessibilityTypes::STATE_CHECKED : 0; } std::string Checkbox::GetClassName() const { diff --git a/views/controls/button/checkbox.h b/views/controls/button/checkbox.h index 801b0fd..71d218d 100644 --- a/views/controls/button/checkbox.h +++ b/views/controls/button/checkbox.h @@ -57,7 +57,8 @@ class Checkbox : public NativeButton { virtual void OnBlur() OVERRIDE; // Accessibility accessors, overridden from View. - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; + virtual AccessibilityTypes::State GetAccessibleState() OVERRIDE; // Overridden from NativeButton: virtual void SetLabel(const std::wstring& label) OVERRIDE; diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc index fc349a2..1696d14 100644 --- a/views/controls/button/custom_button.cc +++ b/views/controls/button/custom_button.cc @@ -4,11 +4,9 @@ #include "views/controls/button/custom_button.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/throb_animation.h" #include "ui/base/keycodes/keyboard_codes.h" #include "views/screen.h" -#include "views/widget/widget.h" namespace views { @@ -59,23 +57,24 @@ void CustomButton::SetAnimationDuration(int duration) { //////////////////////////////////////////////////////////////////////////////// // CustomButton, View overrides: -void CustomButton::GetAccessibleState(ui::AccessibleViewState* state) { - Button::GetAccessibleState(state); +AccessibilityTypes::State CustomButton::GetAccessibleState() { + int state = 0; switch (state_) { case BS_HOT: - state->state = ui::AccessibilityTypes::STATE_HOTTRACKED; + state = AccessibilityTypes::STATE_HOTTRACKED; break; case BS_PUSHED: - state->state = ui::AccessibilityTypes::STATE_PRESSED; + state = AccessibilityTypes::STATE_PRESSED; break; case BS_DISABLED: - state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; + state = AccessibilityTypes::STATE_UNAVAILABLE; break; case BS_NORMAL: case BS_COUNT: // No additional accessibility state set for this button state. break; } + return state; } void CustomButton::SetEnabled(bool enabled) { @@ -249,10 +248,8 @@ void CustomButton::SetHotTracked(bool flag) { if (state_ != BS_DISABLED) SetState(flag ? BS_HOT : BS_NORMAL); - if (flag) { - GetWidget()->NotifyAccessibilityEvent( - this, ui::AccessibilityTypes::EVENT_FOCUS, true); - } + if (flag) + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS); } bool CustomButton::IsHotTracked() const { diff --git a/views/controls/button/custom_button.h b/views/controls/button/custom_button.h index 1a0f75e..17dafbf 100644 --- a/views/controls/button/custom_button.h +++ b/views/controls/button/custom_button.h @@ -48,7 +48,7 @@ class CustomButton : public Button, void SetAnimationDuration(int duration); // Overridden from View: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::State GetAccessibleState() OVERRIDE; virtual void SetEnabled(bool enabled) OVERRIDE; virtual bool IsEnabled() const OVERRIDE; virtual bool IsFocusable() const OVERRIDE; diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index db138bb..f88b106 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -7,7 +7,6 @@ #include "base/utf_string_conversions.h" #include "grit/app_strings.h" #include "grit/app_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -261,11 +260,16 @@ void MenuButton::OnMouseExited(const MouseEvent& event) { // //////////////////////////////////////////////////////////////////////////////// -void MenuButton::GetAccessibleState(ui::AccessibleViewState* state) { - CustomButton::GetAccessibleState(state); - state->role = ui::AccessibilityTypes::ROLE_BUTTONMENU; - state->default_action = l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); - state->state = ui::AccessibilityTypes::STATE_HASPOPUP; +string16 MenuButton::GetAccessibleDefaultAction() { + return l10n_util::GetStringUTF16(IDS_APP_ACCACTION_PRESS); +} + +AccessibilityTypes::Role MenuButton::GetAccessibleRole() { + return AccessibilityTypes::ROLE_BUTTONMENU; +} + +AccessibilityTypes::State MenuButton::GetAccessibleState() { + return AccessibilityTypes::STATE_HASPOPUP; } std::string MenuButton::GetClassName() const { diff --git a/views/controls/button/menu_button.h b/views/controls/button/menu_button.h index c6f3092..55f5a89 100644 --- a/views/controls/button/menu_button.h +++ b/views/controls/button/menu_button.h @@ -58,7 +58,9 @@ class MenuButton : public TextButton { virtual bool OnKeyReleased(const KeyEvent& e); // Accessibility accessors, overridden from View. - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual string16 GetAccessibleDefaultAction() OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; + virtual AccessibilityTypes::State GetAccessibleState() OVERRIDE; // Returns views/MenuButton. virtual std::string GetClassName() const; diff --git a/views/controls/button/native_button_win.cc b/views/controls/button/native_button_win.cc index 2783c84..fbba56a 100644 --- a/views/controls/button/native_button_win.cc +++ b/views/controls/button/native_button_win.cc @@ -11,7 +11,6 @@ #include "base/win/scoped_comptr.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/controls/button/checkbox.h" #include "views/controls/button/native_button.h" #include "views/controls/button/radio_button.h" @@ -72,19 +71,18 @@ void NativeButtonWin::UpdateDefault() { } void NativeButtonWin::UpdateAccessibleName() { - ui::AccessibleViewState state; - native_button_->GetAccessibleState(&state); - string16 name = state.name; - base::win::ScopedComPtr<IAccPropServices> pAccPropServices; - HRESULT hr = CoCreateInstance( - CLSID_AccPropServices, NULL, CLSCTX_SERVER, - IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); - if (SUCCEEDED(hr)) { - VARIANT var; - var.vt = VT_BSTR; - var.bstrVal = SysAllocString(name.c_str()); - hr = pAccPropServices->SetHwndProp(native_view(), OBJID_WINDOW, - CHILDID_SELF, PROPID_ACC_NAME, var); + string16 name; + if (native_button_->GetAccessibleName(&name)) { + base::win::ScopedComPtr<IAccPropServices> pAccPropServices; + HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, + IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); + if (SUCCEEDED(hr)) { + VARIANT var; + var.vt = VT_BSTR; + var.bstrVal = SysAllocString(name.c_str()); + hr = pAccPropServices->SetHwndProp(native_view(), OBJID_WINDOW, + CHILDID_SELF, PROPID_ACC_NAME, var); + } } } diff --git a/views/controls/button/radio_button.cc b/views/controls/button/radio_button.cc index f162f2c..4074da4 100644 --- a/views/controls/button/radio_button.cc +++ b/views/controls/button/radio_button.cc @@ -5,7 +5,6 @@ #include "views/controls/button/radio_button.h" #include "base/logging.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/widget/root_view.h" namespace views { @@ -61,9 +60,8 @@ void RadioButton::SetChecked(bool checked) { //////////////////////////////////////////////////////////////////////////////// // RadioButton, View overrides: -void RadioButton::GetAccessibleState(ui::AccessibleViewState* state) { - Checkbox::GetAccessibleState(state); - state->role = ui::AccessibilityTypes::ROLE_RADIOBUTTON; +AccessibilityTypes::Role RadioButton::GetAccessibleRole() { + return AccessibilityTypes::ROLE_RADIOBUTTON; } View* RadioButton::GetSelectedViewForGroup(int group_id) { diff --git a/views/controls/button/radio_button.h b/views/controls/button/radio_button.h index 5ff6f76..7ea35f5 100644 --- a/views/controls/button/radio_button.h +++ b/views/controls/button/radio_button.h @@ -22,18 +22,16 @@ class RadioButton : public Checkbox { virtual ~RadioButton(); // Overridden from Checkbox: - virtual void SetChecked(bool checked) OVERRIDE; + virtual void SetChecked(bool checked); // Overridden from View: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual View* GetSelectedViewForGroup(int group_id) OVERRIDE; - virtual bool IsGroupFocusTraversable() const OVERRIDE; - virtual void OnMouseReleased(const MouseEvent& event, bool canceled) - OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual View* GetSelectedViewForGroup(int group_id); + virtual bool IsGroupFocusTraversable() const; + virtual void OnMouseReleased(const MouseEvent& event, bool canceled); protected: - // Overridden from View: - virtual std::string GetClassName() const OVERRIDE; + virtual std::string GetClassName() const; // Overridden from NativeButton: virtual NativeButtonWrapper* CreateWrapper(); diff --git a/views/controls/combobox/combobox.cc b/views/controls/combobox/combobox.cc index 2f77942..be7d719 100644 --- a/views/controls/combobox/combobox.cc +++ b/views/controls/combobox/combobox.cc @@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/models/combobox_model.h" #include "views/controls/combobox/native_combobox_wrapper.h" @@ -53,10 +52,6 @@ void Combobox::SelectionChanged() { listener_->ItemChanged(this, prev_selected_item, selected_item_); } -void Combobox::SetAccessibleName(const string16& name) { - accessible_name_ = name; -} - //////////////////////////////////////////////////////////////////////////////// // Combobox, View overrides: @@ -94,10 +89,12 @@ void Combobox::OnPaintFocusBorder(gfx::Canvas* canvas) { View::OnPaintFocusBorder(canvas); } -void Combobox::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_COMBOBOX; - state->name = accessible_name_; - state->value = model_->GetItemAt(selected_item_); +AccessibilityTypes::Role Combobox::GetAccessibleRole() { + return AccessibilityTypes::ROLE_COMBOBOX; +} + +string16 Combobox::GetAccessibleValue() { + return model_->GetItemAt(selected_item_); } void Combobox::OnFocus() { diff --git a/views/controls/combobox/combobox.h b/views/controls/combobox/combobox.h index c50fadd..1de06d6 100644 --- a/views/controls/combobox/combobox.h +++ b/views/controls/combobox/combobox.h @@ -58,23 +58,20 @@ class Combobox : public View { // Accessor for |model_|. ComboboxModel* model() const { return model_; } - // Set the accessible name of the combo box. - void SetAccessibleName(const string16& name); - // Overridden from View: - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void SetEnabled(bool enabled) OVERRIDE; - virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e) OVERRIDE; - virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize(); + virtual void Layout(); + virtual void SetEnabled(bool enabled); + virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); + virtual void OnPaintFocusBorder(gfx::Canvas* canvas); + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; + virtual string16 GetAccessibleValue() OVERRIDE; protected: - // Overridden from View: - virtual void OnFocus() OVERRIDE; + virtual void OnFocus(); virtual void ViewHierarchyChanged(bool is_add, View* parent, - View* child) OVERRIDE; - virtual std::string GetClassName() const OVERRIDE; + View* child); + virtual std::string GetClassName() const; // The object that actually implements the native combobox. NativeComboboxWrapper* native_wrapper_; @@ -89,9 +86,6 @@ class Combobox : public View { // The current selection. int selected_item_; - // The accessible name of the text field. - string16 accessible_name_; - DISALLOW_COPY_AND_ASSIGN(Combobox); }; diff --git a/views/controls/image_view.cc b/views/controls/image_view.cc index bc86e55..7f05e97 100644 --- a/views/controls/image_view.cc +++ b/views/controls/image_view.cc @@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas.h" #include "ui/gfx/insets.h" @@ -127,9 +126,8 @@ void ImageView::OnPaint(gfx::Canvas* canvas) { } } -void ImageView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_GRAPHIC; - state->name = tooltip_text_; +AccessibilityTypes::Role ImageView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GRAPHIC; } void ImageView::SetHorizontalAlignment(Alignment ha) { @@ -156,6 +154,7 @@ ImageView::Alignment ImageView::GetVerticalAlignment() { void ImageView::SetTooltipText(const std::wstring& tooltip) { tooltip_text_ = WideToUTF16Hack(tooltip); + SetAccessibleName(WideToUTF16Hack(tooltip)); } std::wstring ImageView::GetTooltipText() { diff --git a/views/controls/image_view.h b/views/controls/image_view.h index cde4bfd..b1791ac 100644 --- a/views/controls/image_view.h +++ b/views/controls/image_view.h @@ -75,11 +75,10 @@ class ImageView : public View { std::wstring GetTooltipText(); // Overriden from View - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip) - OVERRIDE; + virtual gfx::Size GetPreferredSize(); + virtual void OnPaint(gfx::Canvas* canvas); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); private: // Compute the image origin given the desired size and the receiver alignment diff --git a/views/controls/label.cc b/views/controls/label.cc index 6fedc80..1b105f0 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -12,7 +12,6 @@ #include "base/string_split.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/text/text_elider.h" #include "ui/gfx/canvas_skia.h" @@ -107,6 +106,7 @@ void Label::SetText(const std::wstring& text) { text_ = WideToUTF16Hack(text); url_set_ = false; text_size_valid_ = false; + SetAccessibleName(WideToUTF16Hack(text)); PreferredSizeChanged(); SchedulePaint(); } @@ -250,10 +250,12 @@ void Label::SizeToFit(int max_width) { SizeToPreferredSize(); } -void Label::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_STATICTEXT; - state->state = ui::AccessibilityTypes::STATE_READONLY; - state->name = text_; +AccessibilityTypes::Role Label::GetAccessibleRole() { + return AccessibilityTypes::ROLE_STATICTEXT; +} + +AccessibilityTypes::State Label::GetAccessibleState() { + return AccessibilityTypes::STATE_READONLY; } void Label::SetHasFocusBorder(bool has_focus_border) { diff --git a/views/controls/label.h b/views/controls/label.h index a0ef7d2..d916659 100644 --- a/views/controls/label.h +++ b/views/controls/label.h @@ -79,7 +79,7 @@ class Label : public View { virtual void OnPaintBackground(gfx::Canvas* canvas); // Set the font. - virtual void SetFont(const gfx::Font& font); + void SetFont(const gfx::Font& font); // Set the label text. void SetText(const std::wstring& text); @@ -180,7 +180,8 @@ class Label : public View { void SizeToFit(int max_width); // Accessibility accessors, overridden from View. - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); // Gets/sets the flag to determine whether the label should be collapsed when // it's hidden (not visible). If this flag is true, the label will return a diff --git a/views/controls/label_unittest.cc b/views/controls/label_unittest.cc index a7b2ac2..6d2ba91 100644 --- a/views/controls/label_unittest.cc +++ b/views/controls/label_unittest.cc @@ -5,7 +5,6 @@ #include "base/i18n/rtl.h" #include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/canvas.h" #include "views/border.h" @@ -160,11 +159,13 @@ TEST(LabelTest, Accessibility) { string16 test_text(ASCIIToUTF16("My special text.")); label.SetText(UTF16ToWideHack(test_text)); - ui::AccessibleViewState state; - label.GetAccessibleState(&state); - EXPECT_EQ(ui::AccessibilityTypes::ROLE_STATICTEXT, state.role); - EXPECT_EQ(test_text, state.name); - EXPECT_TRUE(ui::AccessibilityTypes::STATE_READONLY & state.state); + EXPECT_EQ(AccessibilityTypes::ROLE_STATICTEXT, label.GetAccessibleRole()); + + string16 name; + EXPECT_TRUE(label.GetAccessibleName(&name)); + EXPECT_EQ(test_text, name); + + EXPECT_TRUE(AccessibilityTypes::STATE_READONLY & label.GetAccessibleState()); } TEST(LabelTest, SingleLineSizing) { diff --git a/views/controls/link.cc b/views/controls/link.cc index c6e22f1..de7512b 100644 --- a/views/controls/link.cc +++ b/views/controls/link.cc @@ -9,7 +9,6 @@ #endif #include "base/logging.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/font.h" @@ -149,9 +148,8 @@ bool Link::SkipDefaultKeyEventProcessing(const KeyEvent& e) { (e.key_code() == ui::VKEY_RETURN); } -void Link::GetAccessibleState(ui::AccessibleViewState* state) { - Label::GetAccessibleState(state); - state->role = ui::AccessibilityTypes::ROLE_LINK; +AccessibilityTypes::Role Link::GetAccessibleRole() { + return AccessibilityTypes::ROLE_LINK; } void Link::SetFont(const gfx::Font& font) { diff --git a/views/controls/link.h b/views/controls/link.h index e616317..4c9cb8f 100644 --- a/views/controls/link.h +++ b/views/controls/link.h @@ -46,16 +46,16 @@ class Link : public Label { const LinkController* GetController(); // Overridden from View: - virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; + virtual bool OnMousePressed(const MouseEvent& event); + virtual bool OnMouseDragged(const MouseEvent& event); virtual void OnMouseReleased(const MouseEvent& event, - bool canceled) OVERRIDE; - virtual bool OnKeyPressed(const KeyEvent& e) OVERRIDE; - virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e) OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + bool canceled); + virtual bool OnKeyPressed(const KeyEvent& e); + virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); - // Overridden from Label: - virtual void SetFont(const gfx::Font& font) OVERRIDE; + // Accessibility accessors, overridden from View: + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual void SetFont(const gfx::Font& font); // Set whether the link is enabled. virtual void SetEnabled(bool f); diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index 075b92e..906bd40 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -760,10 +760,8 @@ void MenuController::SetSelection(MenuItemView* menu_item, // Notify an accessibility focus event on all menu items except for the root. if (menu_item && (MenuDepth(menu_item) != 1 || - menu_item->GetType() != MenuItemView::SUBMENU)) { - menu_item->GetWidget()->NotifyAccessibilityEvent( - menu_item, ui::AccessibilityTypes::EVENT_FOCUS, true); - } + menu_item->GetType() != MenuItemView::SUBMENU)) + menu_item->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS); } // static diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc index c729c2e..ed44c3a 100644 --- a/views/controls/menu/menu_item_view.cc +++ b/views/controls/menu/menu_item_view.cc @@ -6,7 +6,6 @@ #include "base/utf_string_conversions.h" #include "grit/app_strings.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/menu_model.h" #include "ui/gfx/canvas.h" @@ -117,23 +116,27 @@ bool MenuItemView::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { return false; } -void MenuItemView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_MENUITEM; - state->name = GetAccessibleNameForMenuItem(title_, GetAcceleratorText()); +AccessibilityTypes::Role MenuItemView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_MENUITEM; +} + +AccessibilityTypes::State MenuItemView::GetAccessibleState() { + int state = 0; switch (GetType()) { case SUBMENU: - state->state |= ui::AccessibilityTypes::STATE_HASPOPUP; + state |= AccessibilityTypes::STATE_HASPOPUP; break; case CHECKBOX: case RADIO: - state->state |= GetDelegate()->IsItemChecked(GetCommand()) ? - ui::AccessibilityTypes::STATE_CHECKED : 0; + state |= GetDelegate()->IsItemChecked(GetCommand()) ? + AccessibilityTypes::STATE_CHECKED : 0; break; case NORMAL: case SEPARATOR: // No additional accessibility states currently for these menu states. break; } + return state; } // static @@ -317,6 +320,7 @@ SubmenuView* MenuItemView::CreateSubmenu() { void MenuItemView::SetTitle(const std::wstring& title) { title_ = WideToUTF16Hack(title); + SetAccessibleName(GetAccessibleNameForMenuItem(title_, GetAcceleratorText())); pref_size_.SetSize(0, 0); // Triggers preferred size recalculation. } diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h index 89eab3c..5b5e09c 100644 --- a/views/controls/menu/menu_item_view.h +++ b/views/controls/menu/menu_item_view.h @@ -93,9 +93,9 @@ class MenuItemView : public View { virtual ~MenuItemView(); // Overridden from View: - virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip) - OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); // Returns the preferred height of menu items. This is only valid when the // menu is about to be shown. diff --git a/views/controls/menu/menu_scroll_view_container.cc b/views/controls/menu/menu_scroll_view_container.cc index 7a644b1..6089838 100644 --- a/views/controls/menu/menu_scroll_view_container.cc +++ b/views/controls/menu/menu_scroll_view_container.cc @@ -10,7 +10,6 @@ #include <Vssym32.h> #endif -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/color_utils.h" #include "views/border.h" @@ -163,8 +162,7 @@ class MenuScrollViewContainer::MenuScrollView : public View { // MenuScrollViewContainer ---------------------------------------------------- -MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view) - : content_view_(content_view) { +MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view) { scroll_up_button_ = new MenuScrollButton(content_view, true); scroll_down_button_ = new MenuScrollButton(content_view, false); AddChildView(scroll_up_button_); @@ -268,16 +266,14 @@ gfx::Size MenuScrollViewContainer::GetPreferredSize() { return prefsize; } -void MenuScrollViewContainer::GetAccessibleState( - ui::AccessibleViewState* state) { - // Get the name from the submenu view. - content_view_->GetAccessibleState(state); +AccessibilityTypes::Role MenuScrollViewContainer::GetAccessibleRole() { + return AccessibilityTypes::ROLE_MENUBAR; +} - // Now change the role. - state->role = ui::AccessibilityTypes::ROLE_MENUBAR; +AccessibilityTypes::State MenuScrollViewContainer::GetAccessibleState() { // Some AT (like NVDA) will not process focus events on menu item children // unless a parent claims to be focused. - state->state = ui::AccessibilityTypes::STATE_FOCUSED; + return AccessibilityTypes::STATE_FOCUSED; } } // namespace views diff --git a/views/controls/menu/menu_scroll_view_container.h b/views/controls/menu/menu_scroll_view_container.h index 48914af..5472091 100644 --- a/views/controls/menu/menu_scroll_view_container.h +++ b/views/controls/menu/menu_scroll_view_container.h @@ -24,11 +24,12 @@ class MenuScrollViewContainer : public View { View* scroll_up_button() const { return scroll_up_button_; } // View overrides. - virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void OnBoundsChanged() OVERRIDE; - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual void OnPaintBackground(gfx::Canvas* canvas); + virtual void Layout(); + virtual void OnBoundsChanged(); + virtual gfx::Size GetPreferredSize(); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); private: class MenuScrollView; @@ -40,9 +41,6 @@ class MenuScrollViewContainer : public View { // The scroll view. MenuScrollView* scroll_view_; - // The content view. - SubmenuView* content_view_; - DISALLOW_COPY_AND_ASSIGN(MenuScrollViewContainer); }; diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc index fb78762..7c1f69e 100644 --- a/views/controls/menu/submenu_view.cc +++ b/views/controls/menu/submenu_view.cc @@ -4,14 +4,12 @@ #include "views/controls/menu/submenu_view.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas.h" #include "views/controls/menu/menu_config.h" #include "views/controls/menu/menu_controller.h" #include "views/controls/menu/menu_host.h" #include "views/controls/menu/menu_scroll_view_container.h" #include "views/widget/root_view.h" -#include "views/widget/widget.h" // Height of the drop indicator. This should be an even number. static const int kDropIndicatorHeight = 2; @@ -127,10 +125,8 @@ void SubmenuView::OnBoundsChanged() { SchedulePaint(); } -void SubmenuView::GetAccessibleState(ui::AccessibleViewState* state) { - // Inherit most of the state from the parent menu item, except the role. - GetMenuItem()->GetAccessibleState(state); - state->role = ui::AccessibilityTypes::ROLE_MENUPOPUP; +AccessibilityTypes::Role SubmenuView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_MENUPOPUP; } void SubmenuView::PaintChildren(gfx::Canvas* canvas) { @@ -237,14 +233,10 @@ void SubmenuView::ShowAt(gfx::NativeWindow parent, if (host_) { host_->ShowMenuHost(do_capture); - GetScrollViewContainer()->GetWidget()->NotifyAccessibilityEvent( - GetScrollViewContainer(), - ui::AccessibilityTypes::EVENT_MENUSTART, - true); - GetWidget()->NotifyAccessibilityEvent( - this, - ui::AccessibilityTypes::EVENT_MENUPOPUPSTART, - true); + GetScrollViewContainer()->NotifyAccessibilityEvent( + AccessibilityTypes::EVENT_MENUSTART); + + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_MENUPOPUPSTART); return; } @@ -255,14 +247,10 @@ void SubmenuView::ShowAt(gfx::NativeWindow parent, ScrollRectToVisible(gfx::Rect(gfx::Point(), gfx::Size(1, 1))); host_->Init(parent, bounds, scroll_view_container_, do_capture); - GetScrollViewContainer()->GetWidget()->NotifyAccessibilityEvent( - GetScrollViewContainer(), - ui::AccessibilityTypes::EVENT_MENUSTART, - true); - GetWidget()->NotifyAccessibilityEvent( - this, - ui::AccessibilityTypes::EVENT_MENUPOPUPSTART, - true); + GetScrollViewContainer()->NotifyAccessibilityEvent( + AccessibilityTypes::EVENT_MENUSTART); + + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_MENUPOPUPSTART); } void SubmenuView::Reposition(const gfx::Rect& bounds) { @@ -272,14 +260,10 @@ void SubmenuView::Reposition(const gfx::Rect& bounds) { void SubmenuView::Close() { if (host_) { - GetWidget()->NotifyAccessibilityEvent( - this, - ui::AccessibilityTypes::EVENT_MENUPOPUPEND, - true); - GetScrollViewContainer()->GetWidget()->NotifyAccessibilityEvent( - GetScrollViewContainer(), - ui::AccessibilityTypes::EVENT_MENUEND, - true); + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_MENUPOPUPEND); + + GetScrollViewContainer()->NotifyAccessibilityEvent( + AccessibilityTypes::EVENT_MENUEND); host_->DestroyMenuHost(); host_ = NULL; @@ -324,6 +308,12 @@ MenuScrollViewContainer* SubmenuView::GetScrollViewContainer() { scroll_view_container_ = new MenuScrollViewContainer(this); // Otherwise MenuHost would delete us. scroll_view_container_->set_parent_owned(false); + + // Use the parent menu item accessible name for the menu view. + string16 accessible_name; + GetMenuItem()->GetAccessibleName(&accessible_name); + scroll_view_container_->SetAccessibleName(accessible_name); + SetAccessibleName(accessible_name); } return scroll_view_container_; } diff --git a/views/controls/menu/submenu_view.h b/views/controls/menu/submenu_view.h index c16c081..cbe2674 100644 --- a/views/controls/menu/submenu_view.h +++ b/views/controls/menu/submenu_view.h @@ -50,15 +50,15 @@ class SubmenuView : public View { // Positions and sizes the child views. This tiles the views vertically, // giving each child the available width. - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual void Layout(); + virtual gfx::Size GetPreferredSize(); // View method. Overridden to schedule a paint. We do this so that when // scrolling occurs, everything is repainted correctly. - virtual void OnBoundsChanged() OVERRIDE; + virtual void OnBoundsChanged(); // Override from View. - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); // Painting. void PaintChildren(gfx::Canvas* canvas); @@ -66,16 +66,16 @@ class SubmenuView : public View { // Drag and drop methods. These are forwarded to the MenuController. virtual bool GetDropFormats( int* formats, - std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; - virtual bool AreDropTypesRequired() OVERRIDE; - virtual bool CanDrop(const OSExchangeData& data) OVERRIDE; - virtual void OnDragEntered(const DropTargetEvent& event) OVERRIDE; - virtual int OnDragUpdated(const DropTargetEvent& event) OVERRIDE; - virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const DropTargetEvent& event) OVERRIDE; + std::set<OSExchangeData::CustomFormat>* custom_formats); + virtual bool AreDropTypesRequired(); + virtual bool CanDrop(const OSExchangeData& data); + virtual void OnDragEntered(const DropTargetEvent& event); + virtual int OnDragUpdated(const DropTargetEvent& event); + virtual void OnDragExited(); + virtual int OnPerformDrop(const DropTargetEvent& event); // Scrolls on menu item boundaries. - virtual bool OnMouseWheel(const MouseWheelEvent& e) OVERRIDE; + virtual bool OnMouseWheel(const MouseWheelEvent& e); // Returns true if the menu is showing. bool IsShowing(); diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index 08d6843..34e243e 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -12,7 +12,6 @@ #include "base/logging.h" #include "base/scoped_ptr.h" -#include "ui/base/accessibility/accessibility_types.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/keycodes/keyboard_code_conversion_win.h" #include "ui/base/l10n/l10n_util_win.h" @@ -282,8 +281,7 @@ void NativeControl::OnFocus() { if (container_) { DCHECK(container_->GetControl()); ::SetFocus(container_->GetControl()); - GetWidget()->NotifyAccessibilityEvent( - this, ui::AccessibilityTypes::EVENT_FOCUS, false); + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS, false); } } diff --git a/views/controls/native_control_gtk.cc b/views/controls/native_control_gtk.cc index 88035c1..a17c4cb 100644 --- a/views/controls/native_control_gtk.cc +++ b/views/controls/native_control_gtk.cc @@ -7,9 +7,7 @@ #include <gtk/gtk.h> #include "base/logging.h" -#include "ui/base/accessibility/accessibility_types.h" #include "views/focus/focus_manager.h" -#include "views/widget/widget.h" namespace views { @@ -68,8 +66,8 @@ void NativeControlGtk::VisibilityChanged(View* starting_from, bool is_visible) { void NativeControlGtk::OnFocus() { DCHECK(native_view()); gtk_widget_grab_focus(native_view()); - GetWidget()->NotifyAccessibilityEvent( - parent(), ui::AccessibilityTypes::EVENT_FOCUS, true); + + parent()->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS); } void NativeControlGtk::NativeControlCreated(GtkWidget* native_control) { diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc index 13a8c2b..7e7312b 100644 --- a/views/controls/native_control_win.cc +++ b/views/controls/native_control_win.cc @@ -7,12 +7,10 @@ #include <windowsx.h> #include "base/logging.h" -#include "ui/base/accessibility/accessibility_types.h" #include "ui/base/l10n/l10n_util_win.h" #include "ui/base/view_prop.h" #include "ui/base/win/hwnd_util.h" #include "views/focus/focus_manager.h" -#include "views/widget/widget.h" using ui::ViewProp; @@ -114,8 +112,8 @@ void NativeControlWin::OnFocus() { parent_view->HasFocus(); // Send the accessibility focus notification. - parent_view->GetWidget()->NotifyAccessibilityEvent( - parent_view, ui::AccessibilityTypes::EVENT_FOCUS, send_native_event); + parent_view->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS, + send_native_event); } //////////////////////////////////////////////////////////////////////////////// diff --git a/views/controls/progress_bar.cc b/views/controls/progress_bar.cc index e460e27..a6aabb1 100644 --- a/views/controls/progress_bar.cc +++ b/views/controls/progress_bar.cc @@ -11,7 +11,6 @@ #include "base/utf_string_conversions.h" #include "third_party/skia/include/effects/SkGradientShader.h" #include "third_party/skia/include/effects/SkBlurMaskFilter.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/font.h" @@ -311,9 +310,12 @@ void ProgressBar::SetEnabled(bool enabled) { // TODO(denisromanov): Need to switch progress bar color here? } -void ProgressBar::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_PROGRESSBAR; - state->state = ui::AccessibilityTypes::STATE_READONLY; +AccessibilityTypes::Role ProgressBar::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PROGRESSBAR; +} + +AccessibilityTypes::State ProgressBar::GetAccessibleState() { + return AccessibilityTypes::STATE_READONLY; } } // namespace views diff --git a/views/controls/progress_bar.h b/views/controls/progress_bar.h index 4366519..b2f1202 100644 --- a/views/controls/progress_bar.h +++ b/views/controls/progress_bar.h @@ -52,14 +52,14 @@ class ProgressBar : public View { virtual void SetTooltipText(const std::wstring& tooltip_text); // Gets the tooltip text if has been specified with SetTooltipText(). - virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip) - OVERRIDE; + virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); // Sets the enabled state. - virtual void SetEnabled(bool enabled) OVERRIDE; + virtual void SetEnabled(bool enabled); // Accessibility accessors, overridden from View. - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); // Maximum value of progress. static const int kMaxProgress; diff --git a/views/controls/progress_bar_unittest.cc b/views/controls/progress_bar_unittest.cc index c7fc4df..55acfd4 100644 --- a/views/controls/progress_bar_unittest.cc +++ b/views/controls/progress_bar_unittest.cc @@ -5,7 +5,6 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/controls/progress_bar.h" namespace views { @@ -49,11 +48,17 @@ TEST(ProgressBarTest, Accessibility) { ProgressBar bar; bar.SetProgress(62); - ui::AccessibleViewState state; - bar.GetAccessibleState(&state); - EXPECT_EQ(ui::AccessibilityTypes::ROLE_PROGRESSBAR, state.role); - EXPECT_EQ(string16(), state.name); - EXPECT_TRUE(ui::AccessibilityTypes::STATE_READONLY & state.state); + EXPECT_EQ(AccessibilityTypes::ROLE_PROGRESSBAR, bar.GetAccessibleRole()); + + string16 name; + EXPECT_FALSE(bar.GetAccessibleName(&name)); + EXPECT_EQ(string16(), name); + string16 accessible_name = ASCIIToUTF16("My progress bar"); + bar.SetAccessibleName(accessible_name); + EXPECT_TRUE(bar.GetAccessibleName(&name)); + EXPECT_EQ(accessible_name, name); + + EXPECT_TRUE(AccessibilityTypes::STATE_READONLY & bar.GetAccessibleState()); } } // namespace views diff --git a/views/controls/resize_area.cc b/views/controls/resize_area.cc index 0769cf9..b3897bb 100644 --- a/views/controls/resize_area.cc +++ b/views/controls/resize_area.cc @@ -5,7 +5,6 @@ #include "views/controls/resize_area.h" #include "base/logging.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/resource/resource_bundle.h" #if defined(OS_LINUX) @@ -75,8 +74,8 @@ void ResizeArea::OnMouseReleased(const views::MouseEvent& event, ReportResizeAmount(canceled ? initial_position_ : event.x(), true); } -void ResizeArea::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_SEPARATOR; +AccessibilityTypes::Role ResizeArea::GetAccessibleRole() { + return AccessibilityTypes::ROLE_SEPARATOR; } void ResizeArea::ReportResizeAmount(int resize_amount, bool last_update) { diff --git a/views/controls/resize_area.h b/views/controls/resize_area.h index cf9bea7..9adb60c 100644 --- a/views/controls/resize_area.h +++ b/views/controls/resize_area.h @@ -41,14 +41,13 @@ class ResizeArea : public View { virtual ~ResizeArea(); // Overridden from views::View: - virtual std::string GetClassName() const OVERRIDE; + virtual std::string GetClassName() const; virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type, - const gfx::Point& p) OVERRIDE; - virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled) - OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + const gfx::Point& p); + virtual bool OnMousePressed(const views::MouseEvent& event); + virtual bool OnMouseDragged(const views::MouseEvent& event); + virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); + virtual AccessibilityTypes::Role GetAccessibleRole(); private: // Report the amount the user resized by to the delegate, accounting for diff --git a/views/controls/scrollbar/scroll_bar.cc b/views/controls/scrollbar/scroll_bar.cc index 880a42a..94360bb 100644 --- a/views/controls/scrollbar/scroll_bar.cc +++ b/views/controls/scrollbar/scroll_bar.cc @@ -5,7 +5,6 @@ #include "views/controls/scrollbar/scroll_bar.h" #include "base/logging.h" -#include "ui/base/accessibility/accessible_view_state.h" namespace views { @@ -23,8 +22,8 @@ ScrollBar::ScrollBar(bool is_horiz) : is_horiz_(is_horiz), ScrollBar::~ScrollBar() { } -void ScrollBar::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_SCROLLBAR; +AccessibilityTypes::Role ScrollBar::GetAccessibleRole() { + return AccessibilityTypes::ROLE_SCROLLBAR; } bool ScrollBar::IsHorizontal() const { diff --git a/views/controls/scrollbar/scroll_bar.h b/views/controls/scrollbar/scroll_bar.h index d7f187b..faed881 100644 --- a/views/controls/scrollbar/scroll_bar.h +++ b/views/controls/scrollbar/scroll_bar.h @@ -60,7 +60,7 @@ class ScrollBar : public View { virtual ~ScrollBar(); // Overridden from View: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); // Return whether this scrollbar is horizontal bool IsHorizontal() const; diff --git a/views/controls/separator.cc b/views/controls/separator.cc index bc1f522..1a3ca70 100644 --- a/views/controls/separator.cc +++ b/views/controls/separator.cc @@ -5,7 +5,6 @@ #include "views/controls/separator.h" #include "base/logging.h" -#include "ui/base/accessibility/accessible_view_state.h" #if defined(OS_LINUX) #include "views/controls/native_control_gtk.h" #elif defined(OS_WIN) @@ -93,8 +92,8 @@ std::string Separator::GetClassName() const { return kViewClassName; } -void Separator::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_SEPARATOR; +AccessibilityTypes::Role Separator::GetAccessibleRole() { + return AccessibilityTypes::ROLE_SEPARATOR; } //////////////////////////////////////////////////////////////////////////////// diff --git a/views/controls/separator.h b/views/controls/separator.h index 6c4d9c4..186d84f 100644 --- a/views/controls/separator.h +++ b/views/controls/separator.h @@ -24,15 +24,14 @@ class Separator : public View { virtual ~Separator(); // Overridden from View: - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual void Layout(); + virtual gfx::Size GetPreferredSize(); + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: - // Overridden from View: virtual void ViewHierarchyChanged(bool is_add, View* parent, - View* child) OVERRIDE; - virtual std::string GetClassName() const OVERRIDE; + View* child); + virtual std::string GetClassName() const; private: void CreateNativeWrapper(); diff --git a/views/controls/single_split_view.cc b/views/controls/single_split_view.cc index 96302f7..2b076d6 100644 --- a/views/controls/single_split_view.cc +++ b/views/controls/single_split_view.cc @@ -9,7 +9,6 @@ #endif #include "skia/ext/skia_utils_win.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas.h" #include "views/background.h" @@ -66,9 +65,8 @@ void SingleSplitView::Layout() { View::Layout(); } -void SingleSplitView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_GROUPING; - state->name = accessible_name_; +AccessibilityTypes::Role SingleSplitView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } gfx::Size SingleSplitView::GetPreferredSize() { @@ -152,10 +150,6 @@ void SingleSplitView::CalculateChildrenBounds( } } -void SingleSplitView::SetAccessibleName(const string16& name) { - accessible_name_ = name; -} - bool SingleSplitView::OnMousePressed(const MouseEvent& event) { if (!IsPointInDivider(event.location())) return false; diff --git a/views/controls/single_split_view.h b/views/controls/single_split_view.h index 38e7bbb..dc69c67 100644 --- a/views/controls/single_split_view.h +++ b/views/controls/single_split_view.h @@ -42,7 +42,7 @@ class SingleSplitView : public views::View { virtual void OnBoundsChanged(); virtual void Layout(); - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); // SingleSplitView's preferred size is the sum of the preferred widths // and the max of the heights. @@ -75,8 +75,6 @@ class SingleSplitView : public views::View { gfx::Rect* leading_bounds, gfx::Rect* trailing_bounds) const; - void SetAccessibleName(const string16& name); - protected: virtual bool OnMousePressed(const MouseEvent& event); virtual bool OnMouseDragged(const MouseEvent& event); @@ -134,9 +132,6 @@ class SingleSplitView : public views::View { // Observer to notify about user initiated handle movements. Not own by us. Observer* observer_; - // The accessible name of this view. - string16 accessible_name_; - DISALLOW_COPY_AND_ASSIGN(SingleSplitView); }; 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); }; diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index 8a735d0..2047d40 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -12,7 +12,6 @@ #include "base/win/windows_version.h" #include "grit/app_strings.h" #include "skia/ext/skia_utils_win.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -442,11 +441,10 @@ void NativeTextfieldWin::InitializeAccessibilityInfo() { // We expect it to be a Label preceeding this view (if it exists). string16 name; View* label_view = parent->GetChildViewAt(label_index); - if (label_view->GetClassName() == Label::kViewClassName) { - ui::AccessibleViewState state; - label_view->GetAccessibleState(&state); + if (label_view->GetClassName() == Label::kViewClassName && + label_view->GetAccessibleName(&name)) { hr = pAccPropServices->SetHwndPropStr(m_hWnd, OBJID_CLIENT, - CHILDID_SELF, PROPID_ACC_NAME, state.name.c_str()); + CHILDID_SELF, PROPID_ACC_NAME, name.c_str()); } } } diff --git a/views/controls/textfield/textfield.cc b/views/controls/textfield/textfield.cc index 4366a0c..2a72712 100644 --- a/views/controls/textfield/textfield.cc +++ b/views/controls/textfield/textfield.cc @@ -12,7 +12,6 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/gfx/insets.h" #include "views/controls/native/native_view_host.h" @@ -281,10 +280,6 @@ size_t Textfield::GetCursorPosition() const { return native_wrapper_ ? native_wrapper_->GetCursorPosition() : 0; } -void Textfield::SetAccessibleName(const string16& name) { - accessible_name_ = name; -} - //////////////////////////////////////////////////////////////////////////////// // Textfield, View overrides: @@ -365,14 +360,23 @@ void Textfield::OnBlur() { native_wrapper_->HandleBlur(); } -void Textfield::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_TEXT; - state->name = accessible_name_; +AccessibilityTypes::Role Textfield::GetAccessibleRole() { + return AccessibilityTypes::ROLE_TEXT; +} + +AccessibilityTypes::State Textfield::GetAccessibleState() { + int state = 0; if (read_only()) - state->state |= ui::AccessibilityTypes::STATE_READONLY; + state |= AccessibilityTypes::STATE_READONLY; if (IsPassword()) - state->state |= ui::AccessibilityTypes::STATE_PROTECTED; - state->value = text_; + state |= AccessibilityTypes::STATE_PROTECTED; + return state; +} + +string16 Textfield::GetAccessibleValue() { + if (!text_.empty()) + return text_; + return string16(); } void Textfield::SetEnabled(bool enabled) { diff --git a/views/controls/textfield/textfield.h b/views/controls/textfield/textfield.h index 47285f7..c8484d5 100644 --- a/views/controls/textfield/textfield.h +++ b/views/controls/textfield/textfield.h @@ -247,9 +247,6 @@ class Textfield : public View { // only and has to be called after the wrapper is created. size_t GetCursorPosition() const; - // Set the accessible name of the text field. - void SetAccessibleName(const string16& name); - #ifdef UNIT_TEST gfx::NativeView GetTestingHandle() const { return native_wrapper_ ? native_wrapper_->GetTestingHandle() : NULL; @@ -272,7 +269,9 @@ class Textfield : public View { virtual bool OnKeyReleased(const views::KeyEvent& e) OVERRIDE; virtual void OnFocus() OVERRIDE; virtual void OnBlur() OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; + virtual AccessibilityTypes::State GetAccessibleState() OVERRIDE; + virtual string16 GetAccessibleValue() OVERRIDE; protected: virtual void ViewHierarchyChanged(bool is_add, View* parent, @@ -340,9 +339,6 @@ class Textfield : public View { // Text to display when empty. string16 text_to_display_when_empty_; - // The accessible name of the text field. - string16 accessible_name_; - DISALLOW_COPY_AND_ASSIGN(Textfield); }; diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index 4e8a53d..3f6b8bf 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -11,7 +11,6 @@ #include "base/stl_util-inl.h" #include "base/win/win_util.h" #include "grit/app_resources.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/keycodes/keyboard_code_conversion_win.h" #include "ui/base/resource/resource_bundle.h" @@ -61,9 +60,12 @@ TreeView::~TreeView() { ImageList_Destroy(image_list_); } -void TreeView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_OUTLINE; - state->state = ui::AccessibilityTypes::STATE_READONLY; +AccessibilityTypes::Role TreeView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_OUTLINE; +} + +AccessibilityTypes::State TreeView::GetAccessibleState() { + return AccessibilityTypes::STATE_READONLY; } void TreeView::SetModel(TreeModel* model) { diff --git a/views/controls/tree/tree_view.h b/views/controls/tree/tree_view.h index a542e85..d4d0771 100644 --- a/views/controls/tree/tree_view.h +++ b/views/controls/tree/tree_view.h @@ -79,7 +79,8 @@ class TreeView : public NativeControl, ui::TreeModelObserver { } // Overridden from View: - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); // Edits the specified node. This cancels the current edit and expands // all parents of node. diff --git a/views/test/test_views_delegate.h b/views/test/test_views_delegate.h index 3d4f2e6..cae1a64f 100644 --- a/views/test/test_views_delegate.h +++ b/views/test/test_views_delegate.h @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "base/scoped_ptr.h" -#include "ui/base/accessibility/accessibility_types.h" #include "ui/base/clipboard/clipboard.h" #include "views/views_delegate.h" @@ -17,7 +16,7 @@ class TestViewsDelegate : public views::ViewsDelegate { virtual ~TestViewsDelegate() {} // Overridden from views::ViewsDelegate: - virtual ui::Clipboard* GetClipboard() const OVERRIDE { + virtual ui::Clipboard* GetClipboard() const { if (!clipboard_.get()) { // Note that we need a MessageLoop for the next call to work. clipboard_.reset(new ui::Clipboard); @@ -27,32 +26,31 @@ class TestViewsDelegate : public views::ViewsDelegate { virtual void SaveWindowPlacement(views::Window* window, const std::wstring& window_name, const gfx::Rect& bounds, - bool maximized) OVERRIDE { + bool maximized) { } virtual bool GetSavedWindowBounds(views::Window* window, const std::wstring& window_name, - gfx::Rect* bounds) const OVERRIDE { + gfx::Rect* bounds) const { return false; } virtual bool GetSavedMaximizedState(views::Window* window, const std::wstring& window_name, - bool* maximized) const OVERRIDE { + bool* maximized) const { return false; } virtual void NotifyAccessibilityEvent( - views::View* view, ui::AccessibilityTypes::Event event_type) OVERRIDE {} - + views::View* view, AccessibilityTypes::Event event_type) {} #if defined(OS_WIN) - virtual HICON GetDefaultWindowIcon() const OVERRIDE { + virtual HICON GetDefaultWindowIcon() const { return NULL; } #endif - - virtual void AddRef() OVERRIDE {} - virtual void ReleaseRef() OVERRIDE {} + virtual void AddRef() {} + virtual void ReleaseRef() {} private: mutable scoped_ptr<ui::Clipboard> clipboard_; DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate); }; + diff --git a/views/view.cc b/views/view.cc index dd511ab..bd778c645 100644 --- a/views/view.cc +++ b/views/view.cc @@ -11,7 +11,6 @@ #include "base/scoped_ptr.h" #include "base/utf_string_conversions.h" #include "third_party/skia/include/core/SkRect.h" -#include "ui/base/accessibility/accessibility_types.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/path.h" @@ -27,7 +26,7 @@ #if defined(OS_WIN) #include "base/win/scoped_gdi_object.h" -#include "views/accessibility/native_view_accessibility_win.h" +#include "views/accessibility/view_accessibility.h" #endif #if defined(OS_LINUX) #include "ui/base/gtk/scoped_handle_gtk.h" @@ -87,8 +86,8 @@ View::~View() { } #if defined(OS_WIN) - if (native_view_accessibility_win_.get()) - native_view_accessibility_win_->set_view(NULL); + if (view_accessibility_.get()) + view_accessibility_->set_view(NULL); #endif } @@ -986,6 +985,29 @@ bool View::ExceededDragThreshold(int delta_x, int delta_y) { abs(delta_y) > GetVerticalDragThreshold()); } +// Accessibility --------------------------------------------------------------- + +void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type) { + NotifyAccessibilityEvent(event_type, true); +} + +bool View::GetAccessibleName(string16* name) { + DCHECK(name); + + if (accessible_name_.empty()) + return false; + *name = accessible_name_; + return true; +} + +AccessibilityTypes::Role View::GetAccessibleRole() { + return AccessibilityTypes::ROLE_CLIENT; +} + +void View::SetAccessibleName(const string16& name) { + accessible_name_ = name; +} + // Scrolling ------------------------------------------------------------------- void View::ScrollRectToVisible(const gfx::Rect& rect) { @@ -1114,8 +1136,7 @@ void View::OnFocus() { // TODO(beng): Investigate whether it's possible for us to move this to // Focus(). // Notify assistive technologies of the focus change. - GetWidget()->NotifyAccessibilityEvent( - this, ui::AccessibilityTypes::EVENT_FOCUS, true); + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS); } void View::OnBlur() { diff --git a/views/view.h b/views/view.h index f784c8e..83af008 100644 --- a/views/view.h +++ b/views/view.h @@ -20,11 +20,13 @@ #include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" #include "views/accelerator.h" +#include "views/accessibility/accessibility_types.h" #include "views/background.h" #include "views/border.h" using ui::OSExchangeData; +class ViewAccessibility; namespace gfx { class Canvas; @@ -33,7 +35,6 @@ class Path; } namespace ui { -struct AccessibleViewState; class ThemeProvider; class Transform; } @@ -51,10 +52,6 @@ class ScrollView; class Widget; class Window; -#if defined(OS_WIN) -class NativeViewAccessibilityWin; -#endif - // ContextMenuController is responsible for showing the context menu for a // View. To use a ContextMenuController invoke SetContextMenuController on a // View. When the appropriate user gesture occurs ShowContextMenu is invoked @@ -533,7 +530,7 @@ class View : public AcceleratorTarget { const Border* border() const { return border_.get(); } // Get the theme provider from the parent widget. - virtual ThemeProvider* GetThemeProvider() const; + ThemeProvider* GetThemeProvider() const; // RTL painting -------------------------------------------------------------- @@ -880,15 +877,55 @@ class View : public AcceleratorTarget { static bool ExceededDragThreshold(int delta_x, int delta_y); // Accessibility ------------------------------------------------------------- + // TODO(ctguil): Move all this out to a AccessibleInfo wrapper class. + + // Notify the platform specific accessibility client of changes in the user + // interface. This will always raise native notifications. + virtual void NotifyAccessibilityEvent(AccessibilityTypes::Event event_type); + + // Raise an accessibility notification with an option to also raise a native + // notification. + virtual void NotifyAccessibilityEvent(AccessibilityTypes::Event event_type, + bool send_native_event); + + // Returns the MSAA default action of the current view. The string returned + // describes the default action that will occur when executing + // IAccessible::DoDefaultAction. For instance, default action of a button is + // 'Press'. + virtual string16 GetAccessibleDefaultAction() { return string16(); } + + // Returns a string containing the mnemonic, or the keyboard shortcut, for a + // given control. + virtual string16 GetAccessibleKeyboardShortcut() { + return string16(); + } - // Modifies |state| to reflect the current accessible state of this view. - virtual void GetAccessibleState(ui::AccessibleViewState* state) { } + // Returns a brief, identifying string, containing a unique, readable name of + // a given control. Sets the input string appropriately, and returns true if + // successful. + bool GetAccessibleName(string16* name); -#if defined(OS_WIN) - // Returns an instance of the Windows-specific accessibility interface - // for this View. - NativeViewAccessibilityWin* GetNativeViewAccessibilityWin(); -#endif + // Returns the accessibility role of the current view. The role is what + // assistive technologies (ATs) use to determine what behavior to expect from + // a given control. + virtual AccessibilityTypes::Role GetAccessibleRole(); + + // Returns the accessibility state of the current view. + virtual AccessibilityTypes::State GetAccessibleState() { + return 0; + } + + // Returns the current value associated with a view. + virtual string16 GetAccessibleValue() { return string16(); } + + // Assigns a string name to the given control. Needed as a View does not know + // which name will be associated with it until it is created to be a + // certain type. + void SetAccessibleName(const string16& name); + + // Returns an instance of the (platform-specific) accessibility interface for + // the View. + ViewAccessibility* GetViewAccessibility(); // Scrolling ----------------------------------------------------------------- // TODO(beng): Figure out if this can live somewhere other than View, i.e. @@ -1371,9 +1408,12 @@ class View : public AcceleratorTarget { // Accessibility ------------------------------------------------------------- + // Name for this view, which can be retrieved by accessibility APIs. + string16 accessible_name_; + #if defined(OS_WIN) - // The Windows-specific accessibility implementation for this View. - scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; + // The accessibility implementation for this View. + scoped_refptr<ViewAccessibility> view_accessibility_; #endif DISALLOW_COPY_AND_ASSIGN(View); diff --git a/views/view_gtk.cc b/views/view_gtk.cc index 5155099..b666338 100644 --- a/views/view_gtk.cc +++ b/views/view_gtk.cc @@ -7,9 +7,25 @@ #include <gtk/gtk.h> #include "base/logging.h" +#include "views/views_delegate.h" namespace views { +void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type, + bool send_native_event) { + // Send the notification to the delegate. + if (ViewsDelegate::views_delegate) + ViewsDelegate::views_delegate->NotifyAccessibilityEvent(this, event_type); + + // In the future if we add native GTK accessibility support, the + // notification should be sent here. +} + +ViewAccessibility* View::GetViewAccessibility() { + NOTIMPLEMENTED(); + return NULL; +} + int View::GetHorizontalDragThreshold() { static bool determined_threshold = false; static int drag_threshold = 8; diff --git a/views/view_win.cc b/views/view_win.cc index 011b319..2c213c2 100644 --- a/views/view_win.cc +++ b/views/view_win.cc @@ -13,7 +13,7 @@ #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/gfx/canvas.h" #include "ui/gfx/path.h" -#include "views/accessibility/native_view_accessibility_win.h" +#include "views/accessibility/view_accessibility.h" #include "views/border.h" #include "views/views_delegate.h" #include "views/widget/root_view.h" @@ -22,11 +22,28 @@ namespace views { -NativeViewAccessibilityWin* View::GetNativeViewAccessibilityWin() { - if (!native_view_accessibility_win_.get()) - native_view_accessibility_win_.swap( - NativeViewAccessibilityWin::Create(this)); - return native_view_accessibility_win_.get(); +void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type, + bool send_native_event) { + // Send the notification to the delegate. + if (ViewsDelegate::views_delegate) + ViewsDelegate::views_delegate->NotifyAccessibilityEvent(this, event_type); + + // Now call the Windows-specific method to notify MSAA clients of this + // event. The widget gives us a temporary unique child ID to associate + // with this view so that clients can call get_accChild in ViewAccessibility + // to retrieve the IAccessible associated with this view. + if (send_native_event) { + WidgetWin* view_widget = static_cast<WidgetWin*>(GetWidget()); + int child_id = view_widget->AddAccessibilityViewEvent(this); + ::NotifyWinEvent(ViewAccessibility::MSAAEvent(event_type), + view_widget->GetNativeView(), OBJID_CLIENT, child_id); + } +} + +ViewAccessibility* View::GetViewAccessibility() { + if (!view_accessibility_.get()) + view_accessibility_.swap(ViewAccessibility::Create(this)); + return view_accessibility_.get(); } int View::GetHorizontalDragThreshold() { diff --git a/views/views.gyp b/views/views.gyp index 41f70c5..f8b145c 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -74,8 +74,9 @@ # All .cc, .h under views, except unittests 'accelerator.cc', 'accelerator.h', - 'accessibility/native_view_accessibility_win.cc', - 'accessibility/native_view_accessibility_win.h', + 'accessibility/accessibility_types.h', + 'accessibility/view_accessibility.cc', + 'accessibility/view_accessibility.h', 'animation/bounds_animator.cc', 'animation/bounds_animator.h', 'background.cc', @@ -388,7 +389,9 @@ '../build/linux/system.gyp:xext', ], 'sources!': [ - 'accessibility/native_view_accessibility_win.cc', + 'accessibility/accessible_wrapper.cc', + 'accessibility/view_accessibility.cc', + 'accessibility/view_accessibility_wrapper.cc', 'controls/scrollbar/bitmap_scroll_bar.cc', 'controls/combo_box.cc', 'controls/hwnd_view.cc', diff --git a/views/views_delegate.h b/views/views_delegate.h index d7411f6..98b734e 100644 --- a/views/views_delegate.h +++ b/views/views_delegate.h @@ -11,7 +11,7 @@ #include <windows.h> #endif -#include "ui/base/accessibility/accessibility_types.h" +#include "views/accessibility/accessibility_types.h" namespace gfx { class Rect; @@ -58,8 +58,10 @@ class ViewsDelegate { const std::wstring& window_name, bool* maximized) const = 0; + // Notify the delegate that an accessibility event has happened in + // a particular view. virtual void NotifyAccessibilityEvent( - views::View* view, ui::AccessibilityTypes::Event event_type) = 0; + views::View* view, AccessibilityTypes::Event event_type) = 0; #if defined(OS_WIN) // Retrieves the default window icon to use for windows if none is specified. diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc index 65e4002..9d4bbc3 100644 --- a/views/widget/root_view.cc +++ b/views/widget/root_view.cc @@ -8,7 +8,6 @@ #include "base/logging.h" #include "base/message_loop.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/gfx/canvas_skia.h" @@ -420,8 +419,8 @@ std::string RootView::GetClassName() const { return kViewClassName; } -void RootView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_APPLICATION; +AccessibilityTypes::Role RootView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_APPLICATION; } void RootView::OnPaint(gfx::Canvas* canvas) { diff --git a/views/widget/root_view.h b/views/widget/root_view.h index d9634b2..e6d5bcb 100644 --- a/views/widget/root_view.h +++ b/views/widget/root_view.h @@ -117,7 +117,7 @@ class RootView : public View, #endif virtual bool IsVisibleInRootView() const OVERRIDE; virtual std::string GetClassName() const OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; protected: // Overridden from View: diff --git a/views/widget/widget.h b/views/widget/widget.h index 46a37d7..a9eb040 100644 --- a/views/widget/widget.h +++ b/views/widget/widget.h @@ -9,7 +9,6 @@ #include <vector> #include "base/scoped_ptr.h" -#include "ui/base/accessibility/accessibility_types.h" #include "ui/gfx/native_widget_types.h" #include "views/focus/focus_manager.h" #include "views/widget/native_widget_delegate.h" @@ -241,17 +240,6 @@ class Widget : public internal::NativeWidgetDelegate, void SetFocusTraversableParent(FocusTraversable* parent); void SetFocusTraversableParentView(View* parent_view); - // Notifies assistive technology that an accessibility event has - // occurred on |view|, such as when the view is focused or when its - // value changes. Pass true for |send_native_event| except for rare - // cases where the view is a native control that's already sending a - // native accessibility event and the duplicate event would cause - // problems. - virtual void NotifyAccessibilityEvent( - View* view, - ui::AccessibilityTypes::Event event_type, - bool send_native_event) = 0; - NativeWidget* native_widget() { return native_widget_; } // Overridden from FocusTraversable: diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index dfa1b2e..0ae89cb 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -21,7 +21,6 @@ #include "ui/base/x/x11_util.h" #include "ui/gfx/canvas_skia_paint.h" #include "ui/gfx/path.h" -#include "views/views_delegate.h" #include "views/focus/view_storage.h" #include "views/widget/drop_target_gtk.h" #include "views/widget/gtk_views_fixed.h" @@ -780,18 +779,6 @@ void WidgetGtk::ViewHierarchyChanged(bool is_add, View* parent, View* child) { } } -void WidgetGtk::NotifyAccessibilityEvent( - View* view, - ui::AccessibilityTypes::Event event_type, - bool send_native_event) { - // Send the notification to the delegate. - if (ViewsDelegate::views_delegate) - ViewsDelegate::views_delegate->NotifyAccessibilityEvent(view, event_type); - - // In the future if we add native GTK accessibility support, the - // notification should be sent here. -} - void WidgetGtk::ClearNativeFocus() { DCHECK(type_ != TYPE_CHILD); if (!GetNativeView()) { diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index a9a7034..9facf90 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -173,10 +173,6 @@ class WidgetGtk : public Widget, virtual FocusManager* GetFocusManager(); virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); - virtual void NotifyAccessibilityEvent( - View* view, - ui::AccessibilityTypes::Event event_type, - bool send_native_event); // Clears the focus on the native widget having the focus. virtual void ClearNativeFocus(); diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index cabe472..e81d5c2 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -21,7 +21,7 @@ #include "ui/gfx/canvas_skia.h" #include "ui/gfx/native_theme_win.h" #include "ui/gfx/path.h" -#include "views/accessibility/native_view_accessibility_win.h" +#include "views/accessibility/view_accessibility.h" #include "views/controls/native_control_win.h" #include "views/focus/accelerator_handler.h" #include "views/focus/focus_util_win.h" @@ -507,26 +507,6 @@ void WidgetWin::SetCursor(gfx::NativeCursor cursor) { } } -void WidgetWin::NotifyAccessibilityEvent( - View* view, - ui::AccessibilityTypes::Event event_type, - bool send_native_event) { - // Send the notification to the delegate. - if (ViewsDelegate::views_delegate) - ViewsDelegate::views_delegate->NotifyAccessibilityEvent(view, event_type); - - // Now call the Windows-specific method to notify MSAA clients of this - // event. The widget gives us a temporary unique child ID to associate - // with this view so that clients can call get_accChild in - // NativeViewAccessibilityWin to retrieve the IAccessible associated - // with this view. - if (send_native_event) { - int child_id = AddAccessibilityViewEvent(view); - ::NotifyWinEvent(NativeViewAccessibilityWin::MSAAEvent(event_type), - GetNativeView(), OBJID_CLIENT, child_id); - } -} - //////////////////////////////////////////////////////////////////////////////// // WidgetWin, MessageLoop::Observer implementation: @@ -669,7 +649,7 @@ LRESULT WidgetWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { if (OBJID_CLIENT == l_param) { // Retrieve MSAA dispatch object for the root view. base::win::ScopedComPtr<IAccessible> root( - NativeViewAccessibilityWin::GetAccessibleForView(GetRootView())); + ViewAccessibility::GetAccessibleForView(GetRootView())); // Create a reference that MSAA will marshall to the client. reference_result = LresultFromObject(IID_IAccessible, w_param, diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index add96c1..72414be 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -106,9 +106,8 @@ class WidgetWin : public ui::WindowImpl, } // Obtain the view event with the given MSAA child id. Used in - // NativeViewAccessibilityWin::get_accChild to support requests for - // children of windowless controls. May return NULL - // (see ViewHierarchyChanged). + // ViewAccessibility::get_accChild to support requests for children of + // windowless controls. May return NULL (see ViewHierarchyChanged). View* GetAccessibilityViewEventAt(int id); // Add a view that has recently fired an accessibility event. Returns a MSAA @@ -146,10 +145,6 @@ class WidgetWin : public ui::WindowImpl, virtual FocusManager* GetFocusManager(); virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); - virtual void NotifyAccessibilityEvent( - View* view, - ui::AccessibilityTypes::Event event_type, - bool send_native_event); BOOL IsWindow() const { return ::IsWindow(GetNativeView()); diff --git a/views/window/client_view.cc b/views/window/client_view.cc index 92dd06d..de198ed 100644 --- a/views/window/client_view.cc +++ b/views/window/client_view.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "base/logging.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/window/client_view.h" #if defined(OS_LINUX) #include "views/window/hit_test.h" @@ -63,8 +62,8 @@ void ClientView::OnBoundsChanged() { // NonClientView::Layout. } -void ClientView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_CLIENT; +AccessibilityTypes::Role ClientView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_CLIENT; } } // namespace views diff --git a/views/window/client_view.h b/views/window/client_view.h index 6dd39fe..08ddcd4 100644 --- a/views/window/client_view.h +++ b/views/window/client_view.h @@ -60,10 +60,9 @@ class ClientView : public View { protected: // Overridden from View: - virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child) - OVERRIDE; - virtual void OnBoundsChanged() OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); + virtual void OnBoundsChanged(); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Accessors for private data members. Window* window() const { return window_; } diff --git a/views/window/dialog_delegate.h b/views/window/dialog_delegate.h index 36090ca..ac6d4e9 100644 --- a/views/window/dialog_delegate.h +++ b/views/window/dialog_delegate.h @@ -6,8 +6,8 @@ #define VIEWS_WINDOW_DIALOG_DELEGATE_H_ #pragma once -#include "ui/base/accessibility/accessibility_types.h" #include "ui/base/message_box_flags.h" +#include "views/accessibility/accessibility_types.h" #include "views/window/dialog_client_view.h" #include "views/window/window_delegate.h" @@ -122,10 +122,10 @@ class DialogDelegate : public WindowDelegate { // delegate's Window. DialogClientView* GetDialogClientView() const; - protected: + private: // Overridden from WindowDelegate: - virtual ui::AccessibilityTypes::Role GetAccessibleRole() const { - return ui::AccessibilityTypes::ROLE_DIALOG; + AccessibilityTypes::Role accessible_role() const { + return AccessibilityTypes::ROLE_DIALOG; } }; diff --git a/views/window/non_client_view.cc b/views/window/non_client_view.cc index bb09fa3..210bd10 100644 --- a/views/window/non_client_view.cc +++ b/views/window/non_client_view.cc @@ -4,7 +4,6 @@ #include "views/window/non_client_view.h" -#include "ui/base/accessibility/accessible_view_state.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" #include "views/window/window.h" @@ -122,10 +121,6 @@ void NonClientView::LayoutFrameView() { frame_view_->Layout(); } -void NonClientView::SetAccessibleName(const string16& name) { - accessible_name_ = name; -} - //////////////////////////////////////////////////////////////////////////////// // NonClientView, View overrides: @@ -179,9 +174,8 @@ views::View* NonClientView::GetEventHandlerForPoint(const gfx::Point& point) { return View::GetEventHandlerForPoint(point); } -void NonClientView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_WINDOW; - state->name = accessible_name_; +AccessibilityTypes::Role NonClientView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_WINDOW; } //////////////////////////////////////////////////////////////////////////////// @@ -254,8 +248,8 @@ bool NonClientFrameView::ShouldPaintAsActive() const { return GetWindow()->IsActive() || paint_as_active_; } -void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { - state->role = ui::AccessibilityTypes::ROLE_WINDOW; +AccessibilityTypes::Role NonClientFrameView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_WINDOW; } } // namespace views diff --git a/views/window/non_client_view.h b/views/window/non_client_view.h index 10c652c..db1daff 100644 --- a/views/window/non_client_view.h +++ b/views/window/non_client_view.h @@ -69,8 +69,8 @@ class NonClientFrameView : public View { virtual void ResetWindowControls() = 0; // Overridden from View: - virtual bool HitTest(const gfx::Point& l) const OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual bool HitTest(const gfx::Point& l) const; + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: virtual void OnBoundsChanged(); @@ -205,21 +205,16 @@ class NonClientView : public View { // of a window resize message. void LayoutFrameView(); - // Set the accessible name of this view. - void SetAccessibleName(const string16& name); - // NonClientView, View overrides: - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual gfx::Size GetMinimumSize() OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize(); + virtual gfx::Size GetMinimumSize(); + virtual void Layout(); + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: // NonClientView, View overrides: - virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child) - OVERRIDE; - virtual views::View* GetEventHandlerForPoint(const gfx::Point& point) - OVERRIDE; + virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); + virtual views::View* GetEventHandlerForPoint(const gfx::Point& point); private: // The frame that hosts this NonClientView. @@ -235,9 +230,6 @@ class NonClientView : public View { // dynamically as the system settings change. scoped_ptr<NonClientFrameView> frame_view_; - // The accessible name of this view. - string16 accessible_name_; - DISALLOW_COPY_AND_ASSIGN(NonClientView); }; diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h index 6ef75cc..04ac6b3 100644 --- a/views/window/window_delegate.h +++ b/views/window/window_delegate.h @@ -9,7 +9,7 @@ #include <string> #include "base/scoped_ptr.h" -#include "ui/base/accessibility/accessibility_types.h" +#include "views/accessibility/accessibility_types.h" class SkBitmap; @@ -56,11 +56,11 @@ class WindowDelegate { return false; } - virtual ui::AccessibilityTypes::Role GetAccessibleRole() const { - return ui::AccessibilityTypes::ROLE_WINDOW; + virtual AccessibilityTypes::Role accessible_role() const { + return AccessibilityTypes::ROLE_WINDOW; } - virtual ui::AccessibilityTypes::State GetAccessibleState() const { + virtual AccessibilityTypes::State accessible_state() const { return 0; } diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 49c9b2a..7776bea 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -11,7 +11,6 @@ #include "base/win/scoped_gdi_object.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" -#include "ui/base/accessibility/accessibility_types.h" #include "ui/base/keycodes/keyboard_code_conversion_win.h" #include "ui/base/l10n/l10n_util_win.h" #include "ui/base/theme_provider.h" @@ -20,7 +19,7 @@ #include "ui/gfx/font.h" #include "ui/gfx/icon_util.h" #include "ui/gfx/path.h" -#include "views/accessibility/native_view_accessibility_win.h" +#include "views/accessibility/view_accessibility.h" #include "views/widget/root_view.h" #include "views/window/client_view.h" #include "views/window/custom_frame_view.h" @@ -1449,10 +1448,10 @@ void WindowWin::UpdateAccessibleRole() { IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); if (SUCCEEDED(hr)) { VARIANT var; - ui::AccessibilityTypes::Role role = window_delegate_->GetAccessibleRole(); + AccessibilityTypes::Role role = window_delegate_->accessible_role(); if (role) { var.vt = VT_I4; - var.lVal = NativeViewAccessibilityWin::MSAARole(role); + var.lVal = ViewAccessibility::MSAARole(role); hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_ROLE, var); } @@ -1465,10 +1464,9 @@ void WindowWin::UpdateAccessibleState() { IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); if (SUCCEEDED(hr)) { VARIANT var; - ui::AccessibilityTypes::State state = - window_delegate_->GetAccessibleState(); + AccessibilityTypes::State state = window_delegate_->accessible_state(); if (state) { - var.lVal = NativeViewAccessibilityWin::MSAAState(state); + var.lVal = ViewAccessibility::MSAAState(state); hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_STATE, var); } |