| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_ASH_APP_LIST_SEARCH_BUILDER_H_ | |
| 6 #define CHROME_BROWSER_UI_ASH_APP_LIST_SEARCH_BUILDER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | |
| 12 #include "ui/app_list/app_list_model.h" | |
| 13 | |
| 14 namespace app_list { | |
| 15 class SearchBoxModel; | |
| 16 class SearchResult; | |
| 17 } | |
| 18 | |
| 19 class AppListController; | |
| 20 class AutocompleteController; | |
| 21 class AutocompleteResult; | |
| 22 class ExtensionAppProvider; | |
| 23 class Profile; | |
| 24 | |
| 25 // SearchBuilder creates app list search results via AutoCompleteController. | |
| 26 class SearchBuilder : public AutocompleteControllerDelegate { | |
| 27 public: | |
| 28 SearchBuilder(Profile* profile, | |
| 29 app_list::SearchBoxModel* search_box, | |
| 30 app_list::AppListModel::SearchResults* results, | |
| 31 AppListController* list_controller); | |
| 32 virtual ~SearchBuilder(); | |
| 33 | |
| 34 void StartSearch(); | |
| 35 void StopSearch(); | |
| 36 | |
| 37 void OpenResult(const app_list::SearchResult& result, int event_flags); | |
| 38 | |
| 39 private: | |
| 40 // Populates result list from AutocompleteResult. | |
| 41 void PopulateFromACResult(const AutocompleteResult& result); | |
| 42 | |
| 43 // AutocompleteControllerDelegate overrides: | |
| 44 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; | |
| 45 | |
| 46 Profile* profile_; | |
| 47 | |
| 48 // Sub models of AppListModel that represent search box and result list. | |
| 49 app_list::SearchBoxModel* search_box_; | |
| 50 app_list::AppListModel::SearchResults* results_; | |
| 51 | |
| 52 // The omnibox AutocompleteController that collects/sorts/dup- | |
| 53 // eliminates the results as they come in. | |
| 54 scoped_ptr<AutocompleteController> controller_; | |
| 55 | |
| 56 // The controller of the app list. Owned by the app list delegate. | |
| 57 AppListController* list_controller_; | |
| 58 | |
| 59 // ExtensionAppProvider used for apps only mode. If apps only mode becomes the | |
| 60 // only mode, remove the AutocompleteController above. Otherwise, remove this. | |
| 61 scoped_refptr<ExtensionAppProvider> apps_provider_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(SearchBuilder); | |
| 64 }; | |
| 65 | |
| 66 #endif // CHROME_BROWSER_UI_ASH_APP_LIST_SEARCH_BUILDER_H_ | |
| OLD | NEW |