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

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

Issue 187083004: Change content view switching animation for experimental app launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ares_hide_search_box
Patch Set: Created 6 years, 9 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/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"
11 #include "ui/app_list/app_list_switches.h"
11 #include "ui/app_list/app_list_view_delegate.h" 12 #include "ui/app_list/app_list_view_delegate.h"
12 #include "ui/app_list/pagination_model.h" 13 #include "ui/app_list/pagination_model.h"
13 #include "ui/app_list/views/app_list_main_view.h" 14 #include "ui/app_list/views/app_list_main_view.h"
14 #include "ui/app_list/views/apps_container_view.h" 15 #include "ui/app_list/views/apps_container_view.h"
15 #include "ui/app_list/views/apps_grid_view.h" 16 #include "ui/app_list/views/apps_grid_view.h"
16 #include "ui/app_list/views/search_result_list_view.h" 17 #include "ui/app_list/views/search_result_list_view.h"
17 #include "ui/events/event.h" 18 #include "ui/events/event.h"
18 #include "ui/views/animation/bounds_animator.h" 19 #include "ui/views/animation/bounds_animator.h"
19 #include "ui/views/view_model.h" 20 #include "ui/views/view_model.h"
20 #include "ui/views/view_model_utils.h" 21 #include "ui/views/view_model_utils.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 results_view->UpdateAutoLaunchState(); 103 results_view->UpdateAutoLaunchState();
103 104
104 AnimateToIdealBounds(); 105 AnimateToIdealBounds();
105 } 106 }
106 107
107 void ContentsView::CalculateIdealBounds() { 108 void ContentsView::CalculateIdealBounds() {
108 gfx::Rect rect(GetContentsBounds()); 109 gfx::Rect rect(GetContentsBounds());
109 if (rect.IsEmpty()) 110 if (rect.IsEmpty())
110 return; 111 return;
111 112
113 if (app_list::switches::IsExperimentalAppListEnabled()) {
114 int incoming_view = 0;
tapted 2014/03/05 07:37:17 nit: incoming_view_index or incoming_index
calamity 2014/03/07 00:30:51 Done.
115 switch (show_state_) {
116 case SHOW_APPS:
117 incoming_view = kIndexAppsContainer;
118 break;
119 case SHOW_SEARCH_RESULTS:
120 incoming_view = kIndexSearchResults;
121 break;
122 default:
123 NOTREACHED();
124 }
125
126 gfx::Rect incoming_target(GetContentsBounds());
tapted 2014/03/05 07:37:17 nit: initialise these both with |rect|?
calamity 2014/03/07 00:30:51 Done.
127 gfx::Rect outgoing_target(GetContentsBounds());
128 outgoing_target.set_y(-outgoing_target.height());
129
130 for (int i = 0; i < view_model_->view_size(); ++i) {
131 views::View* view = view_model_->view_at(i);
tapted 2014/03/05 07:37:17 |view| unused?
calamity 2014/03/07 00:30:51 Done.
132 view_model_->set_ideal_bounds(i, i == incoming_view ? incoming_target
133 : outgoing_target);
134 }
135 return;
136 }
137
112 gfx::Rect container_frame(rect); 138 gfx::Rect container_frame(rect);
113 gfx::Rect results_frame(rect); 139 gfx::Rect results_frame(rect);
114 140
115 // Offsets apps grid and result list based on |show_state_|. 141 // Offsets apps grid and result list based on |show_state_|.
116 // SearchResultListView is on top of apps grid. Visible view is left in 142 // SearchResultListView is on top of apps grid. Visible view is left in
117 // visible area and invisible ones is put out of the visible area. 143 // visible area and invisible ones is put out of the visible area.
118 int contents_area_height = rect.height(); 144 int contents_area_height = rect.height();
119 switch (show_state_) { 145 switch (show_state_) {
120 case SHOW_APPS: 146 case SHOW_APPS:
121 results_frame.Offset(0, -contents_area_height); 147 results_frame.Offset(0, -contents_area_height);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 if (!pagination_model_->has_transition()) { 280 if (!pagination_model_->has_transition()) {
255 pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1, 281 pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1,
256 true); 282 true);
257 } 283 }
258 event->SetHandled(); 284 event->SetHandled();
259 event->StopPropagation(); 285 event->StopPropagation();
260 } 286 }
261 } 287 }
262 288
263 } // namespace app_list 289 } // 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