summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_window.h6
-rw-r--r--chrome/browser/cocoa/browser_window_cocoa.h2
-rw-r--r--chrome/browser/cocoa/browser_window_cocoa.mm6
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc3
-rw-r--r--chrome/browser/gtk/browser_window_gtk.h2
-rw-r--r--chrome/browser/views/about_chrome_view.cc28
-rw-r--r--chrome/browser/views/browser_dialogs.h4
-rw-r--r--chrome/browser/views/browser_views_accessibility_browsertest.cc25
-rw-r--r--chrome/browser/views/frame/browser_view.cc6
-rw-r--r--chrome/browser/views/frame/browser_view.h2
-rw-r--r--chrome/test/test_browser_window.h2
-rw-r--r--views/accessibility/accessibility_types.h4
-rw-r--r--views/accessibility/view_accessibility.cc102
-rw-r--r--views/accessibility/view_accessibility.h18
-rw-r--r--views/accessibility/view_accessibility_wrapper.h2
-rw-r--r--views/window/dialog_delegate.h9
-rw-r--r--views/window/window_delegate.h11
-rw-r--r--views/window/window_win.cc50
-rw-r--r--views/window/window_win.h5
19 files changed, 200 insertions, 87 deletions
diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h
index c23c4e1..ad10784 100644
--- a/chrome/browser/browser_window.h
+++ b/chrome/browser/browser_window.h
@@ -30,6 +30,10 @@ namespace gfx {
class Rect;
}
+namespace views {
+class Window;
+}
+
////////////////////////////////////////////////////////////////////////////////
// BrowserWindow interface
// An interface implemented by the "view" of the Browser window.
@@ -177,7 +181,7 @@ class BrowserWindow {
virtual void ToggleExtensionShelf() = 0;
// Shows the About Chrome dialog box.
- virtual void ShowAboutChromeDialog() = 0;
+ virtual views::Window* ShowAboutChromeDialog() = 0;
// Shows the Task manager.
virtual void ShowTaskManager() = 0;
diff --git a/chrome/browser/cocoa/browser_window_cocoa.h b/chrome/browser/cocoa/browser_window_cocoa.h
index 3831dd0..2aeffe5 100644
--- a/chrome/browser/cocoa/browser_window_cocoa.h
+++ b/chrome/browser/cocoa/browser_window_cocoa.h
@@ -65,7 +65,7 @@ class BrowserWindowCocoa : public BrowserWindow,
Profile* profile);
virtual void ToggleBookmarkBar();
virtual void ToggleExtensionShelf();
- virtual void ShowAboutChromeDialog();
+ virtual views::Window* ShowAboutChromeDialog();
virtual void ShowTaskManager();
virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked);
virtual bool IsDownloadShelfVisible() const;
diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm
index dd5316b..d5e95a5 100644
--- a/chrome/browser/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/cocoa/browser_window_cocoa.mm
@@ -252,8 +252,9 @@ void BrowserWindowCocoa::AddFindBar(
return [controller_ addFindBar:find_bar_cocoa_controller];
}
-void BrowserWindowCocoa::ShowAboutChromeDialog() {
+views::Window* BrowserWindowCocoa::ShowAboutChromeDialog() {
NOTIMPLEMENTED();
+ return NULL;
}
void BrowserWindowCocoa::ShowTaskManager() {
@@ -308,7 +309,8 @@ void BrowserWindowCocoa::ShowNewProfileDialog() {
NOTIMPLEMENTED();
}
-void BrowserWindowCocoa::ShowRepostFormWarningDialog(TabContents* tab_contents) {
+void BrowserWindowCocoa::ShowRepostFormWarningDialog(
+ TabContents* tab_contents) {
RepostFormWarningMac::Create(GetNativeHandle(), tab_contents);
}
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index a6480e9..90f55f8 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -878,8 +878,9 @@ void BrowserWindowGtk::ToggleExtensionShelf() {
NOTIMPLEMENTED();
}
-void BrowserWindowGtk::ShowAboutChromeDialog() {
+views::Window* BrowserWindowGtk::ShowAboutChromeDialog() {
ShowAboutDialogForProfile(window_, browser_->profile());
+ return NULL;
}
void BrowserWindowGtk::ShowTaskManager() {
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index a2d1ef2..24b1af7 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -84,7 +84,7 @@ class BrowserWindowGtk : public BrowserWindow,
Profile* profile);
virtual void ToggleBookmarkBar();
virtual void ToggleExtensionShelf();
- virtual void ShowAboutChromeDialog();
+ virtual views::Window* ShowAboutChromeDialog();
virtual void ShowTaskManager();
virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked);
virtual bool IsDownloadShelfVisible() const;
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc
index c22dec8..3fb92de 100644
--- a/chrome/browser/views/about_chrome_view.cc
+++ b/chrome/browser/views/about_chrome_view.cc
@@ -70,13 +70,17 @@ std::wstring StringSubRange(const std::wstring& text, size_t start,
namespace browser {
-// Declared in browser_dialogs.h so that others don't need to depend on our .h.
-void ShowAboutChromeView(gfx::NativeWindow parent,
- Profile* profile) {
- views::Window::CreateChromeWindow(parent,
- gfx::Rect(),
- new AboutChromeView(profile))->Show();
-}
+ // Declared in browser_dialogs.h so that others don't
+ // need to depend on our .h.
+ views::Window* ShowAboutChromeView(gfx::NativeWindow parent,
+ Profile* profile) {
+ views::Window* about_chrome_window =
+ views::Window::CreateChromeWindow(parent,
+ gfx::Rect(),
+ new AboutChromeView(profile));
+ about_chrome_window->Show();
+ return about_chrome_window;
+ }
} // namespace browser
@@ -559,6 +563,10 @@ std::wstring AboutChromeView::GetDialogButtonLabel(
return L"";
}
+std::wstring AboutChromeView::GetWindowTitle() const {
+ return l10n_util::GetString(IDS_ABOUT_CHROME_TITLE);
+}
+
bool AboutChromeView::IsDialogButtonEnabled(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK &&
@@ -599,10 +607,6 @@ bool AboutChromeView::IsModal() const {
return true;
}
-std::wstring AboutChromeView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_ABOUT_CHROME_TITLE);
-}
-
bool AboutChromeView::Accept() {
#if defined(OS_WIN) || defined(OS_CHROMEOS)
UpdateStatus(UPGRADE_STARTED, GOOGLE_UPDATE_NO_ERROR);
@@ -762,7 +766,7 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result,
new_version_available_);
update_label_.SetText(update_string);
show_success_indicator = true;
- // TODO (seanparent) : Need to see if this code needs to change to
+ // TODO(seanparent): Need to see if this code needs to change to
// force a machine restart.
#if defined(OS_WIN)
RestartMessageBox::ShowMessageBox(window()->GetNativeWindow());
diff --git a/chrome/browser/views/browser_dialogs.h b/chrome/browser/views/browser_dialogs.h
index 4fa37be..b0075fb 100644
--- a/chrome/browser/views/browser_dialogs.h
+++ b/chrome/browser/views/browser_dialogs.h
@@ -69,8 +69,8 @@ bool IsBookmarkBubbleViewShowing();
void ShowBookmarkManagerView(Profile* profile);
// Shows the about dialog. See AboutChromeView.
-void ShowAboutChromeView(gfx::NativeWindow parent,
- Profile* profile);
+views::Window* ShowAboutChromeView(gfx::NativeWindow parent,
+ Profile* profile);
// Shows an HTML dialog. See HtmlDialogView.
void ShowHtmlDialogView(gfx::NativeWindow parent, Profile* profile,
diff --git a/chrome/browser/views/browser_views_accessibility_browsertest.cc b/chrome/browser/views/browser_views_accessibility_browsertest.cc
index ea1b4d2..bddbb2d 100644
--- a/chrome/browser/views/browser_views_accessibility_browsertest.cc
+++ b/chrome/browser/views/browser_views_accessibility_browsertest.cc
@@ -271,5 +271,30 @@ IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest,
l10n_util::GetString(IDS_ACCNAME_BOOKMARKS),
ROLE_SYSTEM_TOOLBAR);
}
+
+IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest,
+ TestAboutChromeViewAccObj) {
+ // Firstly, test that the WindowDelegate got updated.
+ views::Window* aboutChromeWindow = GetBrowserView()->ShowAboutChromeDialog();
+ EXPECT_STREQ(aboutChromeWindow->GetDelegate()->GetWindowTitle().c_str(),
+ l10n_util::GetString(IDS_ABOUT_CHROME_TITLE).c_str());
+ EXPECT_EQ(aboutChromeWindow->GetDelegate()->accessible_role(),
+ AccessibilityTypes::ROLE_DIALOG);
+
+ // Also test the accessibility object directly.
+ IAccessible* acc_obj = NULL;
+ HRESULT hr =
+ ::AccessibleObjectFromWindow(aboutChromeWindow->GetNativeWindow(),
+ OBJID_CLIENT,
+ IID_IAccessible,
+ reinterpret_cast<void**>(&acc_obj));
+ ASSERT_EQ(S_OK, hr);
+ ASSERT_TRUE(NULL != acc_obj);
+
+ TestAccessibilityInfo(acc_obj, l10n_util::GetString(IDS_ABOUT_CHROME_TITLE),
+ ROLE_SYSTEM_DIALOG);
+
+ acc_obj->Release();
+}
} // Namespace.
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 93de37e..2d36e9c 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -961,9 +961,9 @@ void BrowserView::ToggleExtensionShelf() {
ExtensionShelf::ToggleWhenExtensionShelfVisible(browser_->profile());
}
-void BrowserView::ShowAboutChromeDialog() {
- browser::ShowAboutChromeView(GetWindow()->GetNativeWindow(),
- browser_->profile());
+views::Window* BrowserView::ShowAboutChromeDialog() {
+ return browser::ShowAboutChromeView(GetWindow()->GetNativeWindow(),
+ browser_->profile());
}
void BrowserView::ShowTaskManager() {
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index ece941b..0f2f12c 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -294,7 +294,7 @@ class BrowserView : public BrowserBubbleHost,
Profile* profile);
virtual void ToggleBookmarkBar();
virtual void ToggleExtensionShelf();
- virtual void ShowAboutChromeDialog();
+ virtual views::Window* ShowAboutChromeDialog();
virtual void ShowTaskManager();
virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked);
virtual void SetDownloadShelfVisible(bool visible);
diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h
index c524c26..2e2ddcb 100644
--- a/chrome/test/test_browser_window.h
+++ b/chrome/test/test_browser_window.h
@@ -68,7 +68,7 @@ class TestBrowserWindow : public BrowserWindow {
Profile* profile) {}
virtual void ToggleBookmarkBar() {}
virtual void ToggleExtensionShelf() {}
- virtual void ShowAboutChromeDialog() {}
+ virtual views::Window* ShowAboutChromeDialog() { return NULL; }
virtual void ShowTaskManager() {}
virtual void ShowBookmarkManager() {}
virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) {}
diff --git a/views/accessibility/accessibility_types.h b/views/accessibility/accessibility_types.h
index 83c7aa7..882b8a1 100644
--- a/views/accessibility/accessibility_types.h
+++ b/views/accessibility/accessibility_types.h
@@ -5,6 +5,8 @@
#ifndef VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_
#define VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_
+#include "base/basictypes.h"
+
////////////////////////////////////////////////////////////////////////////////
//
// AccessibilityTypes
@@ -15,7 +17,6 @@
////////////////////////////////////////////////////////////////////////////////
class AccessibilityTypes {
public:
-
// This defines states of the supported accessibility roles in our
// Views (e.g. used in View::GetAccessibleState). Any interface using roles
@@ -41,6 +42,7 @@ class AccessibilityTypes {
ROLE_CHECKBUTTON,
ROLE_CLIENT,
ROLE_COMBOBOX,
+ ROLE_DIALOG,
ROLE_GRAPHIC,
ROLE_GROUPING,
ROLE_LINK,
diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc
index 2854c15..c440e53 100644
--- a/views/accessibility/view_accessibility.cc
+++ b/views/accessibility/view_accessibility.cc
@@ -702,6 +702,56 @@ void ViewAccessibility::SetState(VARIANT* msaa_state, views::View* view) {
msaa_state->lVal |= MSAAState(state);
}
+// IAccessible functions not supported.
+
+HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) {
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) {
+ if (selected)
+ selected->vt = VT_EMPTY;
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP ViewAccessibility::accSelect(LONG flagsSelect, VARIANT var_id) {
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP ViewAccessibility::get_accHelp(VARIANT var_id, BSTR* help) {
+ if (help)
+ *help = NULL;
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP ViewAccessibility::get_accHelpTopic(BSTR* help_file,
+ VARIANT var_id,
+ LONG* topic_id) {
+ if (help_file) {
+ *help_file = NULL;
+ }
+ if (topic_id) {
+ *topic_id = static_cast<LONG>(-1);
+ }
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP ViewAccessibility::put_accName(VARIANT var_id, BSTR put_name) {
+ // Deprecated.
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP ViewAccessibility::put_accValue(VARIANT var_id, BSTR put_val) {
+ if (V_VT(&var_id) == VT_BSTR) {
+ if (!lstrcmpi(var_id.bstrVal, kViewsUninitializeAccessibilityInstance)) {
+ view_ = NULL;
+ return S_OK;
+ }
+ }
+ // Deprecated.
+ return E_NOTIMPL;
+}
+
int32 ViewAccessibility::MSAARole(AccessibilityTypes::Role role) {
switch (role) {
case AccessibilityTypes::ROLE_APPLICATION:
@@ -714,6 +764,8 @@ int32 ViewAccessibility::MSAARole(AccessibilityTypes::Role role) {
return ROLE_SYSTEM_CHECKBUTTON;
case AccessibilityTypes::ROLE_COMBOBOX:
return ROLE_SYSTEM_COMBOBOX;
+ case AccessibilityTypes::ROLE_DIALOG:
+ return ROLE_SYSTEM_DIALOG;
case AccessibilityTypes::ROLE_GRAPHIC:
return ROLE_SYSTEM_GRAPHIC;
case AccessibilityTypes::ROLE_GROUPING:
@@ -774,56 +826,6 @@ int32 ViewAccessibility::MSAAState(AccessibilityTypes::State state) {
return msaa_state;
}
-// IAccessible functions not supported.
-
-HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) {
- return E_NOTIMPL;
-}
-
-STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) {
- if (selected)
- selected->vt = VT_EMPTY;
- return E_NOTIMPL;
-}
-
-STDMETHODIMP ViewAccessibility::accSelect(LONG flagsSelect, VARIANT var_id) {
- return E_NOTIMPL;
-}
-
-STDMETHODIMP ViewAccessibility::get_accHelp(VARIANT var_id, BSTR* help) {
- if (help)
- *help = NULL;
- return E_NOTIMPL;
-}
-
-STDMETHODIMP ViewAccessibility::get_accHelpTopic(BSTR* help_file,
- VARIANT var_id,
- LONG* topic_id) {
- if (help_file) {
- *help_file = NULL;
- }
- if (topic_id) {
- *topic_id = static_cast<LONG>(-1);
- }
- return E_NOTIMPL;
-}
-
-STDMETHODIMP ViewAccessibility::put_accName(VARIANT var_id, BSTR put_name) {
- // Deprecated.
- return E_NOTIMPL;
-}
-
-STDMETHODIMP ViewAccessibility::put_accValue(VARIANT var_id, BSTR put_val) {
- if (V_VT(&var_id) == VT_BSTR) {
- if (!lstrcmpi(var_id.bstrVal, kViewsUninitializeAccessibilityInstance)) {
- view_ = NULL;
- return S_OK;
- }
- }
- // Deprecated.
- return E_NOTIMPL;
-}
-
HRESULT ViewAccessibility::GetNativeIAccessibleInterface(
views::NativeViewHost* native_host, IDispatch** disp_child) {
if (!native_host || !disp_child) {
diff --git a/views/accessibility/view_accessibility.h b/views/accessibility/view_accessibility.h
index b7a6dad..0224dfa07 100644
--- a/views/accessibility/view_accessibility.h
+++ b/views/accessibility/view_accessibility.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.
@@ -103,6 +103,14 @@ class ATL_NO_VTABLE ViewAccessibility
STDMETHODIMP put_accName(VARIANT var_id, BSTR put_name);
STDMETHODIMP put_accValue(VARIANT var_id, BSTR put_val);
+ // Returns a conversion from the Role (as defined in accessibility_types.h)
+ // to an MSAA role.
+ static int32 MSAARole(AccessibilityTypes::Role role);
+
+ // Returns a conversion from the State (as defined in accessibility_types.h)
+ // to MSAA states set.
+ static int32 MSAAState(AccessibilityTypes::State state);
+
private:
// Checks to see if child_id is within the child bounds of view. Returns true
// if the child is within the bounds, false otherwise.
@@ -128,14 +136,6 @@ class ATL_NO_VTABLE ViewAccessibility
// Helper function which sets applicable states of view.
void SetState(VARIANT* msaa_state, views::View* view);
- // Returns a conversion from the Role (as defined in accessibility_types.h)
- // to an MSAA role.
- int32 MSAARole(AccessibilityTypes::Role role);
-
- // Returns a conversion from the State (as defined in accessibility_types.h)
- // to MSAA states set.
- int32 MSAAState(AccessibilityTypes::State state);
-
// Returns the IAccessible interface for a native view if applicable.
// Returns S_OK on success.
HRESULT GetNativeIAccessibleInterface(views::NativeViewHost* native_host,
diff --git a/views/accessibility/view_accessibility_wrapper.h b/views/accessibility/view_accessibility_wrapper.h
index 619c91d..c6aa08e 100644
--- a/views/accessibility/view_accessibility_wrapper.h
+++ b/views/accessibility/view_accessibility_wrapper.h
@@ -6,6 +6,8 @@
#define VIEWS_ACCESSIBILITY_VIEW_ACCESSIBILITY_WRAPPER_H_
#include <atlcomcli.h>
+// Necessary to define OleAcc GUID's used in window_win.cc.
+#include <initguid.h>
#include <oleacc.h>
#include "base/basictypes.h"
diff --git a/views/window/dialog_delegate.h b/views/window/dialog_delegate.h
index ebfde24..da120e7 100644
--- a/views/window/dialog_delegate.h
+++ b/views/window/dialog_delegate.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.
@@ -6,6 +6,7 @@
#define VIEWS_WINDOW_DIALOG_DELEGATE_H_
#include "app/message_box_flags.h"
+#include "views/accessibility/accessibility_types.h"
#include "views/window/dialog_client_view.h"
#include "views/window/window_delegate.h"
@@ -115,6 +116,12 @@ class DialogDelegate : public WindowDelegate {
// A helper for accessing the DialogClientView object contained by this
// delegate's Window.
DialogClientView* GetDialogClientView() const;
+
+ private:
+ // Overridden from WindowDelegate:
+ AccessibilityTypes::Role accessible_role() const {
+ return AccessibilityTypes::ROLE_DIALOG;
+ }
};
} // namespace views
diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h
index 30174c8..a5144d0 100644
--- a/views/window/window_delegate.h
+++ b/views/window/window_delegate.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.
@@ -8,6 +8,7 @@
#include <string>
#include "base/scoped_ptr.h"
+#include "views/accessibility/accessibility_types.h"
class SkBitmap;
@@ -54,6 +55,14 @@ class WindowDelegate {
return false;
}
+ virtual AccessibilityTypes::Role accessible_role() const {
+ return AccessibilityTypes::ROLE_WINDOW;
+ }
+
+ virtual AccessibilityTypes::State accessible_state() const {
+ return 0;
+ }
+
// Returns the text to be displayed in the window title.
virtual std::wstring GetWindowTitle() const {
return L"";
diff --git a/views/window/window_win.cc b/views/window/window_win.cc
index 64a2115..c9efbff 100644
--- a/views/window/window_win.cc
+++ b/views/window/window_win.cc
@@ -17,6 +17,7 @@
#include "gfx/font.h"
#include "gfx/icon_util.h"
#include "gfx/path.h"
+#include "views/accessibility/view_accessibility.h"
#include "views/widget/root_view.h"
#include "views/window/client_view.h"
#include "views/window/custom_frame_view.h"
@@ -410,6 +411,9 @@ void WindowWin::UpdateWindowTitle() {
if (base::i18n::AdjustStringForLocaleDirection(window_title, &localized_text))
window_title.assign(localized_text);
SetWindowText(GetNativeView(), window_title.c_str());
+
+ // Also update the accessibility name.
+ UpdateAccessibleName(window_title);
}
void WindowWin::UpdateWindowIcon() {
@@ -542,6 +546,8 @@ void WindowWin::Init(HWND parent, const gfx::Rect& bounds) {
WidgetWin::SetContentsView(non_client_view_);
UpdateWindowTitle();
+ UpdateAccessibleRole();
+ UpdateAccessibleState();
SetInitialBounds(bounds);
@@ -1392,6 +1398,50 @@ void WindowWin::ResetWindowRegion(bool force) {
DeleteObject(current_rgn);
}
+void WindowWin::UpdateAccessibleName(std::wstring name) {
+ ScopedComPtr<IAccPropServices> pAccPropServices;
+ HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
+ IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
+ if (SUCCEEDED(hr)) {
+ VARIANT var;
+ var.vt = VT_BSTR;
+ var.bstrVal = SysAllocString(name.c_str());
+ hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT,
+ CHILDID_SELF, PROPID_ACC_NAME, var);
+ }
+}
+
+void WindowWin::UpdateAccessibleRole() {
+ ScopedComPtr<IAccPropServices> pAccPropServices;
+ HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
+ IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
+ if (SUCCEEDED(hr)) {
+ VARIANT var;
+ AccessibilityTypes::Role role = window_delegate_->accessible_role();
+ if (role) {
+ var.vt = VT_I4;
+ var.lVal = ViewAccessibility::MSAARole(role);
+ hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT,
+ CHILDID_SELF, PROPID_ACC_ROLE, var);
+ }
+ }
+}
+
+void WindowWin::UpdateAccessibleState() {
+ ScopedComPtr<IAccPropServices> pAccPropServices;
+ HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
+ IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
+ if (SUCCEEDED(hr)) {
+ VARIANT var;
+ AccessibilityTypes::State state = window_delegate_->accessible_state();
+ if (state) {
+ var.lVal = ViewAccessibility::MSAAState(state);
+ hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT,
+ CHILDID_SELF, PROPID_ACC_STATE, var);
+ }
+ }
+}
+
void WindowWin::ProcessNCMousePress(const CPoint& point, int flags) {
CPoint temp = point;
MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1);
diff --git a/views/window/window_win.h b/views/window/window_win.h
index 02812aa..c1b1630 100644
--- a/views/window/window_win.h
+++ b/views/window/window_win.h
@@ -191,6 +191,11 @@ class WindowWin : public WidgetWin,
// frame windows.
void ResetWindowRegion(bool force);
+ // Update accessibility information via our WindowDelegate.
+ void UpdateAccessibleName(std::wstring name);
+ void UpdateAccessibleRole();
+ void UpdateAccessibleState();
+
// Converts a non-client mouse down message to a regular ChromeViews event
// and handle it. |point| is the mouse position of the message in screen
// coords. |flags| are flags that would be passed with a WM_L/M/RBUTTON*