summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/infobars
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 01:49:39 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 01:49:39 +0000
commit8a0a55e61c5efd4711fbf21d49b4001a4cc9908b (patch)
tree658af47a25e0ec4f84a87c2bf6859c4809ce2f42 /chrome/browser/views/infobars
parent690aa5c82084132146296cc439b54d5231659d61 (diff)
downloadchromium_src-8a0a55e61c5efd4711fbf21d49b4001a4cc9908b.zip
chromium_src-8a0a55e61c5efd4711fbf21d49b4001a4cc9908b.tar.gz
chromium_src-8a0a55e61c5efd4711fbf21d49b4001a4cc9908b.tar.bz2
[accessibility] Extension toolbar and infobar container views should not have state visible if they are not rendered on screen.
Add the ROLE_PANE role to viewsaccessibility types. Provide accessible role and name for BrowserActionsContainer, InfoBarContainer, and InfoBar. Set BrowserActionsContainer view visibility to true only when it contains browser actions. Set ExtensionShelf vew visibility to true only when it has non-zero height. BUG=36224 TEST=Verify extension toolbar and infobar container accessibility info within AccExplore32.exe Review URL: http://codereview.chromium.org/669275 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43044 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/infobars')
-rw-r--r--chrome/browser/views/infobars/infobar_container.cc5
-rw-r--r--chrome/browser/views/infobars/infobars.cc36
-rw-r--r--chrome/browser/views/infobars/infobars.h6
3 files changed, 46 insertions, 1 deletions
diff --git a/chrome/browser/views/infobars/infobar_container.cc b/chrome/browser/views/infobars/infobar_container.cc
index 99e9eb3..c140a4b 100644
--- a/chrome/browser/views/infobars/infobar_container.cc
+++ b/chrome/browser/views/infobars/infobar_container.cc
@@ -4,11 +4,13 @@
#include "chrome/browser/views/infobars/infobar_container.h"
+#include "app/l10n_util.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/infobars/infobars.h"
#include "chrome/common/notification_service.h"
+#include "grit/generated_resources.h"
// InfoBarContainer, public: ---------------------------------------------------
@@ -16,6 +18,7 @@ InfoBarContainer::InfoBarContainer(Delegate* delegate)
: delegate_(delegate),
tab_contents_(NULL) {
SetID(VIEW_ID_INFO_BAR_CONTAINER);
+ SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_CONTAINER));
}
InfoBarContainer::~InfoBarContainer() {
@@ -88,7 +91,7 @@ bool InfoBarContainer::GetAccessibleName(std::wstring* name) {
bool InfoBarContainer::GetAccessibleRole(AccessibilityTypes::Role* role) {
DCHECK(role);
- *role = AccessibilityTypes::ROLE_TOOLBAR;
+ *role = AccessibilityTypes::ROLE_GROUPING;
return true;
}
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index 71382e2..f99501d 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -107,6 +107,24 @@ InfoBar::InfoBar(InfoBarDelegate* delegate)
set_background(new InfoBarBackground(delegate->GetInfoBarType()));
+ switch (delegate->GetInfoBarType()) {
+ case InfoBarDelegate::INFO_TYPE:
+ SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_INFO));
+ break;
+ case InfoBarDelegate::WARNING_TYPE:
+ SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_WARNING));
+ break;
+ case InfoBarDelegate::ERROR_TYPE:
+ SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_ERROR));
+ break;
+ case InfoBarDelegate::PAGE_ACTION_TYPE:
+ SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_PAGE_ACTION));
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
close_button_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_CLOSE_BAR));
@@ -160,6 +178,22 @@ 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);
+
+ *role = AccessibilityTypes::ROLE_PANE;
+ 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);
@@ -429,12 +463,14 @@ ConfirmInfoBar::ConfirmInfoBar(ConfirmInfoBarDelegate* delegate)
initialized_(false) {
ok_button_ = new views::NativeButton(
this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
+ ok_button_->SetAccessibleName(ok_button_->label());
if (delegate->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK_DEFAULT)
ok_button_->SetAppearsAsDefault(true);
if (delegate->NeedElevation(ConfirmInfoBarDelegate::BUTTON_OK))
ok_button_->SetNeedElevation(true);
cancel_button_ = new views::NativeButton(
this, delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL));
+ cancel_button_->SetAccessibleName(cancel_button_->label());
// Set up the link.
link_ = new views::Link;
diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h
index c222824..5c0f5f6 100644
--- a/chrome/browser/views/infobars/infobars.h
+++ b/chrome/browser/views/infobars/infobars.h
@@ -77,6 +77,9 @@ 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();
@@ -130,6 +133,9 @@ class InfoBar : public views::View,
// the stack in ViewHierarchyChanged to unwind).
void DeleteSelf();
+ // Storage of string needed for accessibility.
+ std::wstring accessible_name_;
+
// The InfoBar's container
InfoBarContainer* container_;