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

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

Issue 720663002: Move app list search tiles into SearchResultTileItemListView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 6 years, 1 month 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/app_list.gyp ('k') | ui/app_list/views/search_result_list_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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/search_result_container_view.h" 5 #include "ui/app_list/views/search_result_container_view.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 9
10 namespace app_list { 10 namespace app_list {
11 11
12 SearchResultContainerView::SearchResultContainerView() 12 SearchResultContainerView::SearchResultContainerView()
13 : results_(NULL), update_factory_(this) { 13 : results_(NULL), update_factory_(this) {
14 } 14 }
15 15
16 SearchResultContainerView::~SearchResultContainerView() { 16 SearchResultContainerView::~SearchResultContainerView() {
17 if (results_) 17 if (results_)
18 results_->RemoveObserver(this); 18 results_->RemoveObserver(this);
19 } 19 }
20 20
21 void SearchResultContainerView::SetResults( 21 void SearchResultContainerView::SetResults(
22 AppListModel::SearchResults* results) { 22 AppListModel::SearchResults* results) {
23 if (results_) 23 if (results_)
24 results_->RemoveObserver(this); 24 results_->RemoveObserver(this);
25 25
26 results_ = results; 26 results_ = results;
27 if (results_) 27 if (results_)
28 results_->AddObserver(this); 28 results_->AddObserver(this);
29 29
30 Update(); 30 DoUpdate();
31 } 31 }
32 32
33 void SearchResultContainerView::ScheduleUpdate() { 33 void SearchResultContainerView::ScheduleUpdate() {
34 // When search results are added one by one, each addition generates an update 34 // When search results are added one by one, each addition generates an update
35 // request. Consolidates those update requests into one Update call. 35 // request. Consolidates those update requests into one Update call.
36 if (!update_factory_.HasWeakPtrs()) { 36 if (!update_factory_.HasWeakPtrs()) {
37 base::MessageLoop::current()->PostTask( 37 base::MessageLoop::current()->PostTask(
38 FROM_HERE, 38 FROM_HERE,
39 base::Bind(&SearchResultContainerView::DoUpdate, 39 base::Bind(&SearchResultContainerView::DoUpdate,
40 update_factory_.GetWeakPtr())); 40 update_factory_.GetWeakPtr()));
(...skipping 12 matching lines...) Expand all
53 size_t target_index) { 53 size_t target_index) {
54 ScheduleUpdate(); 54 ScheduleUpdate();
55 } 55 }
56 56
57 void SearchResultContainerView::ListItemsChanged(size_t start, size_t count) { 57 void SearchResultContainerView::ListItemsChanged(size_t start, size_t count) {
58 ScheduleUpdate(); 58 ScheduleUpdate();
59 } 59 }
60 60
61 void SearchResultContainerView::DoUpdate() { 61 void SearchResultContainerView::DoUpdate() {
62 Update(); 62 Update();
63 Layout();
64 PreferredSizeChanged();
63 update_factory_.InvalidateWeakPtrs(); 65 update_factory_.InvalidateWeakPtrs();
64 } 66 }
65 67
66 } // namespace app_list 68 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list.gyp ('k') | ui/app_list/views/search_result_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698