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

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

Issue 307333002: Add search results to experimental app list start page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments, fix for breaking a test Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/views/contents_view.cc ('k') | ui/app_list/views/start_page_view.h » ('j') | 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 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "third_party/skia/include/core/SkColor.h" 12 #include "third_party/skia/include/core/SkColor.h"
13 #include "ui/app_list/app_list_switches.h"
13 #include "ui/app_list/app_list_view_delegate.h" 14 #include "ui/app_list/app_list_view_delegate.h"
14 #include "ui/app_list/views/search_result_list_view_delegate.h" 15 #include "ui/app_list/views/search_result_list_view_delegate.h"
15 #include "ui/app_list/views/search_result_view.h" 16 #include "ui/app_list/views/search_result_view.h"
16 #include "ui/events/event.h" 17 #include "ui/events/event.h"
17 #include "ui/gfx/animation/linear_animation.h" 18 #include "ui/gfx/animation/linear_animation.h"
18 #include "ui/views/background.h" 19 #include "ui/views/background.h"
19 #include "ui/views/layout/box_layout.h" 20 #include "ui/views/layout/box_layout.h"
20 21
21 namespace { 22 namespace {
22 23
23 const int kMaxResults = 6; 24 const int kMaxResults = 6;
25 const int kExperimentAppListMaxResults = 3;
24 const int kTimeoutIndicatorHeight = 2; 26 const int kTimeoutIndicatorHeight = 2;
25 const int kTimeoutFramerate = 60; 27 const int kTimeoutFramerate = 60;
26 const SkColor kTimeoutIndicatorColor = SkColorSetRGB(30, 144, 255); 28 const SkColor kTimeoutIndicatorColor = SkColorSetRGB(30, 144, 255);
27 29
28 } // namespace 30 } // namespace
29 31
30 namespace app_list { 32 namespace app_list {
31 33
32 SearchResultListView::SearchResultListView( 34 SearchResultListView::SearchResultListView(
33 SearchResultListViewDelegate* delegate, 35 SearchResultListViewDelegate* delegate,
34 AppListViewDelegate* view_delegate) 36 AppListViewDelegate* view_delegate)
35 : delegate_(delegate), 37 : delegate_(delegate),
36 view_delegate_(view_delegate), 38 view_delegate_(view_delegate),
37 results_(NULL), 39 results_(NULL),
38 results_container_(new views::View), 40 results_container_(new views::View),
39 auto_launch_indicator_(new views::View), 41 auto_launch_indicator_(new views::View),
40 last_visible_index_(0), 42 last_visible_index_(0),
41 selected_index_(-1), 43 selected_index_(-1),
42 update_factory_(this) { 44 update_factory_(this) {
43 results_container_->SetLayoutManager( 45 results_container_->SetLayoutManager(
44 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); 46 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
45 47
46 for (int i = 0; i < kMaxResults; ++i) 48 int max_results = kMaxResults;
49 if (app_list::switches::IsExperimentalAppListEnabled())
50 max_results = kExperimentAppListMaxResults;
51
52 for (int i = 0; i < max_results; ++i)
47 results_container_->AddChildView(new SearchResultView(this)); 53 results_container_->AddChildView(new SearchResultView(this));
48 AddChildView(results_container_); 54 AddChildView(results_container_);
49 55
50 auto_launch_indicator_->set_background( 56 auto_launch_indicator_->set_background(
51 views::Background::CreateSolidBackground(kTimeoutIndicatorColor)); 57 views::Background::CreateSolidBackground(kTimeoutIndicatorColor));
52 auto_launch_indicator_->SetVisible(false); 58 auto_launch_indicator_->SetVisible(false);
53 59
54 AddChildView(auto_launch_indicator_); 60 AddChildView(auto_launch_indicator_);
55 } 61 }
56 62
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 if (delegate_ && view->result()) 283 if (delegate_ && view->result())
278 delegate_->OnResultInstalled(view->result()); 284 delegate_->OnResultInstalled(view->result());
279 } 285 }
280 286
281 void SearchResultListView::OnSearchResultUninstalled(SearchResultView* view) { 287 void SearchResultListView::OnSearchResultUninstalled(SearchResultView* view) {
282 if (delegate_ && view->result()) 288 if (delegate_ && view->result())
283 delegate_->OnResultUninstalled(view->result()); 289 delegate_->OnResultUninstalled(view->result());
284 } 290 }
285 291
286 } // namespace app_list 292 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/contents_view.cc ('k') | ui/app_list/views/start_page_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698