summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 19:20:13 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 19:20:13 +0000
commiteb3a340a0950b10badb7f58530324a9deb5e723d (patch)
tree476c5db00b5a0283f0fcde2b8cfcd4ad40cebfb7
parent0f8f1b43ed25b241a8cf0a9c28c1185a79dad402 (diff)
downloadchromium_src-eb3a340a0950b10badb7f58530324a9deb5e723d.zip
chromium_src-eb3a340a0950b10badb7f58530324a9deb5e723d.tar.gz
chromium_src-eb3a340a0950b10badb7f58530324a9deb5e723d.tar.bz2
[accessibility] Bookmarks bar is missing some MSAA information
Return the link role for the Link view. Return the grouping role for BookmarkBarInstructionsView. Support the link role in views accessibility types. Updated browser views accessibility tests. - Verify BrowserRootView accessibility info. - Verify BrowserView accessibility info. - Verify BookmarkBarView accessibility info. - In TestViewAccessibilityObject don't SetAccessible name, we should be testing that this name is correctly set. Set the accessible name for the application in BrowserRootView instead of OpaqueBrowserFrameView BUG=36281 TEST=Verify bookmarks bar tree in AccExplorer32.exe Review URL: http://codereview.chromium.org/652156 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41744 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/views/bookmark_bar_instructions_view.cc10
-rw-r--r--chrome/browser/views/bookmark_bar_instructions_view.h1
-rw-r--r--chrome/browser/views/browser_views_accessibility_browsertest.cc72
-rw-r--r--chrome/browser/views/frame/browser_root_view.cc3
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.cc10
-rw-r--r--chrome/browser/views/frame/opaque_browser_frame_view.h3
6 files changed, 65 insertions, 34 deletions
diff --git a/chrome/browser/views/bookmark_bar_instructions_view.cc b/chrome/browser/views/bookmark_bar_instructions_view.cc
index b8d644f..4b625d9 100644
--- a/chrome/browser/views/bookmark_bar_instructions_view.cc
+++ b/chrome/browser/views/bookmark_bar_instructions_view.cc
@@ -86,6 +86,16 @@ void BookmarkBarInstructionsView::ViewHierarchyChanged(bool is_add,
UpdateColors();
}
+bool BookmarkBarInstructionsView::GetAccessibleRole(
+ AccessibilityTypes::Role* role) {
+ DCHECK(role);
+ if (!role)
+ return false;
+
+ *role = AccessibilityTypes::ROLE_GROUPING;
+ return true;
+}
+
void BookmarkBarInstructionsView::LinkActivated(views::Link* source,
int event_flags) {
delegate_->ShowImportDialog();
diff --git a/chrome/browser/views/bookmark_bar_instructions_view.h b/chrome/browser/views/bookmark_bar_instructions_view.h
index 4f148d5..c598f101 100644
--- a/chrome/browser/views/bookmark_bar_instructions_view.h
+++ b/chrome/browser/views/bookmark_bar_instructions_view.h
@@ -37,6 +37,7 @@ class BookmarkBarInstructionsView : public views::View,
virtual void ViewHierarchyChanged(bool is_add,
views::View* parent,
views::View* child);
+ virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
// LinkController.
virtual void LinkActivated(views::Link* source, int event_flags);
diff --git a/chrome/browser/views/browser_views_accessibility_browsertest.cc b/chrome/browser/views/browser_views_accessibility_browsertest.cc
index 86c9b3d..ea7fde0 100644
--- a/chrome/browser/views/browser_views_accessibility_browsertest.cc
+++ b/chrome/browser/views/browser_views_accessibility_browsertest.cc
@@ -1,6 +1,6 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
#include <oleacc.h>
@@ -8,6 +8,8 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/view_ids.h"
+#include "chrome/browser/views/bookmark_bar_view.h"
+#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/toolbar_view.h"
#include "chrome/test/in_process_browser_test.h"
#include "grit/chromium_strings.h"
@@ -35,36 +37,50 @@ class BrowserViewsAccessibilityTest : public InProcessBrowserTest {
::CoUninitialize();
}
- // Retrieves and initializes an instance of LocationBarView.
- LocationBarView* GetLocationBarView() {
+ // Retrieves an instance of BrowserWindowTesting
+ BrowserWindowTesting* GetBrowserWindowTesting() {
BrowserWindow* browser_window = browser()->window();
if (!browser_window)
return NULL;
- BrowserWindowTesting* browser_window_testing =
- browser_window->GetBrowserWindowTesting();
+ return browser_window->GetBrowserWindowTesting();
+ }
+
+ // Retrieve an instance of BrowserView
+ BrowserView* GetBrowserView() {
+ return BrowserView::GetBrowserViewForNativeWindow(
+ browser()->window()->GetNativeHandle());
+ }
+
+ // Retrieves and initializes an instance of LocationBarView.
+ LocationBarView* GetLocationBarView() {
+ BrowserWindowTesting* browser_window_testing = GetBrowserWindowTesting();
if (!browser_window_testing)
return NULL;
- return browser_window_testing->GetLocationBarView();
+ return GetBrowserWindowTesting()->GetLocationBarView();
}
// Retrieves and initializes an instance of ToolbarView.
ToolbarView* GetToolbarView() {
- BrowserWindow* browser_window = browser()->window();
+ BrowserWindowTesting* browser_window_testing = GetBrowserWindowTesting();
- if (!browser_window)
+ if (!browser_window_testing)
return NULL;
- BrowserWindowTesting* browser_window_testing =
- browser_window->GetBrowserWindowTesting();
+ return browser_window_testing->GetToolbarView();
+ }
+
+ // Retrieves and initializes an instance of BookmarkBarView.
+ BookmarkBarView* GetBookmarkBarView() {
+ BrowserWindowTesting* browser_window_testing = GetBrowserWindowTesting();
if (!browser_window_testing)
return NULL;
- return browser_window_testing->GetToolbarView();
+ return browser_window_testing->GetBookmarkBarView();
}
// Retrieves and verifies the accessibility object for the given View.
@@ -72,9 +88,6 @@ class BrowserViewsAccessibilityTest : public InProcessBrowserTest {
long role) {
ASSERT_TRUE(NULL != view);
- // Initialize View accessibility information.
- view->SetAccessibleName(name);
-
IAccessible* acc_obj = NULL;
HRESULT hr = view->GetViewAccessibilityWrapper()->GetInstance(
IID_IAccessible, reinterpret_cast<void**>(&acc_obj));
@@ -129,16 +142,26 @@ IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, TestChromeWindowAccObj) {
acc_obj->Release();
}
-// Retrieve accessibility object for root view, and verify accessibility info.
-IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, TestRootViewAccObj) {
- views::WidgetWin window;
+// Retrieve accessibility object for browser root view and verify
+// accessibility info.
+IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest,
+ TestBrowserRootViewAccObj) {
+ views::View* browser_root_view =
+ GetBrowserView()->frame()->GetFrameView()->GetRootView();
- // Verify root view MSAA name and role.
- TestViewAccessibilityObject(window.GetRootView(),
+ TestViewAccessibilityObject(browser_root_view,
l10n_util::GetString(IDS_PRODUCT_NAME),
ROLE_SYSTEM_APPLICATION);
}
+// Retrieve accessibility object for browser view and verify accessibility info.
+IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, TestBrowserViewAccObj) {
+ // Verify root view MSAA name and role.
+ TestViewAccessibilityObject(GetBrowserView(),
+ l10n_util::GetString(IDS_PRODUCT_NAME),
+ ROLE_SYSTEM_CLIENT);
+}
+
// Retrieve accessibility object for toolbar view and verify accessibility info.
IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, TestToolbarViewAccObj) {
// Verify toolbar MSAA name and role.
@@ -225,5 +248,12 @@ IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, TestAppMenuAccObj) {
ROLE_SYSTEM_BUTTONMENU);
}
+IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest,
+ TestBookmarkBarViewAccObj) {
+ TestViewAccessibilityObject(GetBookmarkBarView(),
+ l10n_util::GetString(IDS_ACCNAME_BOOKMARKS),
+ ROLE_SYSTEM_TOOLBAR);
+}
+
} // Namespace.
diff --git a/chrome/browser/views/frame/browser_root_view.cc b/chrome/browser/views/frame/browser_root_view.cc
index 7d8e2a1..d789b94 100644
--- a/chrome/browser/views/frame/browser_root_view.cc
+++ b/chrome/browser/views/frame/browser_root_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/frame/browser_root_view.h"
#include "app/drag_drop_types.h"
+#include "app/l10n_util.h"
#include "app/os_exchange_data.h"
#include "chrome/browser/location_bar.h"
#include "chrome/browser/profile.h"
@@ -12,12 +13,14 @@
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/frame/browser_frame.h"
#include "chrome/browser/views/tabs/tab_strip.h"
+#include "grit/chromium_strings.h"
BrowserRootView::BrowserRootView(BrowserView* browser_view,
views::Widget* widget)
: views::RootView(widget),
browser_view_(browser_view),
forwarding_to_tab_strip_(false) {
+ SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
}
bool BrowserRootView::GetDropFormats(
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc
index 4c02944..35c9e91 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc
@@ -389,16 +389,6 @@ bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const {
return browser_view_->IsPositionInWindowCaption(browser_view_point);
}
-void OpaqueBrowserFrameView::ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child) {
- if (is_add && child == this) {
- // The Accessibility glue looks for the product name on these two views to
- // determine if this is in fact a Chrome window.
- GetRootView()->SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
- }
-}
-
bool OpaqueBrowserFrameView::GetAccessibleRole(AccessibilityTypes::Role* role) {
DCHECK(role);
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.h b/chrome/browser/views/frame/opaque_browser_frame_view.h
index 395264e..2c3bdee 100644
--- a/chrome/browser/views/frame/opaque_browser_frame_view.h
+++ b/chrome/browser/views/frame/opaque_browser_frame_view.h
@@ -51,9 +51,6 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
virtual void Paint(gfx::Canvas* canvas);
virtual void Layout();
virtual bool HitTest(const gfx::Point& l) const;
- virtual void ViewHierarchyChanged(bool is_add,
- 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);