diff options
93 files changed, 236 insertions, 426 deletions
diff --git a/chrome/browser/views/accessibility_event_router_views.cc b/chrome/browser/views/accessibility_event_router_views.cc index abdb650..b8bfc25 100644 --- a/chrome/browser/views/accessibility_event_router_views.cc +++ b/chrome/browser/views/accessibility_event_router_views.cc @@ -157,8 +157,6 @@ void AccessibilityEventRouterViews::DispatchAccessibilityNotification( most_recent_profile_ = profile; - AccessibilityTypes::Role role; - view->GetAccessibleRole(&role); std::string class_name = view->GetClassName(); if (class_name == views::MenuButton::kViewClassName || @@ -245,8 +243,7 @@ bool AccessibilityEventRouterViews::IsMenuEvent( return true; while (view) { - AccessibilityTypes::Role role; - view->GetAccessibleRole(&role); + AccessibilityTypes::Role role = view->GetAccessibleRole(); if (role == AccessibilityTypes::ROLE_MENUITEM || role == AccessibilityTypes::ROLE_MENUPOPUP) { return true; diff --git a/chrome/browser/views/accessible_toolbar_view.cc b/chrome/browser/views/accessible_toolbar_view.cc index 7a73087..1702214 100644 --- a/chrome/browser/views/accessible_toolbar_view.cc +++ b/chrome/browser/views/accessible_toolbar_view.cc @@ -185,11 +185,8 @@ void AccessibleToolbarView::SetVisible(bool flag) { View::SetVisible(flag); } -bool AccessibleToolbarView::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_TOOLBAR; - return true; +AccessibilityTypes::Role AccessibleToolbarView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_TOOLBAR; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/accessible_toolbar_view.h b/chrome/browser/views/accessible_toolbar_view.h index a5bd925..e6d3d59 100644 --- a/chrome/browser/views/accessible_toolbar_view.h +++ b/chrome/browser/views/accessible_toolbar_view.h @@ -44,7 +44,7 @@ class AccessibleToolbarView : public views::View, virtual FocusTraversable* GetPaneFocusTraversable(); virtual bool AcceleratorPressed(const views::Accelerator& accelerator); virtual void SetVisible(bool flag); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Overridden from views::FocusChangeListener: virtual void FocusWillChange(View* focused_before, diff --git a/chrome/browser/views/bookmark_bar_instructions_view.cc b/chrome/browser/views/bookmark_bar_instructions_view.cc index adc708b..a89eb2d 100644 --- a/chrome/browser/views/bookmark_bar_instructions_view.cc +++ b/chrome/browser/views/bookmark_bar_instructions_view.cc @@ -85,14 +85,8 @@ void BookmarkBarInstructionsView::ViewHierarchyChanged(bool is_add, UpdateColors(); } -bool BookmarkBarInstructionsView::GetAccessibleRole( - AccessibilityTypes::Role* role) { - DCHECK(role); - if (!role) - return false; - - *role = AccessibilityTypes::ROLE_GROUPING; - return true; +AccessibilityTypes::Role BookmarkBarInstructionsView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void BookmarkBarInstructionsView::LinkActivated(views::Link* source, diff --git a/chrome/browser/views/bookmark_bar_instructions_view.h b/chrome/browser/views/bookmark_bar_instructions_view.h index c16b536..2156bf8 100644 --- a/chrome/browser/views/bookmark_bar_instructions_view.h +++ b/chrome/browser/views/bookmark_bar_instructions_view.h @@ -41,7 +41,7 @@ class BookmarkBarInstructionsView : public views::View, virtual void ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); // LinkController. virtual void LinkActivated(views::Link* source, int event_flags); diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index f3ab049..0bb9e77 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -342,11 +342,8 @@ class BookmarkBarView::ButtonSeparatorView : public views::View { return gfx::Size(kSeparatorWidth, 1); } - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_SEPARATOR; - return true; + virtual AccessibilityTypes::Role GetAccessibleRole() { + return AccessibilityTypes::ROLE_SEPARATOR; } private: diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc index 1db438f..f93769a 100644 --- a/chrome/browser/views/browser_actions_container.cc +++ b/chrome/browser/views/browser_actions_container.cc @@ -309,10 +309,8 @@ gfx::Canvas* BrowserActionView::GetIconWithBadge() { return canvas; } -bool BrowserActionView::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - *role = AccessibilityTypes::ROLE_GROUPING; - return true; +AccessibilityTypes::Role BrowserActionView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void BrowserActionView::Layout() { @@ -733,11 +731,8 @@ void BrowserActionsContainer::OnThemeChanged() { LoadImages(); } -bool BrowserActionsContainer::GetAccessibleRole( - AccessibilityTypes::Role* role) { - DCHECK(role); - *role = AccessibilityTypes::ROLE_GROUPING; - return true; +AccessibilityTypes::Role BrowserActionsContainer::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void BrowserActionsContainer::RunMenu(View* source, const gfx::Point& pt) { diff --git a/chrome/browser/views/browser_actions_container.h b/chrome/browser/views/browser_actions_container.h index 02063a6..ddef35d 100644 --- a/chrome/browser/views/browser_actions_container.h +++ b/chrome/browser/views/browser_actions_container.h @@ -154,7 +154,7 @@ class BrowserActionView : public views::View { gfx::Canvas* GetIconWithBadge(); // Accessibility accessors, overridden from View. - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); private: virtual void Layout(); @@ -322,7 +322,7 @@ class BrowserActionsContainer virtual void OnDragExited(); virtual int OnPerformDrop(const views::DropTargetEvent& event); virtual void OnThemeChanged(); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Overridden from views::ViewMenuDelegate: virtual void RunMenu(View* source, const gfx::Point& pt); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index eda3a34..0b668bf 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -1792,11 +1792,8 @@ void BrowserView::ChildPreferredSizeChanged(View* child) { Layout(); } -bool BrowserView::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_CLIENT; - return true; +AccessibilityTypes::Role BrowserView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_CLIENT; } void BrowserView::InfoBarSizeChanged(bool is_animating) { diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 3b48553..142c520 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -408,7 +408,7 @@ class BrowserView : public BrowserBubbleHost, views::View* parent, views::View* child); virtual void ChildPreferredSizeChanged(View* child); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Factory Methods. // Returns a new LayoutManager for this browser view. A subclass may diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc index ffb131c..c3c1a0a 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc @@ -377,11 +377,8 @@ bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { return browser_view_->IsPositionInWindowCaption(browser_view_point); } -bool OpaqueBrowserFrameView::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_TITLEBAR; - return true; +AccessibilityTypes::Role OpaqueBrowserFrameView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_TITLEBAR; } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.h b/chrome/browser/views/frame/opaque_browser_frame_view.h index 452c14e..483693e 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/views/frame/opaque_browser_frame_view.h @@ -53,7 +53,7 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, virtual void Paint(gfx::Canvas* canvas); virtual void Layout(); virtual bool HitTest(const gfx::Point& l) const; - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, const views::Event& event); diff --git a/chrome/browser/views/infobars/infobar_container.cc b/chrome/browser/views/infobars/infobar_container.cc index 4301132..5779fde 100644 --- a/chrome/browser/views/infobars/infobar_container.cc +++ b/chrome/browser/views/infobars/infobar_container.cc @@ -78,11 +78,8 @@ void InfoBarContainer::Layout() { } } -bool InfoBarContainer::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_GROUPING; - return true; +AccessibilityTypes::Role InfoBarContainer::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void InfoBarContainer::ViewHierarchyChanged(bool is_add, diff --git a/chrome/browser/views/infobars/infobar_container.h b/chrome/browser/views/infobars/infobar_container.h index 601d111..8efa6b5 100644 --- a/chrome/browser/views/infobars/infobar_container.h +++ b/chrome/browser/views/infobars/infobar_container.h @@ -46,7 +46,7 @@ class InfoBarContainer : public views::View, // Overridden from views::View: virtual gfx::Size GetPreferredSize(); virtual void Layout(); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: virtual void ViewHierarchyChanged(bool is_add, diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc index ad9a2c8..51e74e1b 100644 --- a/chrome/browser/views/infobars/infobars.cc +++ b/chrome/browser/views/infobars/infobars.cc @@ -124,11 +124,8 @@ InfoBar::~InfoBar() { // InfoBar, views::View overrides: --------------------------------------------- -bool InfoBar::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_ALERT; - return true; +AccessibilityTypes::Role InfoBar::GetAccessibleRole() { + return AccessibilityTypes::ROLE_ALERT; } gfx::Size InfoBar::GetPreferredSize() { diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h index 4419d8f..ec270d5 100644 --- a/chrome/browser/views/infobars/infobars.h +++ b/chrome/browser/views/infobars/infobars.h @@ -66,7 +66,7 @@ class InfoBar : public views::View, static const int kButtonInLabelSpacing; // Overridden from views::View: - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual gfx::Size GetPreferredSize(); virtual void Layout(); diff --git a/chrome/browser/views/location_bar/location_bar_view.cc b/chrome/browser/views/location_bar/location_bar_view.cc index 98327a8..7ffccb7 100644 --- a/chrome/browser/views/location_bar/location_bar_view.cc +++ b/chrome/browser/views/location_bar/location_bar_view.cc @@ -1028,14 +1028,10 @@ bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { #endif } -bool LocationBarView::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_GROUPING; - return true; +AccessibilityTypes::Role LocationBarView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } - void LocationBarView::WriteDragData(views::View* sender, const gfx::Point& press_pt, OSExchangeData* data) { diff --git a/chrome/browser/views/location_bar/location_bar_view.h b/chrome/browser/views/location_bar/location_bar_view.h index 1daf264..fae5b2f2 100644 --- a/chrome/browser/views/location_bar/location_bar_view.h +++ b/chrome/browser/views/location_bar/location_bar_view.h @@ -194,7 +194,7 @@ class LocationBarView : public LocationBar, // Overridden from views::View: virtual std::string GetClassName() const; virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Overridden from views::DragController: virtual void WriteDragData(View* sender, diff --git a/chrome/browser/views/location_bar/page_action_image_view.cc b/chrome/browser/views/location_bar/page_action_image_view.cc index 058100c..015ee56 100644 --- a/chrome/browser/views/location_bar/page_action_image_view.cc +++ b/chrome/browser/views/location_bar/page_action_image_view.cc @@ -101,9 +101,8 @@ void PageActionImageView::ExecuteAction(int button, } } -bool PageActionImageView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_PUSHBUTTON; - return true; +AccessibilityTypes::Role PageActionImageView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PUSHBUTTON; } bool PageActionImageView::OnMousePressed(const views::MouseEvent& event) { diff --git a/chrome/browser/views/location_bar/page_action_image_view.h b/chrome/browser/views/location_bar/page_action_image_view.h index 1177e49..71ee6c3 100644 --- a/chrome/browser/views/location_bar/page_action_image_view.h +++ b/chrome/browser/views/location_bar/page_action_image_view.h @@ -41,7 +41,7 @@ class PageActionImageView : public views::ImageView, } // Overridden from view. - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + 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); diff --git a/chrome/browser/views/location_bar/page_action_with_badge_view.cc b/chrome/browser/views/location_bar/page_action_with_badge_view.cc index 603b4f9..fd2204e 100644 --- a/chrome/browser/views/location_bar/page_action_with_badge_view.cc +++ b/chrome/browser/views/location_bar/page_action_with_badge_view.cc @@ -13,10 +13,8 @@ PageActionWithBadgeView::PageActionWithBadgeView( AddChildView(image_view_); } -bool PageActionWithBadgeView::GetAccessibleRole( - AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_GROUPING; - return true; +AccessibilityTypes::Role PageActionWithBadgeView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } gfx::Size PageActionWithBadgeView::GetPreferredSize() { diff --git a/chrome/browser/views/location_bar/page_action_with_badge_view.h b/chrome/browser/views/location_bar/page_action_with_badge_view.h index 06c768e..69d0c36 100644 --- a/chrome/browser/views/location_bar/page_action_with_badge_view.h +++ b/chrome/browser/views/location_bar/page_action_with_badge_view.h @@ -20,7 +20,7 @@ class PageActionWithBadgeView : public views::View { PageActionImageView* image_view() { return image_view_; } - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual gfx::Size GetPreferredSize(); void UpdateVisibility(TabContents* contents, const GURL& url); diff --git a/chrome/browser/views/location_bar/star_view.cc b/chrome/browser/views/location_bar/star_view.cc index 9b4f2c5..88360ec 100644 --- a/chrome/browser/views/location_bar/star_view.cc +++ b/chrome/browser/views/location_bar/star_view.cc @@ -34,9 +34,8 @@ void StarView::SetToggled(bool on) { on ? IDR_STAR_LIT : IDR_STAR)); } -bool StarView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_PUSHBUTTON; - return true; +AccessibilityTypes::Role StarView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PUSHBUTTON; } bool StarView::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { diff --git a/chrome/browser/views/location_bar/star_view.h b/chrome/browser/views/location_bar/star_view.h index 5fd5e3c..8e8794c 100644 --- a/chrome/browser/views/location_bar/star_view.h +++ b/chrome/browser/views/location_bar/star_view.h @@ -27,7 +27,7 @@ class StarView : public views::ImageView, public InfoBubbleDelegate { private: // views::ImageView overrides: - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + 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); diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index 8bf838f..830dac1 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -52,6 +52,21 @@ bool IsNewTabUIURLString(const GURL& url) { } // namespace /////////////////////////////////////////////////////////////////////////////// +// OptionsGroupContents +class OptionsGroupContents : public views::View { + public: + OptionsGroupContents() { } + + // views::View overrides: + virtual AccessibilityTypes::Role GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; + } + + private: + DISALLOW_COPY_AND_ASSIGN(OptionsGroupContents); +}; + +/////////////////////////////////////////////////////////////////////////////// // SearchEngineListModel class SearchEngineListModel : public ComboboxModel, @@ -488,7 +503,7 @@ void GeneralPageView::InitStartupGroup() { using views::GridLayout; using views::ColumnSet; - views::View* contents = new views::View; + views::View* contents = new OptionsGroupContents; GridLayout* layout = new GridLayout(contents); contents->SetLayoutManager(layout); diff --git a/chrome/browser/views/options/options_group_view.cc b/chrome/browser/views/options/options_group_view.cc index 1e742b4..14131b7 100644 --- a/chrome/browser/views/options/options_group_view.cc +++ b/chrome/browser/views/options/options_group_view.cc @@ -51,7 +51,6 @@ OptionsGroupView::OptionsGroupView(views::View* contents, SetAccessibleName(title); contents->SetAccessibleName(title); - contents->SetAccessibleRole(AccessibilityTypes::ROLE_GROUPING); } void OptionsGroupView::SetHighlighted(bool highlighted) { @@ -66,9 +65,8 @@ int OptionsGroupView::GetContentsWidth() const { /////////////////////////////////////////////////////////////////////////////// // OptionsGroupView, views::View overrides: -bool OptionsGroupView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_GROUPING; - return true; +AccessibilityTypes::Role OptionsGroupView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } void OptionsGroupView::Paint(gfx::Canvas* canvas) { diff --git a/chrome/browser/views/options/options_group_view.h b/chrome/browser/views/options/options_group_view.h index 41550c2..69b4efa 100644 --- a/chrome/browser/views/options/options_group_view.h +++ b/chrome/browser/views/options/options_group_view.h @@ -35,7 +35,7 @@ class OptionsGroupView : public views::View { protected: // views::View overrides: - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual void Paint(gfx::Canvas* canvas); virtual void ViewHierarchyChanged(bool is_add, views::View* parent, diff --git a/chrome/browser/views/options/options_page_view.cc b/chrome/browser/views/options/options_page_view.cc index 94a68b8..6073442 100644 --- a/chrome/browser/views/options/options_page_view.cc +++ b/chrome/browser/views/options/options_page_view.cc @@ -36,8 +36,7 @@ void OptionsPageView::ViewHierarchyChanged(bool is_add, } } -bool OptionsPageView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_PAGETAB; - return true; +AccessibilityTypes::Role OptionsPageView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PAGETAB; } diff --git a/chrome/browser/views/options/options_page_view.h b/chrome/browser/views/options/options_page_view.h index 707e39f..698cb99 100644 --- a/chrome/browser/views/options/options_page_view.h +++ b/chrome/browser/views/options/options_page_view.h @@ -40,8 +40,7 @@ class OptionsPageView : public views::View, virtual void ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child); - - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); private: // Whether or not the control layout has been initialized for this page. diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/views/options/options_window_view.cc index 1be8878..d2cb8e2 100644 --- a/chrome/browser/views/options/options_window_view.cc +++ b/chrome/browser/views/options/options_window_view.cc @@ -54,7 +54,7 @@ class OptionsWindowView : public views::View, virtual void TabSelectedAt(int index); // views::View overrides: - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual void Layout(); virtual gfx::Size GetPreferredSize(); @@ -160,9 +160,8 @@ void OptionsWindowView::TabSelectedAt(int index) { /////////////////////////////////////////////////////////////////////////////// // OptionsWindowView, views::View overrides: -bool OptionsWindowView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_CLIENT; - return true; +AccessibilityTypes::Role OptionsWindowView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_CLIENT; } void OptionsWindowView::Layout() { diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc index 241ca35..d9c26c5 100644 --- a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc +++ b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.cc @@ -134,15 +134,8 @@ void NativeTabContentsContainerGtk::AboutToRequestFocusFromTabTraversal( container_->tab_contents()->FocusThroughTabTraversal(reverse); } -bool NativeTabContentsContainerGtk::GetAccessibleRole( - AccessibilityTypes::Role* role) { - // TODO(port): figure out a11y -#if defined(OS_WIN) - DCHECK(role); - - *role = AccessibilityTypes::ROLE_GROUPING; -#endif - return true; +AccessibilityTypes::Role NativeTabContentsContainerGtk::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h index a00caad..7de9e26 100644 --- a/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h +++ b/chrome/browser/views/tab_contents/native_tab_contents_container_gtk.h @@ -33,7 +33,7 @@ class NativeTabContentsContainerGtk : public NativeTabContentsContainer, virtual void Focus(); virtual void RequestFocus(); virtual void AboutToRequestFocusFromTabTraversal(bool reverse); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); private: TabContentsContainer* container_; diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc b/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc index 355d776..eba411f 100644 --- a/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc +++ b/chrome/browser/views/tab_contents/native_tab_contents_container_win.cc @@ -129,12 +129,8 @@ void NativeTabContentsContainerWin::AboutToRequestFocusFromTabTraversal( container_->tab_contents()->FocusThroughTabTraversal(reverse); } -bool NativeTabContentsContainerWin::GetAccessibleRole( - AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_GROUPING; - return true; +AccessibilityTypes::Role NativeTabContentsContainerWin::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/tab_contents/native_tab_contents_container_win.h b/chrome/browser/views/tab_contents/native_tab_contents_container_win.h index b87ccf2..916ce0f 100644 --- a/chrome/browser/views/tab_contents/native_tab_contents_container_win.h +++ b/chrome/browser/views/tab_contents/native_tab_contents_container_win.h @@ -30,7 +30,7 @@ class NativeTabContentsContainerWin : public NativeTabContentsContainer, virtual void Focus(); virtual void RequestFocus(); virtual void AboutToRequestFocusFromTabTraversal(bool reverse); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); private: TabContentsContainer* container_; diff --git a/chrome/browser/views/tab_contents/tab_contents_container.cc b/chrome/browser/views/tab_contents/tab_contents_container.cc index fcffce2..a75743d 100644 --- a/chrome/browser/views/tab_contents/tab_contents_container.cc +++ b/chrome/browser/views/tab_contents/tab_contents_container.cc @@ -75,11 +75,8 @@ void TabContentsContainer::Layout() { } } -bool TabContentsContainer::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_WINDOW; - return true; +AccessibilityTypes::Role TabContentsContainer::GetAccessibleRole() { + return AccessibilityTypes::ROLE_WINDOW; } void TabContentsContainer::ViewHierarchyChanged(bool is_add, diff --git a/chrome/browser/views/tab_contents/tab_contents_container.h b/chrome/browser/views/tab_contents/tab_contents_container.h index 5f273ce..c5c2f1f 100644 --- a/chrome/browser/views/tab_contents/tab_contents_container.h +++ b/chrome/browser/views/tab_contents/tab_contents_container.h @@ -43,7 +43,7 @@ class TabContentsContainer : public views::View, // Overridden from views::View: virtual void Layout(); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: // Overridden from views::View: diff --git a/chrome/browser/views/tabs/base_tab.cc b/chrome/browser/views/tabs/base_tab.cc index 3b6968b..7520a33 100644 --- a/chrome/browser/views/tabs/base_tab.cc +++ b/chrome/browser/views/tabs/base_tab.cc @@ -304,11 +304,8 @@ bool BaseTab::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { return false; } -bool BaseTab::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_PAGETAB; - return true; +AccessibilityTypes::Role BaseTab::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PAGETAB; } ThemeProvider* BaseTab::GetThemeProvider() { diff --git a/chrome/browser/views/tabs/base_tab.h b/chrome/browser/views/tabs/base_tab.h index 83b3da9..9d6567b 100644 --- a/chrome/browser/views/tabs/base_tab.h +++ b/chrome/browser/views/tabs/base_tab.h @@ -86,7 +86,7 @@ class BaseTab : public AnimationDelegate, virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual ThemeProvider* GetThemeProvider(); protected: diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 45b88e6..c408585 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -418,11 +418,8 @@ int TabStrip::OnPerformDrop(const DropTargetEvent& event) { return GetDropEffect(event); } -bool TabStrip::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_PAGETABLIST; - return true; +AccessibilityTypes::Role TabStrip::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PAGETABLIST; } views::View* TabStrip::GetViewForPoint(const gfx::Point& point) { diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index ac8b1e0..64c23fe 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -81,7 +81,7 @@ class TabStrip : public BaseTabStrip, virtual int OnDragUpdated(const views::DropTargetEvent& event); virtual void OnDragExited(); virtual int OnPerformDrop(const views::DropTargetEvent& event); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual views::View* GetViewForPoint(const gfx::Point& point); virtual void OnThemeChanged(); diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc index e40534d..2bb7c55 100644 --- a/views/accessibility/view_accessibility.cc +++ b/views/accessibility/view_accessibility.cc @@ -345,9 +345,8 @@ STDMETHODIMP ViewAccessibility::get_accDefaultAction( if (!view_) return E_FAIL; - std::wstring temp_action; + std::wstring temp_action = view_->GetAccessibleDefaultAction(); - view_->GetAccessibleDefaultAction(&temp_action); if (!temp_action.empty()) { *def_action = SysAllocString(temp_action.c_str()); } else { @@ -422,9 +421,8 @@ STDMETHODIMP ViewAccessibility::get_accKeyboardShortcut( if (!view_) return E_FAIL; - std::wstring temp_key; + std::wstring temp_key = view_->GetAccessibleKeyboardShortcut(); - view_->GetAccessibleKeyboardShortcut(&temp_key); if (!temp_key.empty()) { *acc_key = SysAllocString(temp_key.c_str()); } else { @@ -508,14 +506,8 @@ STDMETHODIMP ViewAccessibility::get_accRole(VARIANT var_id, VARIANT* role) { if (!IsValidId(var_id) || !role) return E_INVALIDARG; - AccessibilityTypes::Role acc_role; - - // Retrieve parent role. - if (!view_->GetAccessibleRole(&acc_role)) - return E_FAIL; - role->vt = VT_I4; - role->lVal = MSAARole(acc_role); + role->lVal = MSAARole(view_->GetAccessibleRole()); return S_OK; } @@ -543,10 +535,9 @@ STDMETHODIMP ViewAccessibility::get_accValue(VARIANT var_id, BSTR* value) { if (!view_) return E_FAIL; - std::wstring temp_value; - // Retrieve the current view's value. - view_->GetAccessibleValue(&temp_value); + std::wstring temp_value = view_->GetAccessibleValue(); + if (!temp_value.empty()) { // Return value retrieved. *value = SysAllocString(temp_value.c_str()); @@ -618,9 +609,7 @@ void ViewAccessibility::SetState(VARIANT* msaa_state, views::View* view) { msaa_state->lVal |= STATE_SYSTEM_FOCUSED; // Add on any view-specific states. - AccessibilityTypes::State state; - if (view->GetAccessibleState(&state)) - msaa_state->lVal |= MSAAState(state); + msaa_state->lVal |= MSAAState(view->GetAccessibleState()); } // IAccessible functions not supported. diff --git a/views/controls/button/button.cc b/views/controls/button/button.cc index 52d5747..f35b178 100644 --- a/views/controls/button/button.cc +++ b/views/controls/button/button.cc @@ -32,17 +32,12 @@ bool Button::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { return true; } -bool Button::GetAccessibleKeyboardShortcut(std::wstring* shortcut) { - if (!accessible_shortcut_.empty()) { - *shortcut = accessible_shortcut_; - return true; - } - return false; +std::wstring Button::GetAccessibleKeyboardShortcut() { + return accessible_shortcut_; } -bool Button::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_PUSHBUTTON; - return true; +AccessibilityTypes::Role Button::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PUSHBUTTON; } //////////////////////////////////////////////////////////////////////////////// diff --git a/views/controls/button/button.h b/views/controls/button/button.h index dfd239c..fe08a19 100644 --- a/views/controls/button/button.h +++ b/views/controls/button/button.h @@ -40,8 +40,8 @@ class Button : public View { // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); - virtual bool GetAccessibleKeyboardShortcut(std::wstring* shortcut); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual std::wstring GetAccessibleKeyboardShortcut(); + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: // Construct the Button with a Listener. The listener can be NULL. This can be diff --git a/views/controls/button/button_dropdown.cc b/views/controls/button/button_dropdown.cc index 7b2b3d0..6fa8dee 100644 --- a/views/controls/button/button_dropdown.cc +++ b/views/controls/button/button_dropdown.cc @@ -164,25 +164,16 @@ void ButtonDropDown::ShowDropDownMenu(gfx::NativeView window) { // //////////////////////////////////////////////////////////////////////////////// -bool ButtonDropDown::GetAccessibleDefaultAction(std::wstring* action) { - DCHECK(action); - - action->assign(l10n_util::GetString(IDS_APP_ACCACTION_PRESS)); - return true; +std::wstring ButtonDropDown::GetAccessibleDefaultAction() { + return l10n_util::GetString(IDS_APP_ACCACTION_PRESS); } -bool ButtonDropDown::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_BUTTONDROPDOWN; - return true; +AccessibilityTypes::Role ButtonDropDown::GetAccessibleRole() { + return AccessibilityTypes::ROLE_BUTTONDROPDOWN; } -bool ButtonDropDown::GetAccessibleState(AccessibilityTypes::State* state) { - DCHECK(state); - - *state = AccessibilityTypes::STATE_HASPOPUP; - return true; +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 eca97a3..a244f253 100644 --- a/views/controls/button/button_dropdown.h +++ b/views/controls/button/button_dropdown.h @@ -26,9 +26,9 @@ class ButtonDropDown : public ImageButton { virtual ~ButtonDropDown(); // Accessibility accessors, overridden from View. - virtual bool GetAccessibleDefaultAction(std::wstring* action); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleState(AccessibilityTypes::State* state); + virtual std::wstring GetAccessibleDefaultAction(); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); private: // Overridden from CustomButton diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc index 404a0ea..bae0fcc 100644 --- a/views/controls/button/checkbox.cc +++ b/views/controls/button/checkbox.cc @@ -167,18 +167,12 @@ void Checkbox::WillLoseFocus() { label_->set_paint_as_focused(false); } -bool Checkbox::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_CHECKBUTTON; - return true; +AccessibilityTypes::Role Checkbox::GetAccessibleRole() { + return AccessibilityTypes::ROLE_CHECKBUTTON; } -bool Checkbox::GetAccessibleState(AccessibilityTypes::State* state) { - DCHECK(state); - - *state = checked() ? AccessibilityTypes::STATE_CHECKED : 0; - return true; +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 87ffe04..7e01afa 100644 --- a/views/controls/button/checkbox.h +++ b/views/controls/button/checkbox.h @@ -60,8 +60,8 @@ class Checkbox : public NativeButton { virtual void WillLoseFocus(); // Accessibility accessors, overridden from View. - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleState(AccessibilityTypes::State* state); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); // Overridden from NativeButton: virtual void SetLabel(const std::wstring& label); diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc index bc949c1..4ab2fae 100644 --- a/views/controls/button/custom_button.cc +++ b/views/controls/button/custom_button.cc @@ -53,22 +53,21 @@ void CustomButton::SetAnimationDuration(int duration) { //////////////////////////////////////////////////////////////////////////////// // CustomButton, View overrides: -bool CustomButton::GetAccessibleState(AccessibilityTypes::State* state) { - *state = 0; +AccessibilityTypes::State CustomButton::GetAccessibleState() { + int state = 0; switch (state_) { case BS_HOT: - *state = AccessibilityTypes::STATE_HOTTRACKED; + state = AccessibilityTypes::STATE_HOTTRACKED; case BS_PUSHED: - *state = AccessibilityTypes::STATE_PRESSED; + state = AccessibilityTypes::STATE_PRESSED; case BS_DISABLED: - *state = AccessibilityTypes::STATE_UNAVAILABLE; + state = AccessibilityTypes::STATE_UNAVAILABLE; case BS_NORMAL: case BS_COUNT: // No additional accessibility state set for this button state. break; } - - return true; + return state; } void CustomButton::SetEnabled(bool enabled) { diff --git a/views/controls/button/custom_button.h b/views/controls/button/custom_button.h index 4d7dff7..f5a1b85 100644 --- a/views/controls/button/custom_button.h +++ b/views/controls/button/custom_button.h @@ -43,7 +43,7 @@ class CustomButton : public Button, void SetAnimationDuration(int duration); // Overridden from View: - virtual bool GetAccessibleState(AccessibilityTypes::State* state); + virtual AccessibilityTypes::State GetAccessibleState(); virtual void SetEnabled(bool enabled); virtual bool IsEnabled() const; virtual bool IsFocusable() const; diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index 4973ea2..e7f7f1b 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -255,25 +255,16 @@ void MenuButton::OnMouseExited(const MouseEvent& event) { // //////////////////////////////////////////////////////////////////////////////// -bool MenuButton::GetAccessibleDefaultAction(std::wstring* action) { - DCHECK(action); - - action->assign(l10n_util::GetString(IDS_APP_ACCACTION_PRESS)); - return true; +std::wstring MenuButton::GetAccessibleDefaultAction() { + return l10n_util::GetString(IDS_APP_ACCACTION_PRESS); } -bool MenuButton::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_BUTTONMENU; - return true; +AccessibilityTypes::Role MenuButton::GetAccessibleRole() { + return AccessibilityTypes::ROLE_BUTTONMENU; } -bool MenuButton::GetAccessibleState(AccessibilityTypes::State* state) { - DCHECK(state); - - *state = AccessibilityTypes::STATE_HASPOPUP; - return true; +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 ac20b0f..72f8fb6 100644 --- a/views/controls/button/menu_button.h +++ b/views/controls/button/menu_button.h @@ -59,9 +59,9 @@ class MenuButton : public TextButton { virtual bool OnKeyReleased(const KeyEvent& e); // Accessibility accessors, overridden from View. - virtual bool GetAccessibleDefaultAction(std::wstring* action); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleState(AccessibilityTypes::State* state); + virtual std::wstring GetAccessibleDefaultAction(); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); // Returns views/MenuButton. virtual std::string GetClassName() const; diff --git a/views/controls/button/radio_button.cc b/views/controls/button/radio_button.cc index d7953e1..b189aa6 100644 --- a/views/controls/button/radio_button.cc +++ b/views/controls/button/radio_button.cc @@ -1,6 +1,6 @@ -// 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. +// 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/controls/button/radio_button.h" @@ -60,9 +60,8 @@ void RadioButton::SetChecked(bool checked) { //////////////////////////////////////////////////////////////////////////////// // RadioButton, View overrides: -bool RadioButton::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_RADIOBUTTON; - return true; +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 af7f902..7ea35f5 100644 --- a/views/controls/button/radio_button.h +++ b/views/controls/button/radio_button.h @@ -25,7 +25,7 @@ class RadioButton : public Checkbox { virtual void SetChecked(bool checked); // Overridden from View: - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual View* GetSelectedViewForGroup(int group_id); virtual bool IsGroupFocusTraversable() const; virtual void OnMouseReleased(const MouseEvent& event, bool canceled); diff --git a/views/controls/combobox/combobox.cc b/views/controls/combobox/combobox.cc index 3eed917..9d1b1f0 100644 --- a/views/controls/combobox/combobox.cc +++ b/views/controls/combobox/combobox.cc @@ -87,18 +87,12 @@ void Combobox::PaintFocusBorder(gfx::Canvas* canvas) { View::PaintFocusBorder(canvas); } -bool Combobox::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_COMBOBOX; - return true; +AccessibilityTypes::Role Combobox::GetAccessibleRole() { + return AccessibilityTypes::ROLE_COMBOBOX; } -bool Combobox::GetAccessibleValue(std::wstring* value) { - DCHECK(value); - - *value = UTF16ToWideHack(model_->GetItemAt(selected_item_)); - return true; +std::wstring Combobox::GetAccessibleValue() { + return UTF16ToWideHack(model_->GetItemAt(selected_item_)); } void Combobox::Focus() { diff --git a/views/controls/combobox/combobox.h b/views/controls/combobox/combobox.h index 0b619a2..2068932 100644 --- a/views/controls/combobox/combobox.h +++ b/views/controls/combobox/combobox.h @@ -61,8 +61,8 @@ class Combobox : public View { virtual void SetEnabled(bool enabled); virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); virtual void PaintFocusBorder(gfx::Canvas* canvas); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleValue(std::wstring* value); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual std::wstring GetAccessibleValue(); protected: virtual void Focus(); diff --git a/views/controls/image_view.cc b/views/controls/image_view.cc index 4ef4ba0..ad18842 100644 --- a/views/controls/image_view.cc +++ b/views/controls/image_view.cc @@ -125,12 +125,8 @@ void ImageView::Paint(gfx::Canvas* canvas) { } } -bool ImageView::GetAccessibleRole(AccessibilityTypes::Role* role) { - if (!role) - return false; - - *role = AccessibilityTypes::ROLE_GRAPHIC; - return true; +AccessibilityTypes::Role ImageView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GRAPHIC; } void ImageView::SetHorizontalAlignment(Alignment ha) { diff --git a/views/controls/image_view.h b/views/controls/image_view.h index 4551312..285b873 100644 --- a/views/controls/image_view.h +++ b/views/controls/image_view.h @@ -77,7 +77,7 @@ class ImageView : public View { // Overriden from View virtual gfx::Size GetPreferredSize(); virtual void Paint(gfx::Canvas* canvas); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); private: diff --git a/views/controls/label.cc b/views/controls/label.cc index 8325cfa..0a9beac 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -247,18 +247,12 @@ void Label::SizeToFit(int max_width) { SizeToPreferredSize(); } -bool Label::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_STATICTEXT; - return true; +AccessibilityTypes::Role Label::GetAccessibleRole() { + return AccessibilityTypes::ROLE_STATICTEXT; } -bool Label::GetAccessibleState(AccessibilityTypes::State* state) { - DCHECK(state); - - *state = AccessibilityTypes::STATE_READONLY; - return true; +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 fea4085..f863999 100644 --- a/views/controls/label.h +++ b/views/controls/label.h @@ -181,8 +181,8 @@ class Label : public View { void SizeToFit(int max_width); // Accessibility accessors, overridden from View. - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleState(AccessibilityTypes::State* state); + 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 65ed4c9..267d260 100644 --- a/views/controls/label_unittest.cc +++ b/views/controls/label_unittest.cc @@ -159,17 +159,13 @@ TEST(LabelTest, Accessibility) { std::wstring test_text(L"My special text."); label.SetText(test_text); - AccessibilityTypes::Role role; - EXPECT_TRUE(label.GetAccessibleRole(&role)); - EXPECT_EQ(AccessibilityTypes::ROLE_STATICTEXT, role); + EXPECT_EQ(AccessibilityTypes::ROLE_STATICTEXT, label.GetAccessibleRole()); std::wstring name; EXPECT_TRUE(label.GetAccessibleName(&name)); EXPECT_EQ(test_text, name); - AccessibilityTypes::State state; - EXPECT_TRUE(label.GetAccessibleState(&state)); - EXPECT_TRUE(AccessibilityTypes::STATE_READONLY & state); + EXPECT_TRUE(AccessibilityTypes::STATE_READONLY & label.GetAccessibleState()); } TEST(LabelTest, SingleLineSizing) { diff --git a/views/controls/link.cc b/views/controls/link.cc index 6cf81d3..141e5c4 100644 --- a/views/controls/link.cc +++ b/views/controls/link.cc @@ -144,11 +144,8 @@ bool Link::SkipDefaultKeyEventProcessing(const KeyEvent& e) { (e.GetKeyCode() == app::VKEY_RETURN); } -bool Link::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_LINK; - return true; +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 fd6b39f..ab0c5c3 100644 --- a/views/controls/link.h +++ b/views/controls/link.h @@ -54,8 +54,7 @@ class Link : public Label { virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); // Accessibility accessors, overridden from View: - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual void SetFont(const gfx::Font& font); // Set whether the link is enabled. diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc index ddefa2a..c903a0f 100644 --- a/views/controls/menu/menu_item_view.cc +++ b/views/controls/menu/menu_item_view.cc @@ -99,28 +99,25 @@ bool MenuItemView::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { return !tooltip_.empty(); } -bool MenuItemView::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - *role = AccessibilityTypes::ROLE_MENUITEM; - return true; +AccessibilityTypes::Role MenuItemView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_MENUITEM; } -bool MenuItemView::GetAccessibleState(AccessibilityTypes::State* state) { - *state = 0; - +AccessibilityTypes::State MenuItemView::GetAccessibleState() { + int state = 0; switch (GetType()) { case SUBMENU: - *state |= AccessibilityTypes::STATE_HASPOPUP; + state |= AccessibilityTypes::STATE_HASPOPUP; case CHECKBOX: case RADIO: - *state |= GetDelegate()->IsItemChecked(GetCommand()) ? + state |= GetDelegate()->IsItemChecked(GetCommand()) ? AccessibilityTypes::STATE_CHECKED : 0; case NORMAL: case SEPARATOR: // No additional accessibility states currently for these menu states. break; } - return true; + return state; } void MenuItemView::RunMenuAt(gfx::NativeWindow parent, diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h index 9441c84..0430e34 100644 --- a/views/controls/menu/menu_item_view.h +++ b/views/controls/menu/menu_item_view.h @@ -88,8 +88,8 @@ class MenuItemView : public View { // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleState(AccessibilityTypes::State* state); + 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 afdcc16..2a3cc5e 100644 --- a/views/controls/menu/menu_scroll_view_container.cc +++ b/views/controls/menu/menu_scroll_view_container.cc @@ -267,20 +267,14 @@ gfx::Size MenuScrollViewContainer::GetPreferredSize() { return prefsize; } -bool MenuScrollViewContainer::GetAccessibleRole( - AccessibilityTypes::Role* role) { - DCHECK(role); - *role = AccessibilityTypes::ROLE_MENUBAR; - return true; +AccessibilityTypes::Role MenuScrollViewContainer::GetAccessibleRole() { + return AccessibilityTypes::ROLE_MENUBAR; } -bool MenuScrollViewContainer::GetAccessibleState( - AccessibilityTypes::State* state) { - DCHECK(state); +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 = AccessibilityTypes::STATE_FOCUSED; - return true; + 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 41a0188..52a2b78 100644 --- a/views/controls/menu/menu_scroll_view_container.h +++ b/views/controls/menu/menu_scroll_view_container.h @@ -29,8 +29,8 @@ class MenuScrollViewContainer : public View { virtual void DidChangeBounds(const gfx::Rect& previous, const gfx::Rect& current); virtual gfx::Size GetPreferredSize(); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleState(AccessibilityTypes::State* state); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); private: class MenuScrollView; diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc index 0df12e5..053b804 100644 --- a/views/controls/menu/submenu_view.cc +++ b/views/controls/menu/submenu_view.cc @@ -127,9 +127,8 @@ void SubmenuView::DidChangeBounds(const gfx::Rect& previous, SchedulePaint(); } -bool SubmenuView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_MENUPOPUP; - return true; +AccessibilityTypes::Role SubmenuView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_MENUPOPUP; } void SubmenuView::PaintChildren(gfx::Canvas* canvas) { diff --git a/views/controls/menu/submenu_view.h b/views/controls/menu/submenu_view.h index 263f988..fa2b9a7 100644 --- a/views/controls/menu/submenu_view.h +++ b/views/controls/menu/submenu_view.h @@ -59,7 +59,7 @@ class SubmenuView : public View { const gfx::Rect& current); // Override from View. - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Painting. void PaintChildren(gfx::Canvas* canvas); diff --git a/views/controls/progress_bar.cc b/views/controls/progress_bar.cc index e4fc467..8c6f0d0 100644 --- a/views/controls/progress_bar.cc +++ b/views/controls/progress_bar.cc @@ -183,16 +183,12 @@ void ProgressBar::SetEnabled(bool enabled) { // TODO(denisromanov): Need to switch progress bar color here? } -bool ProgressBar::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - *role = AccessibilityTypes::ROLE_PROGRESSBAR; - return true; +AccessibilityTypes::Role ProgressBar::GetAccessibleRole() { + return AccessibilityTypes::ROLE_PROGRESSBAR; } -bool ProgressBar::GetAccessibleState(AccessibilityTypes::State* state) { - DCHECK(state); - *state = AccessibilityTypes::STATE_READONLY; - return true; +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 b1d7043..e7fe4d2 100644 --- a/views/controls/progress_bar.h +++ b/views/controls/progress_bar.h @@ -58,8 +58,8 @@ class ProgressBar : public View { virtual void SetEnabled(bool enabled); // Accessibility accessors, overridden from View. - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleState(AccessibilityTypes::State* state); + 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 bab166b1..362f48f 100644 --- a/views/controls/progress_bar_unittest.cc +++ b/views/controls/progress_bar_unittest.cc @@ -47,9 +47,7 @@ TEST(ProgressBarTest, Accessibility) { ProgressBar bar; bar.SetProgress(62); - AccessibilityTypes::Role role; - EXPECT_TRUE(bar.GetAccessibleRole(&role)); - EXPECT_EQ(AccessibilityTypes::ROLE_PROGRESSBAR, role); + EXPECT_EQ(AccessibilityTypes::ROLE_PROGRESSBAR, bar.GetAccessibleRole()); std::wstring name; EXPECT_FALSE(bar.GetAccessibleName(&name)); @@ -59,10 +57,7 @@ TEST(ProgressBarTest, Accessibility) { EXPECT_TRUE(bar.GetAccessibleName(&name)); EXPECT_EQ(accessible_name, name); - - AccessibilityTypes::State state; - EXPECT_TRUE(bar.GetAccessibleState(&state)); - EXPECT_TRUE(AccessibilityTypes::STATE_READONLY & state); + EXPECT_TRUE(AccessibilityTypes::STATE_READONLY & bar.GetAccessibleState()); } } // namespace views diff --git a/views/controls/resize_area.cc b/views/controls/resize_area.cc index 21afb62..950d97c 100644 --- a/views/controls/resize_area.cc +++ b/views/controls/resize_area.cc @@ -70,10 +70,8 @@ void ResizeArea::OnMouseReleased(const views::MouseEvent& event, ReportResizeAmount(canceled ? initial_position_ : event.x(), true); } -bool ResizeArea::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - *role = AccessibilityTypes::ROLE_SEPARATOR; - return true; +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 cea7d0f..4f398ca 100644 --- a/views/controls/resize_area.h +++ b/views/controls/resize_area.h @@ -47,7 +47,7 @@ class ResizeArea : public View { virtual bool OnMousePressed(const views::MouseEvent& event); virtual bool OnMouseDragged(const views::MouseEvent& event); virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + 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 9a7a9e3..94360bb 100644 --- a/views/controls/scrollbar/scroll_bar.cc +++ b/views/controls/scrollbar/scroll_bar.cc @@ -22,11 +22,8 @@ ScrollBar::ScrollBar(bool is_horiz) : is_horiz_(is_horiz), ScrollBar::~ScrollBar() { } -bool ScrollBar::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_SCROLLBAR; - return true; +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 cd23a0f..3a26b04 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 bool GetAccessibleRole(AccessibilityTypes::Role* role); + 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 cd1deeb..1a3ca70 100644 --- a/views/controls/separator.cc +++ b/views/controls/separator.cc @@ -92,11 +92,8 @@ std::string Separator::GetClassName() const { return kViewClassName; } -bool Separator::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_SEPARATOR; - return true; +AccessibilityTypes::Role Separator::GetAccessibleRole() { + return AccessibilityTypes::ROLE_SEPARATOR; } //////////////////////////////////////////////////////////////////////////////// diff --git a/views/controls/separator.h b/views/controls/separator.h index 82c4260..186d84f 100644 --- a/views/controls/separator.h +++ b/views/controls/separator.h @@ -26,7 +26,7 @@ class Separator : public View { // Overridden from View: virtual void Layout(); virtual gfx::Size GetPreferredSize(); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: virtual void ViewHierarchyChanged(bool is_add, View* parent, diff --git a/views/controls/single_split_view.cc b/views/controls/single_split_view.cc index 298a540..debe716 100644 --- a/views/controls/single_split_view.cc +++ b/views/controls/single_split_view.cc @@ -94,9 +94,8 @@ void SingleSplitView::Layout() { View::Layout(); } -bool SingleSplitView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_GROUPING; - return true; +AccessibilityTypes::Role SingleSplitView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_GROUPING; } gfx::Size SingleSplitView::GetPreferredSize() { diff --git a/views/controls/single_split_view.h b/views/controls/single_split_view.h index 8f53410..c3814b1 100644 --- a/views/controls/single_split_view.h +++ b/views/controls/single_split_view.h @@ -26,7 +26,7 @@ class SingleSplitView : public views::View { virtual void Layout(); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); // SingleSplitView's preferred size is the sum of the preferred widths // and the max of the heights. diff --git a/views/controls/tabbed_pane/tabbed_pane.cc b/views/controls/tabbed_pane/tabbed_pane.cc index 8061821..429e4c4 100644 --- a/views/controls/tabbed_pane/tabbed_pane.cc +++ b/views/controls/tabbed_pane/tabbed_pane.cc @@ -129,11 +129,8 @@ void TabbedPane::PaintFocusBorder(gfx::Canvas* canvas) { View::PaintFocusBorder(canvas); } -bool TabbedPane::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_PAGETABLIST; - return true; +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 da077c3..3d8d227a 100644 --- a/views/controls/tabbed_pane/tabbed_pane.h +++ b/views/controls/tabbed_pane/tabbed_pane.h @@ -71,7 +71,7 @@ class TabbedPane : public View { virtual void Layout(); virtual void Focus(); virtual void PaintFocusBorder(gfx::Canvas* canvas); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); virtual gfx::Size GetPreferredSize(); NativeTabbedPaneWrapper* native_wrapper() const { diff --git a/views/controls/textfield/textfield.cc b/views/controls/textfield/textfield.cc index fc8d081..32d4e39 100644 --- a/views/controls/textfield/textfield.cc +++ b/views/controls/textfield/textfield.cc @@ -258,33 +258,23 @@ void Textfield::PaintFocusBorder(gfx::Canvas* canvas) { View::PaintFocusBorder(canvas); } -bool Textfield::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_TEXT; - return true; +AccessibilityTypes::Role Textfield::GetAccessibleRole() { + return AccessibilityTypes::ROLE_TEXT; } -bool Textfield::GetAccessibleState(AccessibilityTypes::State* state) { - DCHECK(state); - - *state = 0; - +AccessibilityTypes::State Textfield::GetAccessibleState() { + int state = 0; if (read_only()) - *state |= AccessibilityTypes::STATE_READONLY; + state |= AccessibilityTypes::STATE_READONLY; if (IsPassword()) - *state |= AccessibilityTypes::STATE_PROTECTED; - return true; + state |= AccessibilityTypes::STATE_PROTECTED; + return state; } -bool Textfield::GetAccessibleValue(std::wstring* value) { - DCHECK(value); - - if (!text_.empty()) { - *value = UTF16ToWide(text_); - return true; - } - return false; +std::wstring Textfield::GetAccessibleValue() { + if (!text_.empty()) + return UTF16ToWide(text_); + return std::wstring(); } void Textfield::SetEnabled(bool enabled) { diff --git a/views/controls/textfield/textfield.h b/views/controls/textfield/textfield.h index 3bd6c31..35c3932 100644 --- a/views/controls/textfield/textfield.h +++ b/views/controls/textfield/textfield.h @@ -230,9 +230,9 @@ class Textfield : public View { virtual void PaintFocusBorder(gfx::Canvas* canvas); // Accessibility accessors, overridden from View: - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleState(AccessibilityTypes::State* state); - virtual bool GetAccessibleValue(std::wstring* value); + virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual AccessibilityTypes::State GetAccessibleState(); + virtual std::wstring GetAccessibleValue(); protected: virtual void Focus(); diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index 27edeaf..6b02a62 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -56,18 +56,12 @@ TreeView::~TreeView() { ImageList_Destroy(image_list_); } -bool TreeView::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_OUTLINE; - return true; +AccessibilityTypes::Role TreeView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_OUTLINE; } -bool TreeView::GetAccessibleState(AccessibilityTypes::State* state) { - DCHECK(state); - - *state = AccessibilityTypes::STATE_READONLY; - return true; +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 593219c..61c6001 100644 --- a/views/controls/tree/tree_view.h +++ b/views/controls/tree/tree_view.h @@ -79,8 +79,8 @@ class TreeView : public NativeControl, TreeModelObserver { } // Overridden from View: - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleState(AccessibilityTypes::State* state); + 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/view.cc b/views/view.cc index a4e7aa0..e1a5fef 100644 --- a/views/view.cc +++ b/views/view.cc @@ -1166,22 +1166,14 @@ bool View::GetAccessibleName(std::wstring* name) { return true; } -bool View::GetAccessibleRole(AccessibilityTypes::Role* role) { - if (accessible_role_) { - *role = accessible_role_; - return true; - } - return false; +AccessibilityTypes::Role View::GetAccessibleRole() { + return AccessibilityTypes::ROLE_CLIENT; } void View::SetAccessibleName(const std::wstring& name) { accessible_name_ = name; } -void View::SetAccessibleRole(const AccessibilityTypes::Role role) { - accessible_role_ = role; -} - // static void View::ConvertPointToView(const View* src, const View* dst, diff --git a/views/view.h b/views/view.h index 2504667..dbff72b 100644 --- a/views/view.h +++ b/views/view.h @@ -555,7 +555,7 @@ class View : public AcceleratorTarget { virtual bool HasFocus(); // Accessibility support - // TODO(klink): Move all this out to a AccessibleInfo wrapper class. + // 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. @@ -569,17 +569,13 @@ class View : public AcceleratorTarget { // 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'. Sets the input string appropriately, and returns true if - // successful. - virtual bool GetAccessibleDefaultAction(std::wstring* action) { - return false; - } + // 'Press'. + virtual std::wstring GetAccessibleDefaultAction() { return std::wstring(); } // Returns a string containing the mnemonic, or the keyboard shortcut, for a - // given control. Sets the input string appropriately, and returns true if - // successful. - virtual bool GetAccessibleKeyboardShortcut(std::wstring* shortcut) { - return false; + // given control. + virtual std::wstring GetAccessibleKeyboardShortcut() { + return std::wstring(); } // Returns a brief, identifying string, containing a unique, readable name of @@ -589,27 +585,22 @@ class View : public AcceleratorTarget { // 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. Sets the input Role appropriately, and returns true if - // successful. - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + // a given control. + virtual AccessibilityTypes::Role GetAccessibleRole(); - // Returns the accessibility state of the current view. Sets the input State - // appropriately, and returns true if successful. - virtual bool GetAccessibleState(AccessibilityTypes::State* state) { - return false; + // Returns the accessibility state of the current view. + virtual AccessibilityTypes::State GetAccessibleState() { + return 0; } - // Returns the current value associated with a view. Sets the input string - // appropriately, and returns true if successful. - virtual bool GetAccessibleValue(std::wstring* value) { return false; } + // Returns the current value associated with a view. + virtual std::wstring GetAccessibleValue() { return std::wstring(); } // 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 std::wstring& name); - void SetAccessibleRole(const AccessibilityTypes::Role role); - // Returns an instance of a wrapper class implementing the (platform-specific) // accessibility interface for a given View. If one exists, it will be // re-used, otherwise a new instance will be created. @@ -1305,9 +1296,6 @@ class View : public AcceleratorTarget { // Name for this view, which can be retrieved by accessibility APIs. std::wstring accessible_name_; - // Role for this view, which can be retrieved by accessibility APIs. - AccessibilityTypes::Role accessible_role_; - // Next view to be focused when the Tab key is pressed. View* next_focusable_view_; diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc index 8b8f896..a9c2484 100644 --- a/views/widget/root_view.cc +++ b/views/widget/root_view.cc @@ -751,11 +751,8 @@ void RootView::ClearPaintRect() { // ///////////////////////////////////////////////////////////////////////////// -bool RootView::GetAccessibleRole(AccessibilityTypes::Role* role) { - DCHECK(role); - - *role = AccessibilityTypes::ROLE_APPLICATION; - return true; +AccessibilityTypes::Role RootView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_APPLICATION; } View* RootView::GetDragView() { diff --git a/views/widget/root_view.h b/views/widget/root_view.h index 91c1672..bf81536 100644 --- a/views/widget/root_view.h +++ b/views/widget/root_view.h @@ -180,7 +180,7 @@ class RootView : public View, int operation); // Accessibility accessors/mutators, overridden from View. - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); #if defined(TOUCH_UI) && defined(UNIT_TEST) // For unit testing purposes, we use this method to set a mock diff --git a/views/window/client_view.cc b/views/window/client_view.cc index fd03217..4535867 100644 --- a/views/window/client_view.cc +++ b/views/window/client_view.cc @@ -63,9 +63,8 @@ void ClientView::DidChangeBounds(const gfx::Rect& previous, // NonClientView::Layout. } -bool ClientView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_CLIENT; - return true; +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 fc79f73..aa5e257 100644 --- a/views/window/client_view.h +++ b/views/window/client_view.h @@ -63,7 +63,7 @@ class ClientView : public View { virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); virtual void DidChangeBounds(const gfx::Rect& previous, const gfx::Rect& current); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); // Accessors for private data members. Window* window() const { return window_; } diff --git a/views/window/non_client_view.cc b/views/window/non_client_view.cc index 620df29..02b51c3 100644 --- a/views/window/non_client_view.cc +++ b/views/window/non_client_view.cc @@ -174,9 +174,8 @@ views::View* NonClientView::GetViewForPoint(const gfx::Point& point) { return View::GetViewForPoint(point); } -bool NonClientView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_WINDOW; - return true; +AccessibilityTypes::Role NonClientView::GetAccessibleRole() { + return AccessibilityTypes::ROLE_WINDOW; } //////////////////////////////////////////////////////////////////////////////// @@ -250,9 +249,8 @@ bool NonClientFrameView::ShouldPaintAsActive() const { return GetWindow()->IsActive() || paint_as_active_; } -bool NonClientFrameView::GetAccessibleRole(AccessibilityTypes::Role* role) { - *role = AccessibilityTypes::ROLE_WINDOW; - return true; +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 ced8063..e13e90a 100644 --- a/views/window/non_client_view.h +++ b/views/window/non_client_view.h @@ -70,8 +70,7 @@ class NonClientFrameView : public View { // Overridden from View: virtual bool HitTest(const gfx::Point& l) const; - - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: virtual void DidChangeBounds(const gfx::Rect& previous, @@ -211,7 +210,7 @@ class NonClientView : public View { virtual gfx::Size GetPreferredSize(); virtual gfx::Size GetMinimumSize(); virtual void Layout(); - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual AccessibilityTypes::Role GetAccessibleRole(); protected: // NonClientView, View overrides: |