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_VIEWS_ASH_APP_LIST_SEARCH_BUILDER_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_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 AutocompleteController; | |
20 class AutocompleteResult; | |
21 class ExtensionAppProvider; | |
22 class Profile; | |
23 | |
24 // SearchBuilder creates app list search results via AutoCompleteController. | |
25 class SearchBuilder : public AutocompleteControllerDelegate { | |
26 public: | |
27 SearchBuilder(Profile* profile, | |
28 app_list::SearchBoxModel* search_box, | |
29 app_list::AppListModel::SearchResults* results); | |
30 virtual ~SearchBuilder(); | |
31 | |
32 void StartSearch(); | |
33 void StopSearch(); | |
34 | |
35 void OpenResult(const app_list::SearchResult& result, int event_flags); | |
36 | |
37 private: | |
38 // Populates result list from AutocompleteResult. | |
39 void PopulateFromACResult(const AutocompleteResult& result); | |
40 | |
41 // AutocompleteControllerDelegate overrides: | |
42 virtual void OnResultChanged(bool default_match_changed) OVERRIDE; | |
43 | |
44 Profile* profile_; | |
45 | |
46 // Sub models of AppListModel that represent search box and result list. | |
47 app_list::SearchBoxModel* search_box_; | |
48 app_list::AppListModel::SearchResults* results_; | |
49 | |
50 // The omnibox AutocompleteController that collects/sorts/dup- | |
51 // eliminates the results as they come in. | |
52 scoped_ptr<AutocompleteController> controller_; | |
53 | |
54 // ExtensionAppProvider used for apps only mode. If apps only mode becomes the | |
55 // only mode, remove the AutocompleteController above. Otherwise, remove this. | |
56 scoped_refptr<ExtensionAppProvider> apps_provider_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(SearchBuilder); | |
59 }; | |
60 | |
61 #endif // CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_SEARCH_BUILDER_H_ | |
OLD | NEW |