diff options
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_win.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view_test.cc | 3 | ||||
-rw-r--r-- | chrome/browser/views/browser_keyboard_accessibility_test_win.cc | 175 | ||||
-rw-r--r-- | chrome/browser/views/chrome_views_delegate.h | 2 | ||||
-rw-r--r-- | chrome/test/interactive_ui/interactive_ui_tests.gypi | 1 | ||||
-rw-r--r-- | views/controls/native_control.cc | 2 | ||||
-rw-r--r-- | views/view.h | 7 | ||||
-rw-r--r-- | views/view_gtk.cc | 13 | ||||
-rw-r--r-- | views/view_unittest.cc | 2 | ||||
-rw-r--r-- | views/view_win.cc | 28 | ||||
-rw-r--r-- | views/views_delegate.h | 9 |
11 files changed, 11 insertions, 233 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index 189723a..1182059 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -700,8 +700,6 @@ void AutocompleteEditViewWin::ClosePopup() { void AutocompleteEditViewWin::SetFocus() { ::SetFocus(m_hWnd); - parent_view_-> - NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS, false); } IAccessible* AutocompleteEditViewWin::GetIAccessible() { diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc index 5c4c722..78128bb 100644 --- a/chrome/browser/views/bookmark_bar_view_test.cc +++ b/chrome/browser/views/bookmark_bar_view_test.cc @@ -70,9 +70,6 @@ class ViewsDelegateImpl : public views::ViewsDelegate { return false; } - virtual void NotifyAccessibilityEvent( - views::View* view, AccessibilityTypes::Event event_type) {} - #if defined(OS_WIN) virtual HICON GetDefaultWindowIcon() const { return 0; } #endif diff --git a/chrome/browser/views/browser_keyboard_accessibility_test_win.cc b/chrome/browser/views/browser_keyboard_accessibility_test_win.cc deleted file mode 100644 index c1ad34d..0000000 --- a/chrome/browser/views/browser_keyboard_accessibility_test_win.cc +++ /dev/null @@ -1,175 +0,0 @@ -// 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. - -#include "base/keyboard_codes.h" -#include "chrome/browser/automation/ui_controls.h" -#include "chrome/browser/views/chrome_views_delegate.h" -#include "chrome/browser/views/frame/browser_view.h" -#include "chrome/test/in_process_browser_test.h" -#include "chrome/test/ui_test_utils.h" -#include "views/view.h" -#include "views/accessibility/view_accessibility.h" -#include "views/widget/widget.h" -#include "views/window/window.h" - -namespace { - -class BrowserKeyboardAccessibility : public InProcessBrowserTest, - public ChromeViewsDelegate { - public: - BrowserKeyboardAccessibility() - : is_waiting_(false), - current_view_(NULL) { - // Set ourselves as the currently active ViewsDelegate. - ViewsDelegate::views_delegate = this; - } - - ~BrowserKeyboardAccessibility() {} - - // Overidden from ChromeViewsDelegate. - // Save the last notification sent by views::View::NotifyAccessibilityEvent. - virtual void NotifyAccessibilityEvent( - views::View* view, AccessibilityTypes::Event event_type) { - current_view_ = view; - current_event_type_ = event_type; - - // Are we within a message loop waiting for a particular event? - if (is_waiting_) { - is_waiting_ = false; - MessageLoop::current()->Quit(); - } - } - - // Helper that performs tabbing until it cycles back to the original focus. - void TabCyclerForwardAndBack(gfx::NativeWindow hwnd); - void TabCycler(gfx::NativeWindow hwnd, bool forward_tab); - - views::View* current_view() const { return current_view_; } - - gfx::NativeWindow current_view_native_window() const { - return current_view()->GetWidget()->GetNativeView(); - } - - AccessibilityTypes::Event current_event() const { - return current_event_type_; - } - - void set_waiting(bool value) { is_waiting_ = value; } - - private: - // Are we waiting for an event? - bool is_waiting_; - - // View of interest (i.e. for testing or one we are waiting to gain focus). - views::View* current_view_; - - // Event type of interest. - AccessibilityTypes::Event current_event_type_; -}; - -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, TabInAboutChromeDialog) { - views::Window* about_chrome_window = - BrowserView::GetBrowserViewForNativeWindow( - browser()->window()->GetNativeHandle())->ShowAboutChromeDialog(); - - TabCyclerForwardAndBack(about_chrome_window->GetNativeWindow()); -} - -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, - TabInClearBrowsingDataDialog) { - browser()->OpenClearBrowsingDataDialog(); - TabCyclerForwardAndBack(current_view_native_window()); -} - -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, - TabInImportSettingsDialog) { - browser()->OpenImportSettingsDialog(); - TabCyclerForwardAndBack(current_view_native_window()); -} - -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, TabInKeywordEditor) { - browser()->OpenKeywordEditor(); - TabCyclerForwardAndBack(current_view_native_window()); -} - -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, TabInOptionsDialog) { - browser()->OpenOptionsDialog(); - - // Tab through each of the three tabs. - for (int i = 0; i < 3; ++i) { - TabCyclerForwardAndBack(current_view_native_window()); - ui_controls::SendKeyPressNotifyWhenDone(current_view_native_window(), - base::VKEY_TAB, - true, false, false, false, - new MessageLoop::QuitTask()); - set_waiting(true); - ui_test_utils::RunMessageLoop(); - } -} - -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, TabInPasswordManager) { - browser()->OpenPasswordManager(); - TabCyclerForwardAndBack(current_view_native_window()); -} - -// TODO(dtseng): http://www.crbug.com/50402 -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, - FAILS_TabInSyncMyBookmarksDialog) { - browser()->OpenSyncMyBookmarksDialog(); - TabCyclerForwardAndBack(current_view_native_window()); -} - -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, TabInTaskManager) { - browser()->OpenTaskManager(); - TabCyclerForwardAndBack(current_view_native_window()); -} - -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, TabInToolbar) { - gfx::NativeWindow native_window = browser()->window()->GetNativeHandle(); - ui_controls::SendKeyPressNotifyWhenDone(native_window, - base::VKEY_T, - false, true, true, false, - new MessageLoop::QuitTask()); - set_waiting(true); - ui_test_utils::RunMessageLoop(); - TabCyclerForwardAndBack(current_view_native_window()); -} - -IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, TabInUpdateChromeDialog) { - browser()->OpenUpdateChromeDialog(); - TabCyclerForwardAndBack(current_view_native_window()); -} - -void BrowserKeyboardAccessibility::TabCyclerForwardAndBack( - gfx::NativeWindow hwnd) { - TabCycler(hwnd, true); - TabCycler(hwnd, false); -} - -void BrowserKeyboardAccessibility::TabCycler(gfx::NativeWindow hwnd, - bool forward_tab) { - // Wait for a focus event on the provided native window. - while (current_event() != AccessibilityTypes::EVENT_FOCUS || - current_view_native_window() != hwnd) { - set_waiting(true); - ui_test_utils::RunMessageLoop(); - } - - views::View* first_focused_item = current_view(); - - ASSERT_TRUE(first_focused_item != NULL); - - views::View* next_focused_item = first_focused_item; - - // Keep tabbing until we reach the originally focused view. - do { - ui_controls::SendKeyPressNotifyWhenDone(hwnd, base::VKEY_TAB, - false, !forward_tab, false, false, new MessageLoop::QuitTask()); - set_waiting(true); - ui_test_utils::RunMessageLoop(); - next_focused_item = current_view(); - } while (first_focused_item != next_focused_item); -} - -} // namespace diff --git a/chrome/browser/views/chrome_views_delegate.h b/chrome/browser/views/chrome_views_delegate.h index 4934a24..51ced5f 100644 --- a/chrome/browser/views/chrome_views_delegate.h +++ b/chrome/browser/views/chrome_views_delegate.h @@ -23,8 +23,6 @@ class ChromeViewsDelegate : public views::ViewsDelegate { gfx::Rect* bounds) const; virtual bool GetSavedMaximizedState(const std::wstring& window_name, bool* maximized) const; - virtual void NotifyAccessibilityEvent( - views::View* view, AccessibilityTypes::Event event_type) {} #if defined(OS_WIN) virtual HICON GetDefaultWindowIcon() const; #endif diff --git a/chrome/test/interactive_ui/interactive_ui_tests.gypi b/chrome/test/interactive_ui/interactive_ui_tests.gypi index 72c60c7..33529d5 100644 --- a/chrome/test/interactive_ui/interactive_ui_tests.gypi +++ b/chrome/test/interactive_ui/interactive_ui_tests.gypi @@ -36,7 +36,6 @@ '<(DEPTH)/chrome/browser/gtk/bookmark_bar_gtk_interactive_uitest.cc', '<(DEPTH)/chrome/browser/notifications/notifications_interactive_uitest.cc', '<(DEPTH)/chrome/browser/views/bookmark_bar_view_test.cc', - '<(DEPTH)/chrome/browser/views/browser_keyboard_accessibility_test_win.cc', '<(DEPTH)/chrome/browser/views/find_bar_host_interactive_uitest.cc', '<(DEPTH)/chrome/browser/views/tabs/tab_dragging_test.cc', '<(DEPTH)/chrome/test/in_process_browser_test.cc', diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index 942a093..39d62b7 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -270,7 +270,7 @@ void NativeControl::Focus() { if (container_) { DCHECK(container_->GetControl()); ::SetFocus(container_->GetControl()); - NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS, false); + NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS); } } diff --git a/views/view.h b/views/view.h index c5268c2..22c38d0 100644 --- a/views/view.h +++ b/views/view.h @@ -558,14 +558,9 @@ class View : public AcceleratorTarget { // TODO(klink): Move all this out to a AccessibleInfo wrapper class. // Notify the platform specific accessibility client of changes in the user - // interface. This will always raise native notifications. + // interface. virtual void NotifyAccessibilityEvent(AccessibilityTypes::Event event_type); - // Raise an accessibility notification with an option to also raise a native - // notification. - virtual void NotifyAccessibilityEvent(AccessibilityTypes::Event event_type, - bool send_native_event); - // Returns the MSAA default action of the current view. The string returned // describes the default action that will occur when executing // IAccessible::DoDefaultAction. For instance, default action of a button is diff --git a/views/view_gtk.cc b/views/view_gtk.cc index d74598d..049dfe8 100644 --- a/views/view_gtk.cc +++ b/views/view_gtk.cc @@ -7,7 +7,6 @@ #include <gtk/gtk.h> #include "base/logging.h" -#include "views/views_delegate.h" namespace views { @@ -22,17 +21,7 @@ int View::GetMenuShowDelay() { } void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type) { - NotifyAccessibilityEvent(event_type, true); -} - -void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type, - bool send_native_event) { - // Send the notification to the delegate. - if (ViewsDelegate::views_delegate) - ViewsDelegate::views_delegate->NotifyAccessibilityEvent(this, event_type); - - // In the future if we add native GTK accessibility support, the - // notification should be sent here. + // Not implemented on GTK. } ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { diff --git a/views/view_unittest.cc b/views/view_unittest.cc index baca2c3..008a2a5 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -686,8 +686,6 @@ class TestViewsDelegate : public views::ViewsDelegate { bool* maximized) const { return false; } - virtual void NotifyAccessibilityEvent( - views::View* view, AccessibilityTypes::Event event_type) {} virtual HICON GetDefaultWindowIcon() const { return NULL; } diff --git a/views/view_win.cc b/views/view_win.cc index bbbe90e..3079b5c 100644 --- a/views/view_win.cc +++ b/views/view_win.cc @@ -11,7 +11,6 @@ #include "views/accessibility/view_accessibility.h" #include "views/accessibility/view_accessibility_wrapper.h" #include "views/border.h" -#include "views/views_delegate.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" #include "views/widget/widget_win.h" @@ -31,26 +30,15 @@ int View::GetMenuShowDelay() { return delay; } +// Notifies accessibility clients of the event_type on this view. +// Clients will call get_accChild found in ViewAccessibility with the supplied +// child id we generate here to retrieve the IAccessible associated with this +// view. void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type) { - NotifyAccessibilityEvent(event_type, true); -} - -void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type, - bool send_native_event) { - // Send the notification to the delegate. - if (ViewsDelegate::views_delegate) - ViewsDelegate::views_delegate->NotifyAccessibilityEvent(this, event_type); - - // Now call the Windows-specific method to notify MSAA clients of this - // event. The widget gives us a temporary unique child ID to associate - // with this view so that clients can call get_accChild in ViewAccessibility - // to retrieve the IAccessible associated with this view. - if (send_native_event) { - WidgetWin* view_widget = static_cast<WidgetWin*>(GetWidget()); - int child_id = view_widget->AddAccessibilityViewEvent(this); - ::NotifyWinEvent(ViewAccessibility::MSAAEvent(event_type), - view_widget->GetNativeView(), OBJID_CLIENT, child_id); - } + WidgetWin* view_widget = static_cast<WidgetWin*>(GetWidget()); + int child_id = view_widget->AddAccessibilityViewEvent(this); + ::NotifyWinEvent(ViewAccessibility::MSAAEvent(event_type), + view_widget->GetNativeView(), OBJID_CLIENT, child_id); } ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { diff --git a/views/views_delegate.h b/views/views_delegate.h index 27e4498..bc05b45 100644 --- a/views/views_delegate.h +++ b/views/views_delegate.h @@ -11,8 +11,6 @@ #include <windows.h> #endif -#include "views/accessibility/accessibility_types.h" - class Clipboard; namespace gfx { @@ -21,8 +19,6 @@ class Rect; namespace views { -class View; - // ViewsDelegate is an interface implemented by an object using the views // framework. It is used to obtain various high level application utilities // and perform some actions such as window placement saving. @@ -52,11 +48,6 @@ class ViewsDelegate { virtual bool GetSavedMaximizedState(const std::wstring& window_name, bool* maximized) const = 0; - // Notify the delegate that an accessibility event has happened in - // a particular view. - virtual void NotifyAccessibilityEvent( - views::View* view, AccessibilityTypes::Event event_type) = 0; - #if defined(OS_WIN) // Retrieves the default window icon to use for windows if none is specified. virtual HICON GetDefaultWindowIcon() const = 0; |