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

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: 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
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();
Matt Giuca 2014/11/13 00:08:51 I don't see the relevance of this change. Was this
calamity 2014/11/13 03:44:50 Oops. This was a relic of when I was had a Preferr
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 16 matching lines...) Expand all
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 update_factory_.InvalidateWeakPtrs(); 63 update_factory_.InvalidateWeakPtrs();
64 } 64 }
65 65
66 } // namespace app_list 66 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698