OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |