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