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

Unified Diff: ash/launcher/launcher_view.cc

Issue 9121050: Add accessible names to the launcher buttons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update DEPS file Created 8 years, 11 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
« no previous file with comments | « ash/launcher/launcher_view.h ('k') | ash/launcher/tabbed_launcher_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_view.cc
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index d674bb343f3ed6a78c2009631531d8012f5e78d0..265d6efcfd3cdeedce9b1051135d71ef7366012f 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -13,10 +13,12 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "base/utf_string_conversions.h"
+#include "grit/ash_strings.h"
#include "grit/ui_resources.h"
#include "ui/aura/window.h"
#include "ui/base/animation/animation.h"
#include "ui/base/animation/throb_animation.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/compositor/layer.h"
@@ -220,6 +222,8 @@ void LauncherView::Init() {
overflow_button_->SetImage(
views::CustomButton::BS_PUSHED,
rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap());
+ overflow_button_->SetAccessibleName(
+ l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME));
achuithb 2012/02/01 11:32:10 I'm getting an assertion failure here. I see this
ConfigureChildView(overflow_button_);
AddChildView(overflow_button_);
@@ -643,5 +647,31 @@ void LauncherView::ButtonPressed(views::Button* sender,
}
}
+string16 LauncherView::GetAccessibleName(views::View* view) {
+ ShellDelegate* delegate = Shell::GetInstance()->delegate();
+ if (!delegate)
+ return string16();
+ int view_index = view_model_->GetIndexOfView(view);
+ // May be -1 while in the process of animating closed.
+ if (view_index == -1)
+ return string16();
+
+ switch (model_->items()[view_index].type) {
+ case TYPE_TABBED:
+ case TYPE_APP:
+ return delegate->GetLauncherItemTitle(model_->items()[view_index]);
+
+ case TYPE_APP_LIST:
+ return l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE);
+
+ case TYPE_BROWSER_SHORTCUT:
+ return l10n_util::GetStringUTF16(IDS_AURA_CYCLER_TITLE);
+
+ default:
+ NOTREACHED();
+ }
+ return string16();
+}
+
} // namespace internal
} // namespace ash
« no previous file with comments | « ash/launcher/launcher_view.h ('k') | ash/launcher/tabbed_launcher_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698