OLD | NEW |
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/search_result_list_view.h" | 5 #include "ui/app_list/search_result_list_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // request. Consolidates those update requests into one Update call. | 126 // request. Consolidates those update requests into one Update call. |
127 if (!update_factory_.HasWeakPtrs()) { | 127 if (!update_factory_.HasWeakPtrs()) { |
128 MessageLoop::current()->PostTask( | 128 MessageLoop::current()->PostTask( |
129 FROM_HERE, | 129 FROM_HERE, |
130 base::Bind(&SearchResultListView::Update, | 130 base::Bind(&SearchResultListView::Update, |
131 update_factory_.GetWeakPtr())); | 131 update_factory_.GetWeakPtr())); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 void SearchResultListView::ButtonPressed(views::Button* sender, | 135 void SearchResultListView::ButtonPressed(views::Button* sender, |
136 const views::Event& event) { | 136 const ui::Event& event) { |
137 if (sender->GetClassName() != SearchResultView::kViewClassName) | 137 if (sender->GetClassName() != SearchResultView::kViewClassName) |
138 return; | 138 return; |
139 | 139 |
140 if (delegate_) { | 140 if (delegate_) { |
141 const SearchResult* result = | 141 const SearchResult* result = |
142 static_cast<SearchResultView*>(sender)->result(); | 142 static_cast<SearchResultView*>(sender)->result(); |
143 | 143 |
144 if (result) | 144 if (result) |
145 delegate_->OpenResult(*result, event.flags()); | 145 delegate_->OpenResult(*result, event.flags()); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 void SearchResultListView::ListItemsAdded(size_t start, size_t count) { | 149 void SearchResultListView::ListItemsAdded(size_t start, size_t count) { |
150 ScheduleUpdate(); | 150 ScheduleUpdate(); |
151 } | 151 } |
152 | 152 |
153 void SearchResultListView::ListItemsRemoved(size_t start, size_t count) { | 153 void SearchResultListView::ListItemsRemoved(size_t start, size_t count) { |
154 size_t last = std::min(start + count, static_cast<size_t>(child_count())); | 154 size_t last = std::min(start + count, static_cast<size_t>(child_count())); |
155 for (size_t i = start; i < last; ++i) | 155 for (size_t i = start; i < last; ++i) |
156 GetResultViewAt(i)->ClearResultNoRepaint(); | 156 GetResultViewAt(i)->ClearResultNoRepaint(); |
157 | 157 |
158 ScheduleUpdate(); | 158 ScheduleUpdate(); |
159 } | 159 } |
160 | 160 |
161 void SearchResultListView::ListItemsChanged(size_t start, size_t count) { | 161 void SearchResultListView::ListItemsChanged(size_t start, size_t count) { |
162 ScheduleUpdate(); | 162 ScheduleUpdate(); |
163 } | 163 } |
164 | 164 |
165 } // namespace app_list | 165 } // namespace app_list |
OLD | NEW |