OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list_main_view.h" | 5 #include "ui/app_list/views/app_list_main_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
| 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" |
9 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
10 #include "ui/app_list/app_list_constants.h" | 12 #include "ui/app_list/app_list_constants.h" |
11 #include "ui/app_list/app_list_item_model.h" | 13 #include "ui/app_list/app_list_item_model.h" |
12 #include "ui/app_list/app_list_model.h" | 14 #include "ui/app_list/app_list_model.h" |
13 #include "ui/app_list/app_list_view_delegate.h" | 15 #include "ui/app_list/app_list_view_delegate.h" |
14 #include "ui/app_list/pagination_model.h" | 16 #include "ui/app_list/pagination_model.h" |
15 #include "ui/app_list/search_box_model.h" | 17 #include "ui/app_list/search_box_model.h" |
16 #include "ui/app_list/views/app_list_item_view.h" | 18 #include "ui/app_list/views/app_list_item_view.h" |
17 #include "ui/app_list/views/contents_view.h" | 19 #include "ui/app_list/views/contents_view.h" |
18 #include "ui/app_list/views/search_box_view.h" | 20 #include "ui/app_list/views/search_box_view.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 icon_loading_wait_timer_.Stop(); | 183 icon_loading_wait_timer_.Stop(); |
182 GetWidget()->Show(); | 184 GetWidget()->Show(); |
183 } | 185 } |
184 } | 186 } |
185 | 187 |
186 void AppListMainView::ActivateApp(AppListItemModel* item, int event_flags) { | 188 void AppListMainView::ActivateApp(AppListItemModel* item, int event_flags) { |
187 if (delegate_) | 189 if (delegate_) |
188 delegate_->ActivateAppListItem(item, event_flags); | 190 delegate_->ActivateAppListItem(item, event_flags); |
189 } | 191 } |
190 | 192 |
| 193 void AppListMainView::GetShortcutPathForApp( |
| 194 const std::string& app_id, |
| 195 const base::Callback<void(const base::FilePath&)>& callback) { |
| 196 if (delegate_) { |
| 197 delegate_->GetShortcutPathForApp(app_id, callback); |
| 198 return; |
| 199 } |
| 200 callback.Run(base::FilePath()); |
| 201 } |
| 202 |
191 void AppListMainView::QueryChanged(SearchBoxView* sender) { | 203 void AppListMainView::QueryChanged(SearchBoxView* sender) { |
192 base::string16 query; | 204 base::string16 query; |
193 TrimWhitespace(model_->search_box()->text(), TRIM_ALL, &query); | 205 TrimWhitespace(model_->search_box()->text(), TRIM_ALL, &query); |
194 bool should_show_search = !query.empty(); | 206 bool should_show_search = !query.empty(); |
195 contents_view_->ShowSearchResults(should_show_search); | 207 contents_view_->ShowSearchResults(should_show_search); |
196 | 208 |
197 if (delegate_) { | 209 if (delegate_) { |
198 if (should_show_search) | 210 if (should_show_search) |
199 delegate_->StartSearch(); | 211 delegate_->StartSearch(); |
200 else | 212 else |
201 delegate_->StopSearch(); | 213 delegate_->StopSearch(); |
202 } | 214 } |
203 } | 215 } |
204 | 216 |
205 void AppListMainView::OpenResult(SearchResult* result, int event_flags) { | 217 void AppListMainView::OpenResult(SearchResult* result, int event_flags) { |
206 if (delegate_) | 218 if (delegate_) |
207 delegate_->OpenSearchResult(result, event_flags); | 219 delegate_->OpenSearchResult(result, event_flags); |
208 } | 220 } |
209 | 221 |
210 void AppListMainView::InvokeResultAction(SearchResult* result, | 222 void AppListMainView::InvokeResultAction(SearchResult* result, |
211 int action_index, | 223 int action_index, |
212 int event_flags) { | 224 int event_flags) { |
213 if (delegate_) | 225 if (delegate_) |
214 delegate_->InvokeSearchResultAction(result, action_index, event_flags); | 226 delegate_->InvokeSearchResultAction(result, action_index, event_flags); |
215 } | 227 } |
216 | 228 |
217 } // namespace app_list | 229 } // namespace app_list |
OLD | NEW |