Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(908)

Unified Diff: chrome/browser/views/browser_actions_container.cc

Issue 1105008: Allow Extensions to have MSAA information (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/browser_actions_container.cc
diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc
index 32f0f028bbdd98f02c6b751d3a52acd719853973..2674e50c0523f9ddaca5f27ef8bc1cb1b68c7031 100644
--- a/chrome/browser/views/browser_actions_container.cc
+++ b/chrome/browser/views/browser_actions_container.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/browser_actions_container.h"
#include "app/gfx/canvas.h"
+#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "app/slide_animation.h"
#include "base/stl_util-inl.h"
@@ -28,6 +29,7 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "grit/app_resources.h"
+#include "grit/generated_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
@@ -161,7 +163,12 @@ void BrowserActionButton::UpdateState() {
else if (!default_icon_.isNull())
SetIcon(default_icon_);
- SetTooltipText(UTF8ToWide(browser_action()->GetTitle(tab_id)));
+ // If the browser action name is empty, show the extension name instead.
+ std::wstring name = UTF8ToWide(browser_action()->GetTitle(tab_id));
+ if (name.empty())
+ name = UTF8ToWide(extension()->name());
+ SetTooltipText(name);
+ SetAccessibleName(name);
GetParent()->SchedulePaint();
}
@@ -302,6 +309,18 @@ gfx::Canvas* BrowserActionView::GetIconWithBadge() {
return canvas;
}
+bool BrowserActionView::GetAccessibleRole(AccessibilityTypes::Role* role) {
+ DCHECK(role);
M-A Ruel 2010/03/23 00:36:01 drive-by: you should have removed the DCHECK and s
+ *role = AccessibilityTypes::ROLE_GROUPING;
tfarina (gmail-do not use) 2010/03/20 19:47:21 nit: could you add the following lines? if (!role)
+ return true;
+}
+
+bool BrowserActionView::GetAccessibleName(std::wstring* name) {
M-A Ruel 2010/03/23 00:36:01 Same.
+ DCHECK(name);
+ *name = l10n_util::GetString(IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION);
tfarina (gmail-do not use) 2010/03/20 19:47:21 nit: could you add the following lines? if (!name
+ return true;
+}
+
void BrowserActionView::Layout() {
button_->SetBounds(0, kControlVertOffset, width(), kButtonSize);
}
@@ -347,6 +366,8 @@ BrowserActionsContainer::BrowserActionsContainer(
resize_animation_.reset(new SlideAnimation(this));
resize_gripper_ = new views::ResizeGripper(this);
+ resize_gripper_->SetAccessibleName(
+ l10n_util::GetString(IDS_ACCNAME_SEPARATOR));
resize_gripper_->SetVisible(false);
AddChildView(resize_gripper_);
@@ -356,6 +377,8 @@ BrowserActionsContainer::BrowserActionsContainer(
chevron_ = new views::MenuButton(NULL, std::wstring(), this, false);
chevron_->SetVisible(false);
chevron_->SetIcon(*chevron_image);
+ chevron_->SetAccessibleName(
+ l10n_util::GetString(IDS_ACCNAME_EXTENSIONS_CHEVRON));
// Chevron contains >> that should point left in LTR locales.
chevron_->EnableCanvasFlippingForRTLUI(true);
AddChildView(chevron_);
@@ -781,6 +804,19 @@ int BrowserActionsContainer::OnPerformDrop(
return DragDropTypes::DRAG_MOVE;
}
+bool BrowserActionsContainer::GetAccessibleRole(
+ AccessibilityTypes::Role* role) {
+ DCHECK(role);
+ *role = AccessibilityTypes::ROLE_GROUPING;
tfarina (gmail-do not use) 2010/03/20 19:47:21 nit: could you add the following lines? if (!role)
+ return true;
+}
+
+bool BrowserActionsContainer::GetAccessibleName(std::wstring* name) {
+ DCHECK(name);
+ *name = l10n_util::GetString(IDS_ACCNAME_EXTENSIONS);
tfarina (gmail-do not use) 2010/03/20 19:47:21 nit: could you add the following lines? if (!name)
+ return !name->empty();
+}
+
void BrowserActionsContainer::MoveBrowserAction(
const std::string& extension_id, size_t new_index) {
ExtensionsService* service = profile_->GetExtensionsService();

Powered by Google App Engine
This is Rietveld 408576698