summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-14 02:11:30 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-14 02:11:30 +0000
commit28b2c9f571517b8b5e733d08e8245dc04dd7c7b3 (patch)
treec17411ea7e7f51d82795833c46c78ef811599df2 /chrome/browser
parentc0264d4ace26f16fdc216f3a8e533a3387baecb2 (diff)
downloadchromium_src-28b2c9f571517b8b5e733d08e8245dc04dd7c7b3.zip
chromium_src-28b2c9f571517b8b5e733d08e8245dc04dd7c7b3.tar.gz
chromium_src-28b2c9f571517b8b5e733d08e8245dc04dd7c7b3.tar.bz2
Get the new frames to pass the accessibility UI tests.
B=2235 Review URL: http://codereview.chromium.org/3039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc38
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.h6
2 files changed, 43 insertions, 1 deletions
diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc
index 4cefabb..7fdbe04 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.cc
+++ b/chrome/browser/views/frame/opaque_non_client_view.cc
@@ -10,8 +10,11 @@
#include "chrome/browser/views/window_resources.h"
#include "chrome/common/gfx/chrome_font.h"
#include "chrome/common/gfx/path.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
-
+#include "chrome/views/root_view.h"
+#include "chromium_strings.h"
+#include "generated_resources.h"
// An enumeration of bitmap resources used by this window.
enum {
@@ -404,6 +407,8 @@ OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame,
ChromeViews::Button::BS_PUSHED,
resources->GetPartBitmap(FRAME_MINIMIZE_BUTTON_ICON_P));
minimize_button_->SetListener(this, -1);
+ minimize_button_->SetAccessibleName(
+ l10n_util::GetString(IDS_ACCNAME_MINIMIZE));
AddChildView(minimize_button_);
maximize_button_->SetImage(
@@ -416,6 +421,8 @@ OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame,
ChromeViews::Button::BS_PUSHED,
resources->GetPartBitmap(FRAME_MAXIMIZE_BUTTON_ICON_P));
maximize_button_->SetListener(this, -1);
+ maximize_button_->SetAccessibleName(
+ l10n_util::GetString(IDS_ACCNAME_MAXIMIZE));
AddChildView(maximize_button_);
restore_button_->SetImage(
@@ -428,6 +435,8 @@ OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame,
ChromeViews::Button::BS_PUSHED,
resources->GetPartBitmap(FRAME_RESTORE_BUTTON_ICON_P));
restore_button_->SetListener(this, -1);
+ restore_button_->SetAccessibleName(
+ l10n_util::GetString(IDS_ACCNAME_RESTORE));
AddChildView(restore_button_);
close_button_->SetImage(
@@ -440,6 +449,7 @@ OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame,
ChromeViews::Button::BS_PUSHED,
resources->GetPartBitmap(FRAME_CLOSE_BUTTON_ICON_P));
close_button_->SetListener(this, -1);
+ close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
AddChildView(close_button_);
window_icon_->set_is_light(true);
@@ -663,9 +673,35 @@ void OpaqueNonClientView::ViewHierarchyChanged(bool is_add,
DCHECK(GetViewContainer());
DCHECK(frame_->client_view()->GetParent() != this);
AddChildView(frame_->client_view());
+
+ // 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));
+ SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
}
}
+bool OpaqueNonClientView::GetAccessibleRole(VARIANT* role) {
+ DCHECK(role);
+ // We aren't actually the client area of the window, but we act like it as
+ // far as MSAA and the UI tests are concerned.
+ role->vt = VT_I4;
+ role->lVal = ROLE_SYSTEM_CLIENT;
+ return true;
+}
+
+bool OpaqueNonClientView::GetAccessibleName(std::wstring* name) {
+ if (!accessible_name_.empty()) {
+ *name = accessible_name_;
+ return true;
+ }
+ return false;
+}
+
+void OpaqueNonClientView::SetAccessibleName(const std::wstring& name) {
+ accessible_name_ = name;
+}
+
///////////////////////////////////////////////////////////////////////////////
// OpaqueNonClientView, private:
diff --git a/chrome/browser/views/frame/opaque_non_client_view.h b/chrome/browser/views/frame/opaque_non_client_view.h
index 227baa4..e684d81 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.h
+++ b/chrome/browser/views/frame/opaque_non_client_view.h
@@ -63,6 +63,9 @@ class OpaqueNonClientView : public ChromeViews::NonClientView,
virtual void ViewHierarchyChanged(bool is_add,
ChromeViews::View* parent,
ChromeViews::View* child);
+ virtual bool GetAccessibleRole(VARIANT* role);
+ virtual bool GetAccessibleName(std::wstring* name);
+ virtual void SetAccessibleName(const std::wstring& name);
private:
// Updates the system menu icon button.
@@ -122,6 +125,9 @@ class OpaqueNonClientView : public ChromeViews::NonClientView,
WindowResources* current_active_resources_;
WindowResources* current_inactive_resources_;
+ // The accessible name of this view.
+ std::wstring accessible_name_;
+
static void InitClass();
static SkBitmap distributor_logo_;
static WindowResources* active_resources_;