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

Unified Diff: ash/app_list/app_list_item_view.cc

Issue 9985005: Add accessibility info to app list items and allow them to be focused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/app_list/app_list_item_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/app_list/app_list_item_view.cc
diff --git a/ash/app_list/app_list_item_view.cc b/ash/app_list/app_list_item_view.cc
index c9e74922154ff86079305586f38d0294a68bb239..59c1581b00bce7cf9d3ca99078eb5abbef665d42 100644
--- a/ash/app_list/app_list_item_view.cc
+++ b/ash/app_list/app_list_item_view.cc
@@ -13,6 +13,7 @@
#include "base/synchronization/cancellation_flag.h"
#include "base/threading/worker_pool.h"
#include "base/utf_string_conversions.h"
+#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/animation/throb_animation.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
@@ -23,6 +24,7 @@
#include "ui/views/controls/menu/menu_item_view.h"
#include "ui/views/controls/menu/menu_model_adapter.h"
#include "ui/views/controls/menu/menu_runner.h"
+#include "ui/views/widget/widget.h"
namespace ash {
@@ -203,6 +205,7 @@ AppListItemView::AppListItemView(AppListModelView* list_model_view,
set_context_menu_controller(this);
set_request_focus_on_press(false);
+ set_focusable(true);
}
AppListItemView::~AppListItemView() {
@@ -251,6 +254,7 @@ void AppListItemView::SetSelected(bool selected) {
if (selected == selected_)
return;
+ RequestFocus();
selected_ = selected;
SchedulePaint();
}
@@ -307,7 +311,8 @@ void AppListItemView::ItemIconChanged() {
}
void AppListItemView::ItemTitleChanged() {
- title_->SetText(UTF8ToUTF16(model_->title()));
+ accessible_name_ = UTF8ToUTF16(model_->title());
+ title_->SetText(accessible_name_);
}
void AppListItemView::ItemHighlightedChanged() {
@@ -360,6 +365,11 @@ void AppListItemView::OnPaint(gfx::Canvas* canvas) {
}
}
+void AppListItemView::GetAccessibleState(ui::AccessibleViewState* state) {
+ state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON;
+ state->name = accessible_name_;
sky 2012/04/19 15:47:14 Since title_ has the text you care about, get it f
Zachary Kuznia 2012/04/20 07:18:50 Done.
+}
+
void AppListItemView::ShowContextMenuForView(views::View* source,
const gfx::Point& point) {
ui::MenuModel* menu_model = model_->GetContextMenuModel();
« no previous file with comments | « ash/app_list/app_list_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698