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

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

Issue 2848493004: Avoiding voice search crash if none of search providers returned anything. (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | 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_list_view.h" 5 #include "ui/app_list/views/search_result_list_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void SearchResultListView::VisibilityChanged(views::View* starting_from, 216 void SearchResultListView::VisibilityChanged(views::View* starting_from,
217 bool is_visible) { 217 bool is_visible) {
218 if (is_visible) 218 if (is_visible)
219 UpdateAutoLaunchState(); 219 UpdateAutoLaunchState();
220 else 220 else
221 CancelAutoLaunchTimeout(); 221 CancelAutoLaunchTimeout();
222 } 222 }
223 223
224 void SearchResultListView::AnimationEnded(const gfx::Animation* animation) { 224 void SearchResultListView::AnimationEnded(const gfx::Animation* animation) {
225 DCHECK_EQ(auto_launch_animation_.get(), animation); 225 DCHECK_EQ(auto_launch_animation_.get(), animation);
226 view_delegate_->OpenSearchResult(results()->GetItemAt(0), true, ui::EF_NONE); 226 if (results()->item_count() > 0) {
227 view_delegate_->OpenSearchResult(results()->GetItemAt(0), true,
228 ui::EF_NONE);
229 }
227 230
228 // The auto-launch has to be canceled explicitly. Think that one of searcher 231 // The auto-launch has to be canceled explicitly. Think that one of searcher
229 // is extremely slow. Sometimes the events would happen in the following 232 // is extremely slow. Sometimes the events would happen in the following
230 // order: 233 // order:
231 // 1. The search results arrive, auto-launch is dispatched 234 // 1. The search results arrive, auto-launch is dispatched
232 // 2. Timed out and auto-launch the first search result 235 // 2. Timed out and auto-launch the first search result
233 // 3. Then another searcher adds search results more 236 // 3. Then another searcher adds search results more
234 // At the step 3, we shouldn't dispatch the auto-launch again. 237 // At the step 3, we shouldn't dispatch the auto-launch again.
235 CancelAutoLaunchTimeout(); 238 CancelAutoLaunchTimeout();
236 } 239 }
(...skipping 20 matching lines...) Expand all
257 view->result(), action_index, event_flags); 260 view->result(), action_index, event_flags);
258 } 261 }
259 } 262 }
260 263
261 void SearchResultListView::OnSearchResultInstalled(SearchResultView* view) { 264 void SearchResultListView::OnSearchResultInstalled(SearchResultView* view) {
262 if (delegate_ && view->result()) 265 if (delegate_ && view->result())
263 delegate_->OnResultInstalled(view->result()); 266 delegate_->OnResultInstalled(view->result());
264 } 267 }
265 268
266 } // namespace app_list 269 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698