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

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

Issue 14533006: Drag and drop between app list and launcher - First patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 7 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 | Annotate | Revision Log
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 "ui/app_list/app_list_constants.h" 9 #include "ui/app_list/app_list_constants.h"
10 #include "ui/app_list/pagination_model.h" 10 #include "ui/app_list/pagination_model.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ContentsView::ContentsView(AppListMainView* app_list_main_view, 47 ContentsView::ContentsView(AppListMainView* app_list_main_view,
48 PaginationModel* pagination_model) 48 PaginationModel* pagination_model)
49 : show_state_(SHOW_APPS), 49 : show_state_(SHOW_APPS),
50 pagination_model_(pagination_model), 50 pagination_model_(pagination_model),
51 view_model_(new views::ViewModel), 51 view_model_(new views::ViewModel),
52 bounds_animator_(new views::BoundsAnimator(this)) { 52 bounds_animator_(new views::BoundsAnimator(this)) {
53 pagination_model_->SetTransitionDurations( 53 pagination_model_->SetTransitionDurations(
54 kPageTransitionDurationInMs, 54 kPageTransitionDurationInMs,
55 kOverscrollPageTransitionDurationMs); 55 kOverscrollPageTransitionDurationMs);
56 56
57 AppsGridView* apps_grid_view = new AppsGridView(app_list_main_view, 57 apps_grid_view_ = new AppsGridView(app_list_main_view, pagination_model);
58 pagination_model); 58 apps_grid_view_->SetLayout(kPreferredIconDimension,
59 apps_grid_view->SetLayout(kPreferredIconDimension, 59 kPreferredCols,
60 kPreferredCols, 60 kPreferredRows);
61 kPreferredRows); 61 AddChildView(apps_grid_view_);
62 AddChildView(apps_grid_view); 62 view_model_->Add(apps_grid_view_, kIndexAppsGrid);
63 view_model_->Add(apps_grid_view, kIndexAppsGrid);
64 63
65 SearchResultListView* search_results_view = new SearchResultListView( 64 SearchResultListView* search_results_view = new SearchResultListView(
66 app_list_main_view); 65 app_list_main_view);
67 AddChildView(search_results_view); 66 AddChildView(search_results_view);
68 view_model_->Add(search_results_view, kIndexSearchResults); 67 view_model_->Add(search_results_view, kIndexSearchResults);
69 } 68 }
70 69
71 ContentsView::~ContentsView() { 70 ContentsView::~ContentsView() {
72 } 71 }
73 72
74 void ContentsView::SetModel(AppListModel* model) { 73 void ContentsView::SetModel(AppListModel* model) {
75 if (model) { 74 if (model) {
76 GetAppsGridView(view_model_.get())->SetModel(model); 75 GetAppsGridView(view_model_.get())->SetModel(model);
77 GetSearchResultListView(view_model_.get())->SetResults(model->results()); 76 GetSearchResultListView(view_model_.get())->SetResults(model->results());
78 } else { 77 } else {
79 GetAppsGridView(view_model_.get())->SetModel(NULL); 78 GetAppsGridView(view_model_.get())->SetModel(NULL);
80 GetSearchResultListView(view_model_.get())->SetResults(NULL); 79 GetSearchResultListView(view_model_.get())->SetResults(NULL);
81 } 80 }
82 } 81 }
83 82
83 void ContentsView::SetDragAndDropHostOfCurrentAppList(
84 app_list::ApplicationDragAndDropHost* drag_and_drop_host) {
85 apps_grid_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host);
86 }
87
84 void ContentsView::SetShowState(ShowState show_state) { 88 void ContentsView::SetShowState(ShowState show_state) {
85 if (show_state_ == show_state) 89 if (show_state_ == show_state)
86 return; 90 return;
87 91
88 show_state_ = show_state; 92 show_state_ = show_state;
89 ShowStateChanged(); 93 ShowStateChanged();
90 } 94 }
91 95
92 void ContentsView::ShowStateChanged() { 96 void ContentsView::ShowStateChanged() {
93 if (show_state_ == SHOW_SEARCH_RESULTS) { 97 if (show_state_ == SHOW_SEARCH_RESULTS) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 238
235 if (!pagination_model_->has_transition()) { 239 if (!pagination_model_->has_transition()) {
236 pagination_model_->SelectPageRelative(event->x_offset() > 0 ? -1 : 1, 240 pagination_model_->SelectPageRelative(event->x_offset() > 0 ? -1 : 1,
237 true); 241 true);
238 } 242 }
239 event->SetHandled(); 243 event->SetHandled();
240 event->StopPropagation(); 244 event->StopPropagation();
241 } 245 }
242 246
243 } // namespace app_list 247 } // namespace app_list
OLDNEW
« ash/launcher/launcher_view.cc ('K') | « ui/app_list/views/contents_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698