diff options
-rw-r--r-- | chrome/app/generated_resources.grd | 15 | ||||
-rw-r--r-- | chrome/browser/views/browser_actions_container.cc | 6 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view_layout.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/infobars/infobar_container.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/infobars/infobars.cc | 36 | ||||
-rw-r--r-- | chrome/browser/views/infobars/infobars.h | 6 | ||||
-rw-r--r-- | views/accessibility/accessibility_types.h | 1 | ||||
-rw-r--r-- | views/accessibility/view_accessibility.cc | 8 | ||||
-rw-r--r-- | views/accessibility/view_accessibility.h | 4 |
9 files changed, 75 insertions, 8 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index af5d09c..ec11f3a 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -3426,6 +3426,21 @@ each locale. --> <message name="IDS_EXTENSION_INSTALLED_MANAGE_INFO_MAC" desc="Text displayed in the InfoBubble with instructions on how to find the chrome://extensions/ management page on MAC OS X"> You can manage your installed extensions by clicking Extensions in the Window menu. </message> + <message name="IDS_ACCNAME_INFOBAR_CONTAINER" desc="The accessible name for the infobar container."> + Infobar Container + </message> + <message name="IDS_ACCNAME_INFOBAR_INFO" desc="The accessible name for the info infobar type."> + Info + </message> + <message name="IDS_ACCNAME_INFOBAR_WARNING" desc="The accessible name for the warning infobar type."> + Warning + </message> + <message name="IDS_ACCNAME_INFOBAR_ERROR" desc="The accessible name for the error infobar type."> + Error + </message> + <message name="IDS_ACCNAME_INFOBAR_PAGE_ACTION" desc="The accessible name for page action infobar type."> + Page Action + </message> <!-- chrome://extensions page --> <message name="IDS_EXTENSIONS_DEVELOPER_MODE_LINK" desc="Text of the link for developer mode."> diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc index 7ccaee8..ec57c82 100644 --- a/chrome/browser/views/browser_actions_container.cc +++ b/chrome/browser/views/browser_actions_container.cc @@ -373,6 +373,8 @@ BrowserActionsContainer::BrowserActionsContainer( ALLOW_THIS_IN_INITIALIZER_LIST(show_menu_task_factory_(this)) { SetID(VIEW_ID_BROWSER_ACTION_TOOLBAR); + SetVisible(false); + model_ = profile_->GetExtensionsService()->toolbar_model(); model_->AddObserver(this); @@ -510,6 +512,7 @@ void BrowserActionsContainer::DeleteBrowserActionViews() { } void BrowserActionsContainer::OnBrowserActionVisibilityChanged() { + SetVisible(browser_action_views_.size() > 0); resize_gripper_->SetVisible(browser_action_views_.size() > 0); owner_view_->Layout(); @@ -602,6 +605,7 @@ gfx::Size BrowserActionsContainer::GetPreferredSize() { void BrowserActionsContainer::Layout() { if (browser_action_views_.size() == 0) { + SetVisible(false); resize_gripper_->SetVisible(false); chevron_->SetVisible(false); return; @@ -1029,7 +1033,7 @@ int BrowserActionsContainer::WidthOfNonIconArea() const { } int BrowserActionsContainer::IconCountToWidth(int icons) const { - DCHECK(icons >= 0); + DCHECK_GE(icons, 0); if (icons == 0) return ContainerMinSize(); diff --git a/chrome/browser/views/frame/browser_view_layout.cc b/chrome/browser/views/frame/browser_view_layout.cc index 2c11574..2b0f2e0 100644 --- a/chrome/browser/views/frame/browser_view_layout.cc +++ b/chrome/browser/views/frame/browser_view_layout.cc @@ -414,7 +414,7 @@ int BrowserViewLayout::LayoutExtensionShelf(int bottom) { Browser::FEATURE_EXTENSIONSHELF); int height = visible ? extension_shelf_->GetPreferredSize().height() : 0; - extension_shelf_->SetVisible(visible); + extension_shelf_->SetVisible(visible && height != 0); extension_shelf_->SetBounds(vertical_layout_rect_.x(), bottom - height, vertical_layout_rect_.width(), height); extension_shelf_->Layout(); 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_; diff --git a/views/accessibility/accessibility_types.h b/views/accessibility/accessibility_types.h index cc92d0c..79b9e03 100644 --- a/views/accessibility/accessibility_types.h +++ b/views/accessibility/accessibility_types.h @@ -31,6 +31,7 @@ class AccessibilityTypes { ROLE_LINK, ROLE_PAGETAB, ROLE_PAGETABLIST, + ROLE_PANE, ROLE_PUSHBUTTON, ROLE_SEPARATOR, ROLE_TEXT, diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc index 32239d1..9d8861a 100644 --- a/views/accessibility/view_accessibility.cc +++ b/views/accessibility/view_accessibility.cc @@ -23,7 +23,7 @@ HRESULT ViewAccessibility::Initialize(views::View* view) { return S_OK; } -// TODO(klink): Handle case where child View is not contained by parent. +// TODO(ctguil): Handle case where child View is not contained by parent. STDMETHODIMP ViewAccessibility::accHitTest(LONG x_left, LONG y_top, VARIANT* child) { if (!child) { @@ -699,7 +699,7 @@ void ViewAccessibility::SetState(VARIANT* msaa_state, views::View* view) { msaa_state->lVal |= MSAAState(state); } -long ViewAccessibility::MSAARole(AccessibilityTypes::Role role) { +int32 ViewAccessibility::MSAARole(AccessibilityTypes::Role role) { switch (role) { case AccessibilityTypes::ROLE_APPLICATION: return ROLE_SYSTEM_APPLICATION; @@ -721,6 +721,8 @@ long ViewAccessibility::MSAARole(AccessibilityTypes::Role role) { return ROLE_SYSTEM_PAGETAB; case AccessibilityTypes::ROLE_PAGETABLIST: return ROLE_SYSTEM_PAGETABLIST; + case AccessibilityTypes::ROLE_PANE: + return ROLE_SYSTEM_PANE; case AccessibilityTypes::ROLE_PUSHBUTTON: return ROLE_SYSTEM_PUSHBUTTON; case AccessibilityTypes::ROLE_SEPARATOR: @@ -740,7 +742,7 @@ long ViewAccessibility::MSAARole(AccessibilityTypes::Role role) { } } -long ViewAccessibility::MSAAState(AccessibilityTypes::State state) { +int32 ViewAccessibility::MSAAState(AccessibilityTypes::State state) { switch (state) { case AccessibilityTypes::STATE_HASPOPUP : return STATE_SYSTEM_HASPOPUP; diff --git a/views/accessibility/view_accessibility.h b/views/accessibility/view_accessibility.h index 7d95794..b7a6dad 100644 --- a/views/accessibility/view_accessibility.h +++ b/views/accessibility/view_accessibility.h @@ -130,11 +130,11 @@ class ATL_NO_VTABLE ViewAccessibility // Returns a conversion from the Role (as defined in accessibility_types.h) // to an MSAA role. - long MSAARole(AccessibilityTypes::Role role); + int32 MSAARole(AccessibilityTypes::Role role); // Returns a conversion from the State (as defined in accessibility_types.h) // to MSAA states set. - long MSAAState(AccessibilityTypes::State state); + int32 MSAAState(AccessibilityTypes::State state); // Returns the IAccessible interface for a native view if applicable. // Returns S_OK on success. |