diff options
Diffstat (limited to 'chrome/browser/ui')
56 files changed, 370 insertions, 335 deletions
diff --git a/chrome/browser/ui/views/accessibility_event_router_views.cc b/chrome/browser/ui/views/accessibility_event_router_views.cc index b296cac..5986d92 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 "views/accessibility/accessibility_types.h" +#include "ui/base/accessibility/accessible_view_state.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, AccessibilityTypes::Event event_type) { + views::View* view, ui::AccessibilityTypes::Event event_type) { if (!ExtensionAccessibilityEventRouter::GetInstance()-> IsAccessibilityEnabled()) { return; } switch (event_type) { - case AccessibilityTypes::EVENT_FOCUS: + case ui::AccessibilityTypes::EVENT_FOCUS: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_CONTROL_FOCUSED); break; - case AccessibilityTypes::EVENT_MENUSTART: - case AccessibilityTypes::EVENT_MENUPOPUPSTART: + case ui::AccessibilityTypes::EVENT_MENUSTART: + case ui::AccessibilityTypes::EVENT_MENUPOPUPSTART: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_MENU_OPENED); break; - case AccessibilityTypes::EVENT_MENUEND: - case AccessibilityTypes::EVENT_MENUPOPUPEND: + case ui::AccessibilityTypes::EVENT_MENUEND: + case ui::AccessibilityTypes::EVENT_MENUPOPUPEND: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_MENU_CLOSED); break; - case AccessibilityTypes::EVENT_TEXT_CHANGED: - case AccessibilityTypes::EVENT_SELECTION_CHANGED: + case ui::AccessibilityTypes::EVENT_TEXT_CHANGED: + case ui::AccessibilityTypes::EVENT_SELECTION_CHANGED: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_TEXT_CHANGED); break; - case AccessibilityTypes::EVENT_VALUE_CHANGED: + case ui::AccessibilityTypes::EVENT_VALUE_CHANGED: DispatchAccessibilityNotification( view, NotificationType::ACCESSIBILITY_CONTROL_ACTION); break; - case AccessibilityTypes::EVENT_ALERT: - case AccessibilityTypes::EVENT_NAME_CHANGED: + case ui::AccessibilityTypes::EVENT_ALERT: + case ui::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) { - string16 wname; - view->GetAccessibleName(&wname); - return UTF16ToUTF8(wname); + ui::AccessibleViewState state; + view->GetAccessibleState(&state); + return UTF16ToUTF8(state.name); } void AccessibilityEventRouterViews::DispatchAccessibilityNotification( @@ -202,9 +202,11 @@ bool AccessibilityEventRouterViews::IsMenuEvent( return true; while (view) { - AccessibilityTypes::Role role = view->GetAccessibleRole(); - if (role == AccessibilityTypes::ROLE_MENUITEM || - role == AccessibilityTypes::ROLE_MENUPOPUP) { + ui::AccessibleViewState state; + view->GetAccessibleState(&state); + ui::AccessibilityTypes::Role role = state.role; + if (role == ui::AccessibilityTypes::ROLE_MENUITEM || + role == ui::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 77b256d..6dfdf78 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 "views/accessibility/accessibility_types.h" +#include "ui/base/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, AccessibilityTypes::Event event_type); + views::View* view, ui::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 caecfbb..7fb4751 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, AccessibilityTypes::Event event_type) { + views::View* view, ui::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 c6789bc..9dfa4a2 100644 --- a/chrome/browser/ui/views/accessible_pane_view.cc +++ b/chrome/browser/ui/views/accessible_pane_view.cc @@ -7,6 +7,7 @@ #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" @@ -192,8 +193,8 @@ void AccessiblePaneView::SetVisible(bool flag) { View::SetVisible(flag); } -AccessibilityTypes::Role AccessiblePaneView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_PANE; +void AccessiblePaneView::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::AccessibilityTypes::ROLE_PANE; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/accessible_pane_view.h b/chrome/browser/ui/views/accessible_pane_view.h index 349fc0d..8f7d56c 100644 --- a/chrome/browser/ui/views/accessible_pane_view.h +++ b/chrome/browser/ui/views/accessible_pane_view.h @@ -41,19 +41,20 @@ class AccessiblePaneView : public views::View, virtual bool SetPaneFocusAndFocusDefault(int view_storage_id); // Overridden from views::View: - virtual FocusTraversable* GetPaneFocusTraversable(); - virtual bool AcceleratorPressed(const views::Accelerator& accelerator); - virtual void SetVisible(bool flag); - virtual AccessibilityTypes::Role GetAccessibleRole(); + 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; // Overridden from views::FocusChangeListener: virtual void FocusWillChange(View* focused_before, - View* focused_now); + View* focused_now) OVERRIDE; // Overridden from views::FocusTraversable: - virtual views::FocusSearch* GetFocusSearch(); - virtual FocusTraversable* GetFocusTraversableParent(); - virtual View* GetFocusTraversableParentView(); + virtual views::FocusSearch* GetFocusSearch() OVERRIDE; + virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; + virtual View* GetFocusTraversableParentView() OVERRIDE; 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 78f19ab..28c3a31 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc @@ -86,8 +86,9 @@ void BookmarkBarInstructionsView::ViewHierarchyChanged(bool is_add, UpdateColors(); } -AccessibilityTypes::Role BookmarkBarInstructionsView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; +void BookmarkBarInstructionsView::GetAccessibleState( + ui::AccessibleViewState* state) { + state->role = ui::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 3b6bf13..675df4a 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h @@ -6,6 +6,7 @@ #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" @@ -35,16 +36,16 @@ class BookmarkBarInstructionsView : public views::View, explicit BookmarkBarInstructionsView(Delegate* delegate); // View overrides. - virtual gfx::Size GetPreferredSize(); - virtual void Layout(); - virtual void OnThemeChanged(); + virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual void Layout() OVERRIDE; + virtual void OnThemeChanged() OVERRIDE; virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child); - virtual AccessibilityTypes::Role GetAccessibleRole(); + views::View* child) OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // LinkController. - virtual void LinkActivated(views::Link* source, int event_flags); + virtual void LinkActivated(views::Link* source, int event_flags) OVERRIDE; 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 c1cb88d89..d61b4ad 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -40,6 +40,7 @@ #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" @@ -297,7 +298,7 @@ class BookmarkBarView::ButtonSeparatorView : public views::View { ButtonSeparatorView() {} virtual ~ButtonSeparatorView() {} - virtual void OnPaint(gfx::Canvas* canvas) { + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { DetachableToolbarView::PaintVerticalDivider( canvas, kSeparatorStartX, height(), 1, DetachableToolbarView::kEdgeDividerColor, @@ -305,14 +306,15 @@ class BookmarkBarView::ButtonSeparatorView : public views::View { GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TOOLBAR)); } - virtual gfx::Size GetPreferredSize() { + virtual gfx::Size GetPreferredSize() OVERRIDE { // We get the full height of the bookmark bar, so that the height returned // here doesn't matter. return gfx::Size(kSeparatorWidth, 1); } - virtual AccessibilityTypes::Role GetAccessibleRole() { - return AccessibilityTypes::ROLE_SEPARATOR; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE { + state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR); + state->role = ui::AccessibilityTypes::ROLE_SEPARATOR; } private: @@ -675,12 +677,9 @@ void BookmarkBarView::ShowContextMenu(const gfx::Point& p, ShowContextMenu(this, p, is_mouse_gesture); } -bool BookmarkBarView::IsAccessibleViewTraversable(views::View* view) { - return view != bookmarks_separator_view_ && view != instructions_; -} - -AccessibilityTypes::Role BookmarkBarView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_TOOLBAR; +void BookmarkBarView::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::AccessibilityTypes::ROLE_TOOLBAR; + state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS); } void BookmarkBarView::OnStateChanged() { @@ -881,8 +880,6 @@ 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 5737e7c..214893c 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h @@ -109,34 +109,36 @@ class BookmarkBarView : public DetachableToolbarView, infobar_visible_ = infobar_visible; } - // DetachableToolbarView methods: - virtual bool IsDetached() const; virtual bool IsOnTop() const; - virtual double GetAnimationValue() const; - virtual int GetToolbarOverlap() const { + + // DetachableToolbarView methods: + virtual bool IsDetached() const OVERRIDE; + virtual double GetAnimationValue() const OVERRIDE; + virtual int GetToolbarOverlap() const OVERRIDE { return GetToolbarOverlap(false); } // View methods: - 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 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 bool GetDropFormats( int* formats, - 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); + 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; // AccessiblePaneView methods: - virtual bool IsAccessibleViewTraversable(views::View* view); - virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // 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 49ea7e2..9bb6721 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc @@ -18,6 +18,7 @@ #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" @@ -84,7 +85,7 @@ class ViewsDelegateImpl : public views::ViewsDelegate { } virtual void NotifyAccessibilityEvent( - views::View* view, AccessibilityTypes::Event event_type) {} + views::View* view, ui::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 6870f65..d85548f 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -33,6 +33,7 @@ #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" @@ -170,7 +171,6 @@ void BrowserActionButton::UpdateState() { if (name.empty()) name = UTF8ToUTF16(extension()->name()); SetTooltipText(UTF16ToWideHack(name)); - SetAccessibleName(name); parent()->SchedulePaint(); } @@ -292,8 +292,6 @@ BrowserActionView::BrowserActionView(const Extension* extension, button_->SetDragController(panel_); AddChildView(button_); button_->UpdateState(); - SetAccessibleName( - l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION)); } BrowserActionView::~BrowserActionView() { @@ -319,8 +317,10 @@ gfx::Canvas* BrowserActionView::GetIconWithBadge() { return canvas; } -AccessibilityTypes::Role BrowserActionView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; +void BrowserActionView::GetAccessibleState(ui::AccessibleViewState* state) { + state->name = l10n_util::GetStringUTF16( + IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION); + state->role = ui::AccessibilityTypes::ROLE_GROUPING; } void BrowserActionView::Layout() { @@ -372,8 +372,6 @@ 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); @@ -383,8 +381,6 @@ 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() { @@ -741,8 +737,10 @@ void BrowserActionsContainer::OnThemeChanged() { LoadImages(); } -AccessibilityTypes::Role BrowserActionsContainer::GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; +void BrowserActionsContainer::GetAccessibleState( + ui::AccessibleViewState* state) { + state->role = ui::AccessibilityTypes::ROLE_GROUPING; + state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS); } 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 94c13139e..d803447 100644 --- a/chrome/browser/ui/views/browser_actions_container.h +++ b/chrome/browser/ui/views/browser_actions_container.h @@ -27,7 +27,6 @@ #include "views/view.h" class Browser; -class BrowserActionsContainer; class BrowserActionOverflowMenuController; class BrowserActionsContainer; class Extension; @@ -163,7 +162,7 @@ class BrowserActionView : public views::View { gfx::Canvas* GetIconWithBadge(); // Accessibility accessors, overridden from View. - virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; private: virtual void Layout(); @@ -331,7 +330,7 @@ class BrowserActionsContainer virtual void OnDragExited(); virtual int OnPerformDrop(const views::DropTargetEvent& event); virtual void OnThemeChanged(); - virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // 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 3771682..ecd9e92 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, AccessibilityTypes::Event event_type) { + views::View* view, ui::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 c48f07b..952ae43 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.h +++ b/chrome/browser/ui/views/chrome_views_delegate.h @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "build/build_config.h" +#include "ui/base/accessibility/accessibility_types.h" #include "views/views_delegate.h" namespace views { @@ -32,7 +33,7 @@ class ChromeViewsDelegate : public views::ViewsDelegate { const std::wstring& window_name, bool* maximized) const; virtual void NotifyAccessibilityEvent( - views::View* view, AccessibilityTypes::Event event_type); + views::View* view, ui::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 1783b16..eaafa09 100644 --- a/chrome/browser/ui/views/download_item_view.cc +++ b/chrome/browser/ui/views/download_item_view.cc @@ -20,6 +20,7 @@ #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" @@ -949,15 +950,13 @@ void DownloadItemView::ShowContextMenu(const gfx::Point& p, } } -AccessibilityTypes::Role DownloadItemView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_PUSHBUTTON; -} - -AccessibilityTypes::State DownloadItemView::GetAccessibleState() { +void DownloadItemView::GetAccessibleState(ui::AccessibleViewState* state) { + state->name = accessible_name_; + state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; if (download_->safety_state() == DownloadItem::DANGEROUS) { - return AccessibilityTypes::STATE_UNAVAILABLE; + state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; } else { - return AccessibilityTypes::STATE_HASPOPUP; + state->state = ui::AccessibilityTypes::STATE_HASPOPUP; } } @@ -1079,9 +1078,6 @@ 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()); @@ -1090,12 +1086,13 @@ void DownloadItemView::UpdateAccessibleName() { download_->GetFileNameToReportUser().LossyDisplayName(); } - // 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); + // 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); + } } } diff --git a/chrome/browser/ui/views/download_item_view.h b/chrome/browser/ui/views/download_item_view.h index e8f427a..6994378 100644 --- a/chrome/browser/ui/views/download_item_view.h +++ b/chrome/browser/ui/views/download_item_view.h @@ -77,8 +77,7 @@ 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 AccessibilityTypes::Role GetAccessibleRole(); - virtual AccessibilityTypes::State GetAccessibleState(); + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // ButtonListener implementation. virtual void ButtonPressed(views::Button* sender, const views::Event& event); @@ -279,6 +278,9 @@ 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 0e6dd44..d204d62c 100644 --- a/chrome/browser/ui/views/first_run_search_engine_view.cc +++ b/chrome/browser/ui/views/first_run_search_engine_view.cc @@ -18,10 +18,11 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/ui/options/options_window.h" #include "grit/chromium_strings.h" -#include "grit/google_chrome_strings.h" #include "grit/generated_resources.h" +#include "grit/google_chrome_strings.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" @@ -265,7 +266,8 @@ 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). - NotifyAccessibilityEvent(AccessibilityTypes::EVENT_ALERT); + GetWidget()->NotifyAccessibilityEvent( + this, ui::AccessibilityTypes::EVENT_ALERT, true); } gfx::Size FirstRunSearchEngineView::GetPreferredSize() { @@ -427,8 +429,9 @@ void FirstRunSearchEngineView::Layout() { } // if (search_engine_choices.size() > 0) } -AccessibilityTypes::Role FirstRunSearchEngineView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_ALERT; +void FirstRunSearchEngineView::GetAccessibleState( + ui::AccessibleViewState* state) { + state->role = ui::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 5db011b..eee914c 100644 --- a/chrome/browser/ui/views/first_run_search_engine_view.h +++ b/chrome/browser/ui/views/first_run_search_engine_view.h @@ -88,29 +88,31 @@ class FirstRunSearchEngineView virtual ~FirstRunSearchEngineView(); + bool IsAlwaysOnTop() const { return true; } + bool HasAlwaysOnTopMenu() const { return false; } + // Overridden from views::View: - virtual gfx::Size GetPreferredSize(); - virtual void Layout(); - virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual void Layout() OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // Overridden from views::WindowDelegate: - 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; } + virtual std::wstring GetWindowTitle() const OVERRIDE; + views::View* GetContentsView() OVERRIDE { return this; } + bool CanResize() const OVERRIDE{ return false; } + bool CanMaximize() const OVERRIDE { return false; } // Overridden from views::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event); + virtual void ButtonPressed(views::Button* sender, const views::Event& event) + OVERRIDE; // Override from View so we can draw the gray background at dialog top. - virtual void OnPaint(gfx::Canvas* canvas); + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; // 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(); + virtual void OnTemplateURLModelChanged() OVERRIDE; private: // Initializes the labels and controls in the view. @@ -141,4 +143,3 @@ 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 094e6c3..6476bc4 100644 --- a/chrome/browser/ui/views/frame/browser_root_view.cc +++ b/chrome/browser/ui/views/frame/browser_root_view.cc @@ -14,6 +14,7 @@ #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" @@ -22,9 +23,7 @@ BrowserRootView::BrowserRootView(BrowserView* browser_view, views::Widget* widget) : views::RootView(widget), browser_view_(browser_view), - forwarding_to_tab_strip_(false) { - SetAccessibleName(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); -} + forwarding_to_tab_strip_(false) { } bool BrowserRootView::GetDropFormats( int* formats, @@ -110,6 +109,11 @@ 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 1fcccb5..bba1c10 100644 --- a/chrome/browser/ui/views/frame/browser_root_view.h +++ b/chrome/browser/ui/views/frame/browser_root_view.h @@ -25,15 +25,17 @@ 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); - 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); + 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; 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 aba18fb..328b449 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -74,6 +74,7 @@ #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" @@ -1825,8 +1826,9 @@ void BrowserView::ChildPreferredSizeChanged(View* child) { Layout(); } -AccessibilityTypes::Role BrowserView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_CLIENT; +void BrowserView::GetAccessibleState(ui::AccessibleViewState* state) { + state->name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); + state->role = ui::AccessibilityTypes::ROLE_CLIENT; } void BrowserView::InfoBarContainerSizeChanged(bool is_animating) { @@ -1855,8 +1857,6 @@ 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,14 +1884,12 @@ 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_); @@ -2022,8 +2020,6 @@ 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 fecd185..74a71b0 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; - virtual void Layout(); - virtual void PaintChildren(gfx::Canvas* canvas); + virtual std::string GetClassName() const OVERRIDE; + virtual void Layout() OVERRIDE; + virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child); - virtual void ChildPreferredSizeChanged(View* child); - virtual AccessibilityTypes::Role GetAccessibleRole(); + views::View* child) OVERRIDE; + virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // 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 3bdbd2c..c68c571 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -16,6 +16,7 @@ #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" @@ -400,8 +401,9 @@ bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { return browser_view_->IsPositionInWindowCaption(browser_view_point); } -AccessibilityTypes::Role OpaqueBrowserFrameView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_TITLEBAR; +void OpaqueBrowserFrameView::GetAccessibleState( + ui::AccessibleViewState* state) { + state->role = ui::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 0303d3a..a001b5d 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h @@ -45,28 +45,30 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, virtual gfx::Rect GetBoundsForReservedArea() const; // Overridden from views::NonClientFrameView: - virtual gfx::Rect GetBoundsForClientView() const; - virtual bool AlwaysUseNativeFrame() const; - virtual bool AlwaysUseCustomFrame() const; + virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; + virtual bool AlwaysUseNativeFrame() const OVERRIDE; + virtual bool AlwaysUseCustomFrame() const OVERRIDE; virtual gfx::Rect GetWindowBoundsForClientBounds( - 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(); + 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; // Overridden from views::View: - virtual void OnPaint(gfx::Canvas* canvas); - virtual void Layout(); - virtual bool HitTest(const gfx::Point& l) const; - virtual AccessibilityTypes::Role GetAccessibleRole(); + 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; // Overridden from views::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event); + virtual void ButtonPressed(views::Button* sender, const views::Event& event) + OVERRIDE; // Overridden from TabIconView::TabIconViewModel: - virtual bool ShouldTabIconViewAnimate() const; - virtual SkBitmap GetFavIconForTabIconView(); + virtual bool ShouldTabIconViewAnimate() const OVERRIDE; + virtual SkBitmap GetFavIconForTabIconView() OVERRIDE; 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 20761aa..d8a1c72 100644 --- a/chrome/browser/ui/views/infobars/infobar_container.cc +++ b/chrome/browser/ui/views/infobars/infobar_container.cc @@ -12,6 +12,7 @@ #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() { @@ -21,7 +22,6 @@ 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,8 +109,9 @@ void InfoBarContainer::Layout() { } } -AccessibilityTypes::Role InfoBarContainer::GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; +void InfoBarContainer::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::AccessibilityTypes::ROLE_GROUPING; + state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_CONTAINER); } 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 4dba347..0715192 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(); - virtual void Layout(); - virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual void Layout() OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // NotificationObserver: virtual void Observe(NotificationType type, const NotificationSource& source, - const NotificationDetails& details); + const NotificationDetails& details) OVERRIDE; // 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 c973d2a..97689bf 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.cc +++ b/chrome/browser/ui/views/infobars/infobar_view.cc @@ -13,6 +13,7 @@ #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" @@ -54,9 +55,6 @@ 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); } @@ -273,7 +271,8 @@ void InfoBarView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { #endif if (GetFocusManager()) GetFocusManager()->AddFocusChangeListener(this); - NotifyAccessibilityEvent(AccessibilityTypes::EVENT_ALERT); + GetWidget()->NotifyAccessibilityEvent( + this, ui::AccessibilityTypes::EVENT_ALERT, true); if (close_button_ == NULL) { SkBitmap* image = delegate_->GetIcon(); @@ -364,8 +363,11 @@ int InfoBarView::OffsetY(const gfx::Size prefsize) const { return CenterY(prefsize) - (target_height_ - height()); } -AccessibilityTypes::Role InfoBarView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_ALERT; +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; } gfx::Size InfoBarView::GetPreferredSize() { @@ -377,8 +379,10 @@ 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)) - NotifyAccessibilityEvent(AccessibilityTypes::EVENT_ALERT); + this->Contains(focused_now)) { + GetWidget()->NotifyAccessibilityEvent( + this, ui::AccessibilityTypes::EVENT_ALERT, true); + } } 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 fe3655b..dbe847f 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.h +++ b/chrome/browser/ui/views/infobars/infobar_view.h @@ -106,14 +106,16 @@ class InfoBarView : public InfoBar, bool needs_elevation); // views::View: - virtual void Layout(); - virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); + virtual void Layout() OVERRIDE; + virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child) + OVERRIDE; // views::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event); + virtual void ButtonPressed(views::Button* sender, const views::Event& event) + OVERRIDE; // ui::AnimationDelegate: - virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; // 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 @@ -147,14 +149,15 @@ class InfoBarView : public InfoBar, static const int kHorizontalPadding; // views::View: - virtual AccessibilityTypes::Role GetAccessibleRole(); - virtual gfx::Size GetPreferredSize(); + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize() OVERRIDE; // views::FocusChangeListener: - virtual void FocusWillChange(View* focused_before, View* focused_now); + virtual void FocusWillChange(View* focused_before, View* focused_now) + OVERRIDE; // ui::AnimationDelegate: - virtual void AnimationEnded(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; // 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 686c6f7..6afd564 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -37,6 +37,7 @@ #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" @@ -172,8 +173,6 @@ 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, @@ -205,8 +204,6 @@ 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); @@ -1055,8 +1052,9 @@ bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { #endif } -AccessibilityTypes::Role LocationBarView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; +void LocationBarView::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::AccessibilityTypes::ROLE_GROUPING; + state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION); } 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 90607c8..2226c3a 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 AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) 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 1e7ca9a..1127067 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,12 +8,13 @@ #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, @@ -101,8 +102,8 @@ void PageActionImageView::ExecuteAction(int button, } } -AccessibilityTypes::Role PageActionImageView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_PUSHBUTTON; +void PageActionImageView::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::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 ed0f190..47c39fd 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,21 +41,23 @@ class PageActionImageView : public views::ImageView, } // Overridden from view. - 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); + 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; // Overridden from ImageLoadingTracker. virtual void OnImageLoaded( - SkBitmap* image, ExtensionResource resource, int index); + SkBitmap* image, ExtensionResource resource, int index) OVERRIDE; // Overridden from ExtensionContextMenuModelModel::Delegate - virtual void InspectPopup(ExtensionAction* action); + virtual void InspectPopup(ExtensionAction* action) OVERRIDE; // Overridden from ExtensionPopup::Observer - virtual void ExtensionPopupIsClosing(ExtensionPopup* popup); + virtual void ExtensionPopupIsClosing(ExtensionPopup* popup) OVERRIDE; // 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 75cc136..fd6d717 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,6 +6,7 @@ #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) { @@ -13,8 +14,9 @@ PageActionWithBadgeView::PageActionWithBadgeView( AddChildView(image_view_); } -AccessibilityTypes::Role PageActionWithBadgeView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; +void PageActionWithBadgeView::GetAccessibleState( + ui::AccessibleViewState* state) { + state->role = ui::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 6071bad..06f145d 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,8 +20,9 @@ class PageActionWithBadgeView : public views::View { PageActionImageView* image_view() { return image_view_; } - virtual AccessibilityTypes::Role GetAccessibleRole(); - virtual gfx::Size GetPreferredSize(); + // View overrides: + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize() OVERRIDE; 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 886aec2..2e49fc7 100644 --- a/chrome/browser/ui/views/location_bar/star_view.cc +++ b/chrome/browser/ui/views/location_bar/star_view.cc @@ -11,6 +11,7 @@ #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" @@ -27,16 +28,13 @@ 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)); } -AccessibilityTypes::Role StarView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_PUSHBUTTON; +void StarView::GetAccessibleState(ui::AccessibleViewState* state) { + state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_STAR); + state->role = ui::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 ad02f9e..f27f3f0 100644 --- a/chrome/browser/ui/views/location_bar/star_view.h +++ b/chrome/browser/ui/views/location_bar/star_view.h @@ -27,17 +27,19 @@ class StarView : public views::ImageView, public InfoBubbleDelegate { private: // views::ImageView overrides: - 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); + 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; // InfoBubbleDelegate overrides: virtual void InfoBubbleClosing(InfoBubble* info_bubble, - bool closed_by_escape); - virtual bool CloseOnEscape(); - virtual bool FadeInOnShow() { return false; } + bool closed_by_escape) OVERRIDE; + virtual bool CloseOnEscape() OVERRIDE; + virtual bool FadeInOnShow() OVERRIDE { 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 0996b4a..621ffae 100644 --- a/chrome/browser/ui/views/options/general_page_view.cc +++ b/chrome/browser/ui/views/options/general_page_view.cc @@ -35,6 +35,7 @@ #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" @@ -66,8 +67,8 @@ class OptionsGroupContents : public views::View { OptionsGroupContents() { } // views::View overrides: - virtual AccessibilityTypes::Role GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE { + state->state = ui::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 f4a9670..7a7d741 100644 --- a/chrome/browser/ui/views/options/options_group_view.cc +++ b/chrome/browser/ui/views/options/options_group_view.cc @@ -9,8 +9,9 @@ #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" -#include "grit/locale_settings.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 "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" @@ -50,9 +51,6 @@ 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() { @@ -70,8 +68,9 @@ int OptionsGroupView::GetContentsWidth() const { /////////////////////////////////////////////////////////////////////////////// // OptionsGroupView, views::View overrides: -AccessibilityTypes::Role OptionsGroupView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; +void OptionsGroupView::GetAccessibleState(ui::AccessibleViewState* state) { + title_label_->GetAccessibleState(state); + state->role = ui::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 1d32c0a..2add3c4 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 AccessibilityTypes::Role GetAccessibleRole(); - virtual void OnPaint(gfx::Canvas* canvas); + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child); + views::View* child) OVERRIDE; 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 b81b3af..3cbf3a5 100644 --- a/chrome/browser/ui/views/options/options_page_view.cc +++ b/chrome/browser/ui/views/options/options_page_view.cc @@ -5,6 +5,7 @@ #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" /////////////////////////////////////////////////////////////////////////////// @@ -33,6 +34,6 @@ void OptionsPageView::ViewHierarchyChanged(bool is_add, } } -AccessibilityTypes::Role OptionsPageView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_PAGETAB; +void OptionsPageView::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::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 bbbc8c4..de438a1 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); - virtual AccessibilityTypes::Role GetAccessibleRole(); + views::View* child) OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 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 7126f7d..91d4290 100644 --- a/chrome/browser/ui/views/options/options_window_view.cc +++ b/chrome/browser/ui/views/options/options_window_view.cc @@ -17,6 +17,7 @@ #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" @@ -39,29 +40,29 @@ class OptionsWindowView : public views::View, void ShowOptionsPage(OptionsPage page, OptionsGroup highlight_group); // views::DialogDelegate implementation: - virtual int GetDialogButtons() const { + virtual int GetDialogButtons() const OVERRIDE { return MessageBoxFlags::DIALOGBUTTON_CANCEL; } - virtual std::wstring GetWindowTitle() const; - virtual std::wstring GetWindowName() const; - virtual void WindowClosing(); - virtual bool Cancel(); - virtual views::View* GetContentsView(); - virtual bool ShouldRestoreWindowSize() const; + 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; // views::TabbedPane::Listener implementation: - virtual void TabSelectedAt(int index); + virtual void TabSelectedAt(int index) OVERRIDE; // views::View overrides: - virtual AccessibilityTypes::Role GetAccessibleRole(); - virtual void Layout(); - virtual gfx::Size GetPreferredSize(); + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual void Layout() OVERRIDE; + virtual gfx::Size GetPreferredSize() OVERRIDE; protected: // views::View overrides: virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child); + views::View* child) OVERRIDE; private: // Init the assorted Tabbed pages void Init(); @@ -166,8 +167,8 @@ void OptionsWindowView::TabSelectedAt(int index) { /////////////////////////////////////////////////////////////////////////////// // OptionsWindowView, views::View overrides: -AccessibilityTypes::Role OptionsWindowView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_CLIENT; +void OptionsWindowView::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::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 f99517c..6ac2a5b8 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,6 +9,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" //////////////////////////////////////////////////////////////////////////////// @@ -130,8 +131,9 @@ void NativeTabContentsContainerGtk::AboutToRequestFocusFromTabTraversal( container_->tab_contents()->FocusThroughTabTraversal(reverse); } -AccessibilityTypes::Role NativeTabContentsContainerGtk::GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; +void NativeTabContentsContainerGtk::GetAccessibleState( + ui::AccessibleViewState* state) { + state->role = ui::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 004b689..469f11e 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 AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) 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 e4dfd02..f0f7c9d 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,8 +129,9 @@ void NativeTabContentsContainerWin::AboutToRequestFocusFromTabTraversal( container_->tab_contents()->FocusThroughTabTraversal(reverse); } -AccessibilityTypes::Role NativeTabContentsContainerWin::GetAccessibleRole() { - return AccessibilityTypes::ROLE_GROUPING; +void NativeTabContentsContainerWin::GetAccessibleState( + ui::AccessibleViewState* state) { + state->role = ui::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 1cfb5b5..4d60be22 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 AccessibilityTypes::Role GetAccessibleRole() OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) 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 9de15da..7170163 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc @@ -12,6 +12,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" //////////////////////////////////////////////////////////////////////////////// @@ -43,8 +44,8 @@ void TabContentsContainer::Observe(NotificationType type, //////////////////////////////////////////////////////////////////////////////// // TabContentsContainer, View overrides: -AccessibilityTypes::Role TabContentsContainer::GetAccessibleRole() { - return AccessibilityTypes::ROLE_WINDOW; +void TabContentsContainer::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::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 a845464..94ab8bb 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); + const NotificationDetails& details) OVERRIDE; // Overridden from views::View: - virtual void Layout(); - virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual void Layout() OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; protected: // Overridden from views::View: virtual void ViewHierarchyChanged(bool is_add, views::View* parent, - views::View* child); + views::View* child) OVERRIDE; 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 d5a79aa..7330f30 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); + const NotificationDetails& details) OVERRIDE; - virtual AccessibilityTypes::Role GetAccessibleRole(); + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 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 9c99e47..e4a2643 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -9,14 +9,15 @@ #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" @@ -212,9 +213,6 @@ void BaseTab::SetData(const TabRendererData& data) { ResetCrashedFavIcon(); } - // Sets the accessible name for the tab. - SetAccessibleName(data_.title); - DataChanged(old); Layout(); @@ -348,11 +346,12 @@ bool BaseTab::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { return false; } -AccessibilityTypes::Role BaseTab::GetAccessibleRole() { - return AccessibilityTypes::ROLE_PAGETAB; +void BaseTab::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::AccessibilityTypes::ROLE_PAGETAB; + state->name = data_.title; } -ui::ThemeProvider* BaseTab::GetThemeProvider() { +ui::ThemeProvider* BaseTab::GetThemeProvider() const { 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 8a43f06..75d34fc 100644 --- a/chrome/browser/ui/views/tabs/base_tab.h +++ b/chrome/browser/ui/views/tabs/base_tab.h @@ -83,15 +83,16 @@ class BaseTab : public ui::AnimationDelegate, bool IsCloseable() const; // views::View overrides: - 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 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 OnMouseReleased(const views::MouseEvent& event, - bool canceled); - virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip); - virtual AccessibilityTypes::Role GetAccessibleRole(); - virtual ThemeProvider* GetThemeProvider(); + 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; protected: // Invoked from SetData after |data_| has been updated to the new data. @@ -119,18 +120,18 @@ class BaseTab : public ui::AnimationDelegate, void PaintTitle(gfx::Canvas* canvas, SkColor title_color); // Overridden from AnimationDelegate: - virtual void AnimationProgressed(const ui::Animation* animation); - virtual void AnimationCanceled(const ui::Animation* animation); - virtual void AnimationEnded(const ui::Animation* animation); + virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; + virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; + virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, - const views::Event& event); + const views::Event& event) OVERRIDE; // views::ContextMenuController overrides: virtual void ShowContextMenu(views::View* source, const gfx::Point& p, - bool is_mouse_gesture); + bool is_mouse_gesture) OVERRIDE; // 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 059c7e5..e316db6 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -16,6 +16,7 @@ #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" @@ -363,8 +364,9 @@ int TabStrip::OnPerformDrop(const DropTargetEvent& event) { return GetDropEffect(event); } -AccessibilityTypes::Role TabStrip::GetAccessibleRole() { - return AccessibilityTypes::ROLE_PAGETABLIST; +void TabStrip::GetAccessibleState(ui::AccessibleViewState* state) { + state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_TABSTRIP); + state->role = ui::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 7f0a339..45cdf45 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h @@ -56,29 +56,30 @@ class TabStrip : public BaseTabStrip, virtual void MouseMovedOutOfView(); // BaseTabStrip implementation: - 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(); + 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; // views::View overrides: - virtual void PaintChildren(gfx::Canvas* canvas); - virtual const views::View* GetViewByID(int id) const; - virtual gfx::Size GetPreferredSize(); + virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; + virtual const views::View* GetViewByID(int id) const OVERRIDE; + virtual gfx::Size GetPreferredSize() OVERRIDE; // 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); - 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(); + 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; protected: // BaseTabStrip overrides: diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 1eb475a..cff8fe1 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -25,6 +25,7 @@ #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" @@ -306,8 +307,9 @@ bool ToolbarView::SetPaneFocus( return true; } -AccessibilityTypes::Role ToolbarView::GetAccessibleRole() { - return AccessibilityTypes::ROLE_TOOLBAR; +void ToolbarView::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::AccessibilityTypes::ROLE_TOOLBAR; + state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h index 1aa143c..42d803a 100644 --- a/chrome/browser/ui/views/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar_view.h @@ -78,6 +78,8 @@ 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_; } @@ -86,46 +88,44 @@ 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); - virtual AccessibilityTypes::Role GetAccessibleRole(); - - // Overridden from Menu::Delegate: - virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel); + virtual bool SetPaneFocus(int view_storage_id, View* initial_focus) OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // Overridden from views::MenuDelegate: - virtual void RunMenu(views::View* source, const gfx::Point& pt); + virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; // Overridden from LocationBarView::Delegate: - virtual TabContentsWrapper* GetTabContentsWrapper(); - virtual InstantController* GetInstant(); - virtual void OnInputInProgress(bool in_progress); + virtual TabContentsWrapper* GetTabContentsWrapper() OVERRIDE; + virtual InstantController* GetInstant() OVERRIDE; + virtual void OnInputInProgress(bool in_progress) OVERRIDE; // Overridden from CommandUpdater::CommandObserver: - virtual void EnabledStateChangedForCommand(int id, bool enabled); + virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; // Overridden from views::BaseButton::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event); + virtual void ButtonPressed(views::Button* sender, const views::Event& event) + OVERRIDE; // Overridden from NotificationObserver: virtual void Observe(NotificationType type, const NotificationSource& source, - const NotificationDetails& details); + const NotificationDetails& details) OVERRIDE; // Overridden from ui::AcceleratorProvider: - virtual bool GetAcceleratorForCommandId(int command_id, - ui::Accelerator* accelerator); + virtual bool GetAcceleratorForCommandId( + int command_id, ui::Accelerator* accelerator) OVERRIDE; // Overridden from views::View: - virtual gfx::Size GetPreferredSize(); - virtual void Layout(); - virtual void OnPaint(gfx::Canvas* canvas); + virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual void Layout() OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual bool GetDropFormats( int* formats, - 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(); + 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; // 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(); - virtual void RemovePaneFocus(); + virtual views::View* GetDefaultFocusableChild() OVERRIDE; + virtual void RemovePaneFocus() OVERRIDE; 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 2720aca..f983fb9 100644 --- a/chrome/browser/ui/views/wrench_menu.cc +++ b/chrome/browser/ui/views/wrench_menu.cc @@ -570,7 +570,6 @@ 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; |