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

Side by Side Diff: ui/app_list/views/search_result_view.cc

Issue 935523002: App launcher: Spoken feedback reads out details of search results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NON_EXPORTED_BASE to fix Windows compile. Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/app_list/views/search_result_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/app_list/views/search_result_view.h" 5 #include "ui/app_list/views/search_result_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/utf_string_conversions.h"
9 #include "ui/app_list/app_list_constants.h" 10 #include "ui/app_list/app_list_constants.h"
10 #include "ui/app_list/app_list_switches.h" 11 #include "ui/app_list/app_list_switches.h"
11 #include "ui/app_list/search_result.h" 12 #include "ui/app_list/search_result.h"
12 #include "ui/app_list/views/progress_bar_view.h" 13 #include "ui/app_list/views/progress_bar_view.h"
13 #include "ui/app_list/views/search_result_actions_view.h" 14 #include "ui/app_list/views/search_result_actions_view.h"
14 #include "ui/app_list/views/search_result_list_view.h" 15 #include "ui/app_list/views/search_result_list_view.h"
15 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
16 #include "ui/gfx/font.h" 17 #include "ui/gfx/font.h"
17 #include "ui/gfx/image/image_skia_operations.h" 18 #include "ui/gfx/image/image_skia_operations.h"
18 #include "ui/gfx/render_text.h" 19 #include "ui/gfx/render_text.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 result_ = NULL; 114 result_ = NULL;
114 } 115 }
115 116
116 void SearchResultView::ClearSelectedAction() { 117 void SearchResultView::ClearSelectedAction() {
117 actions_view_->SetSelectedAction(-1); 118 actions_view_->SetSelectedAction(-1);
118 } 119 }
119 120
120 void SearchResultView::UpdateTitleText() { 121 void SearchResultView::UpdateTitleText() {
121 if (!result_ || result_->title().empty()) { 122 if (!result_ || result_->title().empty()) {
122 title_text_.reset(); 123 title_text_.reset();
123 SetAccessibleName(base::string16());
124 } else { 124 } else {
125 title_text_.reset(CreateRenderText(result_->title(), 125 title_text_.reset(CreateRenderText(result_->title(),
126 result_->title_tags())); 126 result_->title_tags()));
127 SetAccessibleName(result_->title());
128 } 127 }
128
129 UpdateAccessibleName();
129 } 130 }
130 131
131 void SearchResultView::UpdateDetailsText() { 132 void SearchResultView::UpdateDetailsText() {
132 if (!result_ || result_->details().empty()) { 133 if (!result_ || result_->details().empty()) {
133 details_text_.reset(); 134 details_text_.reset();
134 } else { 135 } else {
135 details_text_.reset(CreateRenderText(result_->details(), 136 details_text_.reset(CreateRenderText(result_->details(),
136 result_->details_tags())); 137 result_->details_tags()));
137 } 138 }
139
140 UpdateAccessibleName();
141 }
142
143 base::string16 SearchResultView::ComputeAccessibleName() const {
144 if (!result_)
145 return base::string16();
146
147 base::string16 accessible_name = result_->title();
148 if (!result_->title().empty() && !result_->details().empty())
149 accessible_name += base::ASCIIToUTF16(", ");
150 accessible_name += result_->details();
151
152 return accessible_name;
153 }
154
155 void SearchResultView::UpdateAccessibleName() {
156 SetAccessibleName(ComputeAccessibleName());
138 } 157 }
139 158
140 const char* SearchResultView::GetClassName() const { 159 const char* SearchResultView::GetClassName() const {
141 return kViewClassName; 160 return kViewClassName;
142 } 161 }
143 162
144 gfx::Size SearchResultView::GetPreferredSize() const { 163 gfx::Size SearchResultView::GetPreferredSize() const {
145 return gfx::Size(kPreferredWidth, kPreferredHeight); 164 return gfx::Size(kPreferredWidth, kPreferredHeight);
146 } 165 }
147 166
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 if (context_menu_runner_->RunMenuAt(GetWidget(), 385 if (context_menu_runner_->RunMenuAt(GetWidget(),
367 NULL, 386 NULL,
368 gfx::Rect(point, gfx::Size()), 387 gfx::Rect(point, gfx::Size()),
369 views::MENU_ANCHOR_TOPLEFT, 388 views::MENU_ANCHOR_TOPLEFT,
370 source_type) == 389 source_type) ==
371 views::MenuRunner::MENU_DELETED) 390 views::MenuRunner::MENU_DELETED)
372 return; 391 return;
373 } 392 }
374 393
375 } // namespace app_list 394 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/search_result_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698