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

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

Issue 291653003: Add a unit test for the experimental app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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.h ('k') | ui/app_list/views/start_page_view.cc » ('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/contents_view.h" 5 #include "ui/app_list/views/contents_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/app_list/app_list_constants.h" 10 #include "ui/app_list/app_list_constants.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 } // namespace 53 } // namespace
54 54
55 ContentsView::ContentsView(AppListMainView* app_list_main_view, 55 ContentsView::ContentsView(AppListMainView* app_list_main_view,
56 PaginationModel* pagination_model, 56 PaginationModel* pagination_model,
57 AppListModel* model, 57 AppListModel* model,
58 AppListViewDelegate* view_delegate) 58 AppListViewDelegate* view_delegate)
59 : show_state_(SHOW_APPS), 59 : show_state_(SHOW_APPS),
60 pagination_model_(pagination_model), 60 pagination_model_(pagination_model),
61 start_page_view_(NULL),
61 app_list_main_view_(app_list_main_view), 62 app_list_main_view_(app_list_main_view),
62 view_model_(new views::ViewModel), 63 view_model_(new views::ViewModel),
63 bounds_animator_(new views::BoundsAnimator(this)) { 64 bounds_animator_(new views::BoundsAnimator(this)) {
64 DCHECK(model); 65 DCHECK(model);
65 pagination_model_->SetTransitionDurations( 66 pagination_model_->SetTransitionDurations(
66 kPageTransitionDurationInMs, 67 kPageTransitionDurationInMs,
67 kOverscrollPageTransitionDurationMs); 68 kOverscrollPageTransitionDurationMs);
68 69
69 apps_container_view_ = 70 apps_container_view_ =
70 new AppsContainerView(app_list_main_view, pagination_model, model); 71 new AppsContainerView(app_list_main_view, pagination_model, model);
71 AddChildView(apps_container_view_); 72 AddChildView(apps_container_view_);
72 view_model_->Add(apps_container_view_, kIndexAppsContainer); 73 view_model_->Add(apps_container_view_, kIndexAppsContainer);
73 74
74 SearchResultListView* search_results_view = new SearchResultListView( 75 SearchResultListView* search_results_view = new SearchResultListView(
75 app_list_main_view, view_delegate); 76 app_list_main_view, view_delegate);
76 AddChildView(search_results_view); 77 AddChildView(search_results_view);
77 view_model_->Add(search_results_view, kIndexSearchResults); 78 view_model_->Add(search_results_view, kIndexSearchResults);
78 79
79 if (app_list::switches::IsExperimentalAppListEnabled()) { 80 if (app_list::switches::IsExperimentalAppListEnabled()) {
80 content::WebContents* start_page_contents = 81 content::WebContents* start_page_contents =
81 view_delegate->GetStartPageContents(); 82 view_delegate->GetStartPageContents();
82 StartPageView* start_page_view = 83 start_page_view_ =
83 new StartPageView(app_list_main_view, start_page_contents); 84 new StartPageView(app_list_main_view, start_page_contents);
84 AddChildView(start_page_view); 85 AddChildView(start_page_view_);
85 view_model_->Add(start_page_view, kIndexStartPage); 86 view_model_->Add(start_page_view_, kIndexStartPage);
86 } 87 }
87 88
88 GetSearchResultListView(view_model_.get())->SetResults(model->results()); 89 GetSearchResultListView(view_model_.get())->SetResults(model->results());
89 } 90 }
90 91
91 ContentsView::~ContentsView() { 92 ContentsView::~ContentsView() {
92 } 93 }
93 94
94 void ContentsView::CancelDrag() { 95 void ContentsView::CancelDrag() {
95 if (apps_container_view_->apps_grid_view()->has_dragged_view()) 96 if (apps_container_view_->apps_grid_view()->has_dragged_view())
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 if (!pagination_model_->has_transition()) { 313 if (!pagination_model_->has_transition()) {
313 pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1, 314 pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1,
314 true); 315 true);
315 } 316 }
316 event->SetHandled(); 317 event->SetHandled();
317 event->StopPropagation(); 318 event->StopPropagation();
318 } 319 }
319 } 320 }
320 321
321 } // namespace app_list 322 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/contents_view.h ('k') | ui/app_list/views/start_page_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698