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

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

Issue 897583002: Ignore updates to app list Most Likely apps when animating off the start page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@doodle_static
Patch Set: fix_test Created 5 years, 10 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 | « ui/app_list/views/app_list_view_unittest.cc ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/start_page_view.h" 5 #include "ui/app_list/views/start_page_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/app_list/app_list_constants.h" 8 #include "ui/app_list/app_list_constants.h"
9 #include "ui/app_list/app_list_item.h" 9 #include "ui/app_list/app_list_item.h"
10 #include "ui/app_list/app_list_model.h" 10 #include "ui/app_list/app_list_model.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 if (app_list_main_view_->contents_view()->ShouldShowCustomPageClickzone()) { 228 if (app_list_main_view_->contents_view()->ShouldShowCustomPageClickzone()) {
229 custom_page_clickzone->ShowInactive(); 229 custom_page_clickzone->ShowInactive();
230 return; 230 return;
231 } 231 }
232 232
233 custom_page_clickzone->Hide(); 233 custom_page_clickzone->Hide();
234 } 234 }
235 235
236 int StartPageView::Update() { 236 int StartPageView::Update() {
237 // Ignore updates and disable buttons when transitioning to a different state.
238 if (app_list_main_view_->contents_view()->GetActiveState() !=
239 AppListModel::STATE_START) {
240 for (size_t i = 0; i < search_result_tile_views_.size(); ++i)
Matt Giuca 2015/02/04 05:55:24 for (auto& view : search_result_tile_views_) ...
241 search_result_tile_views_[i]->SetEnabled(false);
242
243 return num_results();
244 }
245
237 std::vector<SearchResult*> display_results = 246 std::vector<SearchResult*> display_results =
238 AppListModel::FilterSearchResultsByDisplayType( 247 AppListModel::FilterSearchResultsByDisplayType(
239 results(), SearchResult::DISPLAY_RECOMMENDATION, kNumStartPageTiles); 248 results(), SearchResult::DISPLAY_RECOMMENDATION, kNumStartPageTiles);
240 249
241 // Update the tile item results. 250 // Update the tile item results.
242 for (size_t i = 0; i < search_result_tile_views_.size(); ++i) { 251 for (size_t i = 0; i < search_result_tile_views_.size(); ++i) {
243 SearchResult* item = NULL; 252 SearchResult* item = NULL;
244 if (i < display_results.size()) 253 if (i < display_results.size())
245 item = display_results[i]; 254 item = display_results[i];
246 search_result_tile_views_[i]->SetSearchResult(item); 255 search_result_tile_views_[i]->SetSearchResult(item);
256 search_result_tile_views_[i]->SetEnabled(true);
247 } 257 }
248 258
249 tiles_container_->Layout(); 259 tiles_container_->Layout();
250 Layout(); 260 Layout();
251 // Add 1 to the results size to account for the all apps button. 261 // Add 1 to the results size to account for the all apps button.
252 return display_results.size() + 1; 262 return display_results.size() + 1;
253 } 263 }
254 264
255 void StartPageView::UpdateSelectedIndex(int old_selected, int new_selected) { 265 void StartPageView::UpdateSelectedIndex(int old_selected, int new_selected) {
256 if (old_selected >= 0) 266 if (old_selected >= 0)
257 GetTileItemView(old_selected)->SetSelected(false); 267 GetTileItemView(old_selected)->SetSelected(false);
258 268
259 if (new_selected >= 0) 269 if (new_selected >= 0)
260 GetTileItemView(new_selected)->SetSelected(true); 270 GetTileItemView(new_selected)->SetSelected(true);
261 } 271 }
262 272
263 TileItemView* StartPageView::GetTileItemView(size_t index) { 273 TileItemView* StartPageView::GetTileItemView(size_t index) {
264 DCHECK_GT(kNumStartPageTiles + 1, index); 274 DCHECK_GT(kNumStartPageTiles + 1, index);
265 if (index == kNumStartPageTiles) 275 if (index == kNumStartPageTiles)
266 return all_apps_button_; 276 return all_apps_button_;
267 277
268 return search_result_tile_views_[index]; 278 return search_result_tile_views_[index];
269 } 279 }
270 280
271 } // namespace app_list 281 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698