| 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 #ifndef UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
| 6 #define UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 6 #define UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | |
| 10 | |
| 11 #include "ui/app_list/app_list_export.h" | 9 #include "ui/app_list/app_list_export.h" |
| 12 | 10 |
| 13 namespace app_list { | 11 namespace app_list { |
| 14 | 12 |
| 15 class AppListItemModel; | 13 class AppListItemModel; |
| 16 class AppListModel; | 14 class AppListModel; |
| 15 class SearchResult; |
| 17 | 16 |
| 18 class APP_LIST_EXPORT AppListViewDelegate { | 17 class APP_LIST_EXPORT AppListViewDelegate { |
| 19 public: | 18 public: |
| 20 // AppListView owns the delegate. | 19 // AppListView owns the delegate. |
| 21 virtual ~AppListViewDelegate() {} | 20 virtual ~AppListViewDelegate() {} |
| 22 | 21 |
| 23 // Invoked to set the model that AppListView uses. | 22 // Invoked to set the model that AppListView uses. |
| 24 // Note that AppListView owns the model. | 23 // Note that AppListView owns the model. |
| 25 virtual void SetModel(AppListModel* model) = 0; | 24 virtual void SetModel(AppListModel* model) = 0; |
| 26 | 25 |
| 27 // Invoked to ask the delegate to populate the model for given |query|. | 26 // Invoked when an AppListeItemModelView is activated by click or enter key. |
| 28 virtual void UpdateModel(const std::string& query) = 0; | 27 virtual void ActivateAppListItem(AppListItemModel* item, |
| 28 int event_flags) = 0; |
| 29 | 29 |
| 30 // Invoked an AppListeItemModelView is activated by click or enter key. | 30 // Invoked to start a new search. Delegate collects query input from |
| 31 virtual void OnAppListItemActivated(AppListItemModel* item, | 31 // SearchBoxModel and populates SearchResults. Both models are sub models |
| 32 int event_flags) = 0; | 32 // of AppListModel. |
| 33 virtual void StartSearch() = 0; |
| 34 |
| 35 // Invoked to stop the current search. |
| 36 virtual void StopSearch() = 0; |
| 37 |
| 38 // Invoked to open the search result. |
| 39 virtual void OpenSearchResult(const SearchResult& result, |
| 40 int event_flags) = 0; |
| 33 | 41 |
| 34 // Invoked to close app list. | 42 // Invoked to close app list. |
| 35 virtual void Close() = 0; | 43 virtual void Close() = 0; |
| 36 }; | 44 }; |
| 37 | 45 |
| 38 } // namespace app_list | 46 } // namespace app_list |
| 39 | 47 |
| 40 #endif // UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 48 #endif // UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
| OLD | NEW |