diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-03 00:56:12 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-03 00:56:12 +0000 |
commit | d5c8101d795d43c265d81277305958d38160ab19 (patch) | |
tree | f9d114bcacebec4839356c4feccad2c56932b5b6 /chrome | |
parent | f6b551d4bbde5c66782225ecc8c9aec81c974d07 (diff) | |
download | chromium_src-d5c8101d795d43c265d81277305958d38160ab19.zip chromium_src-d5c8101d795d43c265d81277305958d38160ab19.tar.gz chromium_src-d5c8101d795d43c265d81277305958d38160ab19.tar.bz2 |
Eliminate a lot of duplicated implementations of Get/SetAccessibleName() by just putting it on the base class. Also cleans up a couple other misc. accessibility functions in view.h.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1512012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43558 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
21 files changed, 6 insertions, 168 deletions
diff --git a/chrome/browser/chromeos/frame/normal_browser_frame_view.cc b/chrome/browser/chromeos/frame/normal_browser_frame_view.cc index c84e2bd..7b80753 100644 --- a/chrome/browser/chromeos/frame/normal_browser_frame_view.cc +++ b/chrome/browser/chromeos/frame/normal_browser_frame_view.cc @@ -213,20 +213,6 @@ bool NormalBrowserFrameView::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -bool NormalBrowserFrameView::GetAccessibleName(std::wstring* name) { - DCHECK(name); - - if (!accessible_name_.empty()) { - *name = accessible_name_; - return true; - } - return false; -} - -void NormalBrowserFrameView::SetAccessibleName(const std::wstring& name) { - accessible_name_ = name; -} - /////////////////////////////////////////////////////////////////////////////// // NormalBrowserFrameView, TabIconView::TabContentsProvider implementation: diff --git a/chrome/browser/chromeos/frame/normal_browser_frame_view.h b/chrome/browser/chromeos/frame/normal_browser_frame_view.h index a26c2a7..e0d55ab 100644 --- a/chrome/browser/chromeos/frame/normal_browser_frame_view.h +++ b/chrome/browser/chromeos/frame/normal_browser_frame_view.h @@ -56,8 +56,6 @@ class NormalBrowserFrameView : public BrowserNonClientFrameView, views::View* parent, views::View* child); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleName(std::wstring* name); - virtual void SetAccessibleName(const std::wstring& name); // Overridden from TabIconView::TabIconViewModel: virtual bool ShouldTabIconViewAnimate() const; diff --git a/chrome/browser/views/accessible_toolbar_view.cc b/chrome/browser/views/accessible_toolbar_view.cc index d85648d0..a7e8f1b 100644 --- a/chrome/browser/views/accessible_toolbar_view.cc +++ b/chrome/browser/views/accessible_toolbar_view.cc @@ -204,11 +204,6 @@ bool AccessibleToolbarView::SkipDefaultKeyEventProcessing( } } -bool AccessibleToolbarView::GetAccessibleName(std::wstring* name) { - *name = accessible_name_; - return !accessible_name_.empty(); -} - bool AccessibleToolbarView::GetAccessibleRole(AccessibilityTypes::Role* role) { DCHECK(role); @@ -216,10 +211,6 @@ bool AccessibleToolbarView::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -void AccessibleToolbarView::SetAccessibleName(const std::wstring& name) { - accessible_name_ = name; -} - void AccessibleToolbarView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { // When the toolbar is removed, traverse to the next accessible toolbar. diff --git a/chrome/browser/views/accessible_toolbar_view.h b/chrome/browser/views/accessible_toolbar_view.h index f2ef13f..c129f4b 100644 --- a/chrome/browser/views/accessible_toolbar_view.h +++ b/chrome/browser/views/accessible_toolbar_view.h @@ -29,9 +29,7 @@ class AccessibleToolbarView : public views::View { virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e); virtual void ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture); virtual void RequestFocus(); - virtual bool GetAccessibleName(std::wstring* name); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual void SetAccessibleName(const std::wstring& name); virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); virtual View* GetAccFocusedChildView() { return selected_focused_view_; } diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index a887487..a1cecbf 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -342,16 +342,6 @@ class BookmarkBarView::ButtonSeparatorView : public views::View { return gfx::Size(kSeparatorWidth, 1); } - virtual bool GetAccessibleName(std::wstring* name) { - DCHECK(name); - - if (!accessible_name_.empty()) { - name->assign(accessible_name_); - return true; - } - return false; - } - virtual bool GetAccessibleRole(AccessibilityTypes::Role* role) { DCHECK(role); @@ -359,10 +349,6 @@ class BookmarkBarView::ButtonSeparatorView : public views::View { return true; } - virtual void SetAccessibleName(const std::wstring& name) { - accessible_name_.assign(name); - } - private: // Storage of strings needed for accessibility. std::wstring accessible_name_; diff --git a/chrome/browser/views/extensions/extension_shelf.cc b/chrome/browser/views/extensions/extension_shelf.cc index 4a3c333..571e21d 100644 --- a/chrome/browser/views/extensions/extension_shelf.cc +++ b/chrome/browser/views/extensions/extension_shelf.cc @@ -779,20 +779,6 @@ bool ExtensionShelf::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -bool ExtensionShelf::GetAccessibleName(std::wstring* name) { - DCHECK(name); - - if (!accessible_name_.empty()) { - name->assign(accessible_name_); - return true; - } - return false; -} - -void ExtensionShelf::SetAccessibleName(const std::wstring& name) { - accessible_name_.assign(name); -} - void ExtensionShelf::ThemeChanged() { // Refresh the CSS to update toolstrip text colors from theme. int count = model_->count(); diff --git a/chrome/browser/views/extensions/extension_shelf.h b/chrome/browser/views/extensions/extension_shelf.h index af6abe2..df8a0ec 100644 --- a/chrome/browser/views/extensions/extension_shelf.h +++ b/chrome/browser/views/extensions/extension_shelf.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -50,9 +50,7 @@ class ExtensionShelf : public DetachableToolbarView, virtual void Layout(); virtual void OnMouseExited(const views::MouseEvent& event); virtual void OnMouseEntered(const views::MouseEvent& event); - virtual bool GetAccessibleName(std::wstring* name); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual void SetAccessibleName(const std::wstring& name); virtual void ThemeChanged(); // ExtensionContainer methods: diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 93ab8f4..b8cdb89 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -1608,20 +1608,6 @@ bool BrowserView::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -bool BrowserView::GetAccessibleName(std::wstring* name) { - DCHECK(name); - - if (!accessible_name_.empty()) { - *name = accessible_name_; - return true; - } - return false; -} - -void BrowserView::SetAccessibleName(const std::wstring& name) { - accessible_name_ = name; -} - void BrowserView::InfoBarSizeChanged(bool is_animating) { SelectedTabToolbarSizeChanged(is_animating); } diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index f5b4c40..1e01f28 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -384,8 +384,6 @@ class BrowserView : public BrowserBubbleHost, views::View* child); virtual void ChildPreferredSizeChanged(View* child); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleName(std::wstring* name); - virtual void SetAccessibleName(const std::wstring& name); // 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 532b559..e9276f8 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc @@ -378,20 +378,6 @@ bool OpaqueBrowserFrameView::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -bool OpaqueBrowserFrameView::GetAccessibleName(std::wstring* name) { - DCHECK(name); - - if (!accessible_name_.empty()) { - *name = accessible_name_; - return true; - } - return false; -} - -void OpaqueBrowserFrameView::SetAccessibleName(const std::wstring& name) { - accessible_name_ = name; -} - /////////////////////////////////////////////////////////////////////////////// // OpaqueBrowserFrameView, views::ButtonListener implementation: diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.h b/chrome/browser/views/frame/opaque_browser_frame_view.h index 57e9def..59c322c 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/views/frame/opaque_browser_frame_view.h @@ -52,8 +52,6 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, virtual void Layout(); virtual bool HitTest(const gfx::Point& l) const; virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleName(std::wstring* name); - virtual void SetAccessibleName(const std::wstring& name); // 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 c140a4b..4301132 100644 --- a/chrome/browser/views/infobars/infobar_container.cc +++ b/chrome/browser/views/infobars/infobar_container.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -78,16 +78,6 @@ void InfoBarContainer::Layout() { } } -bool InfoBarContainer::GetAccessibleName(std::wstring* name) { - DCHECK(name); - - if (!accessible_name_.empty()) { - name->assign(accessible_name_); - return true; - } - return false; -} - bool InfoBarContainer::GetAccessibleRole(AccessibilityTypes::Role* role) { DCHECK(role); @@ -95,10 +85,6 @@ bool InfoBarContainer::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -void InfoBarContainer::SetAccessibleName(const std::wstring& name) { - accessible_name_.assign(name); -} - void InfoBarContainer::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { diff --git a/chrome/browser/views/infobars/infobar_container.h b/chrome/browser/views/infobars/infobar_container.h index c71f5b9..f9bb85a 100644 --- a/chrome/browser/views/infobars/infobar_container.h +++ b/chrome/browser/views/infobars/infobar_container.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,9 +44,7 @@ class InfoBarContainer : public views::View, // Overridden from views::View: virtual gfx::Size GetPreferredSize(); virtual void Layout(); - virtual bool GetAccessibleName(std::wstring* name); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual void SetAccessibleName(const std::wstring& name); protected: virtual void ViewHierarchyChanged(bool is_add, diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc index f99501d..f4e84af 100644 --- a/chrome/browser/views/infobars/infobars.cc +++ b/chrome/browser/views/infobars/infobars.cc @@ -178,11 +178,6 @@ void InfoBar::Close() { // InfoBar, views::View overrides: --------------------------------------------- -bool InfoBar::GetAccessibleName(std::wstring* name) { - *name = accessible_name_; - return !accessible_name_.empty(); -} - bool InfoBar::GetAccessibleRole(AccessibilityTypes::Role* role) { DCHECK(role); @@ -190,10 +185,6 @@ bool InfoBar::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -void InfoBar::SetAccessibleName(const std::wstring& name) { - accessible_name_.assign(name); -} - gfx::Size InfoBar::GetPreferredSize() { int height = static_cast<int>(target_height_ * animation_->GetCurrentValue()); return gfx::Size(0, height); diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h index 56cf48f..4fa9efa 100644 --- a/chrome/browser/views/infobars/infobars.h +++ b/chrome/browser/views/infobars/infobars.h @@ -78,9 +78,7 @@ class InfoBar : public views::View, static const int kButtonInLabelSpacing; // Overridden from views::View: - virtual bool GetAccessibleName(std::wstring* name); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual void SetAccessibleName(const std::wstring& name); virtual gfx::Size GetPreferredSize(); virtual void Layout(); diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 19eb974..a31e604 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -830,16 +830,6 @@ void LocationBarView::ShowFirstRunBubbleInternal(bool use_OEM_bubble) { #endif } -bool LocationBarView::GetAccessibleName(std::wstring* name) { - DCHECK(name); - - if (!accessible_name_.empty()) { - name->assign(accessible_name_); - return true; - } - return false; -} - bool LocationBarView::GetAccessibleRole(AccessibilityTypes::Role* role) { DCHECK(role); @@ -847,10 +837,6 @@ bool LocationBarView::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -void LocationBarView::SetAccessibleName(const std::wstring& name) { - accessible_name_.assign(name); -} - // LocationIconView------------------------------------------------------------- LocationBarView::LocationIconView::LocationIconView( diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h index 750983c..8ba1226 100644 --- a/chrome/browser/views/location_bar_view.h +++ b/chrome/browser/views/location_bar_view.h @@ -153,9 +153,7 @@ class LocationBarView : public LocationBar, // Overridden from views::View: virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e); - virtual bool GetAccessibleName(std::wstring* name); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual void SetAccessibleName(const std::wstring& name); // Overridden from LocationBar: virtual void ShowFirstRunBubble(bool use_OEM_bubble); diff --git a/chrome/browser/views/tab_contents/tab_contents_container.cc b/chrome/browser/views/tab_contents/tab_contents_container.cc index f865e5e..fcffce2 100644 --- a/chrome/browser/views/tab_contents/tab_contents_container.cc +++ b/chrome/browser/views/tab_contents/tab_contents_container.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -82,20 +82,6 @@ bool TabContentsContainer::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -bool TabContentsContainer::GetAccessibleName(std::wstring* name) { - DCHECK(name); - - if (!accessible_name_.empty()) { - name->assign(accessible_name_); - return true; - } - return false; -} - -void TabContentsContainer::SetAccessibleName(const std::wstring& name) { - accessible_name_.assign(name); -} - void TabContentsContainer::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { diff --git a/chrome/browser/views/tab_contents/tab_contents_container.h b/chrome/browser/views/tab_contents/tab_contents_container.h index 3f60eec..39f2de6 100644 --- a/chrome/browser/views/tab_contents/tab_contents_container.h +++ b/chrome/browser/views/tab_contents/tab_contents_container.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -41,9 +41,7 @@ class TabContentsContainer : public views::View, // Overridden from views::View: virtual void Layout(); - virtual bool GetAccessibleName(std::wstring* name); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual void SetAccessibleName(const std::wstring& name); protected: // Overridden from views::View: diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 9ace17d..1a9edb3 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -1072,18 +1072,6 @@ bool TabStrip::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -bool TabStrip::GetAccessibleName(std::wstring* name) { - if (!accessible_name_.empty()) { - (*name).assign(accessible_name_); - return true; - } - return false; -} - -void TabStrip::SetAccessibleName(const std::wstring& name) { - accessible_name_.assign(name); -} - views::View* TabStrip::GetViewForPoint(const gfx::Point& point) { // Return any view that isn't a Tab or this TabStrip immediately. We don't // want to interfere. diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index 73e89c8..af6cc34 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -100,8 +100,6 @@ class TabStrip : public BaseTabStrip, virtual void OnDragExited(); virtual int OnPerformDrop(const views::DropTargetEvent& event); virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleName(std::wstring* name); - virtual void SetAccessibleName(const std::wstring& name); virtual views::View* GetViewForPoint(const gfx::Point& point); virtual void ThemeChanged(); |