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 #ifndef UI_APP_LIST_SEARCH_CONTROLLER_H_ | 5 #ifndef UI_APP_LIST_SEARCH_CONTROLLER_H_ |
6 #define UI_APP_LIST_SEARCH_CONTROLLER_H_ | 6 #define UI_APP_LIST_SEARCH_CONTROLLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Controller that collects query from given SearchBoxModel, dispatches it | 24 // Controller that collects query from given SearchBoxModel, dispatches it |
25 // to all search providers, then invokes the mixer to mix and to publish the | 25 // to all search providers, then invokes the mixer to mix and to publish the |
26 // results to the given SearchResults UI model. | 26 // results to the given SearchResults UI model. |
27 class APP_LIST_EXPORT SearchController { | 27 class APP_LIST_EXPORT SearchController { |
28 public: | 28 public: |
29 SearchController(SearchBoxModel* search_box, | 29 SearchController(SearchBoxModel* search_box, |
30 AppListModel::SearchResults* results, | 30 AppListModel::SearchResults* results, |
31 History* history); | 31 History* history); |
32 virtual ~SearchController(); | 32 virtual ~SearchController(); |
33 | 33 |
34 void Start(); | 34 void Start(bool is_voice_query); |
35 void Stop(); | 35 void Stop(); |
36 | 36 |
37 void OpenResult(SearchResult* result, int event_flags); | 37 void OpenResult(SearchResult* result, int event_flags); |
38 void InvokeResultAction(SearchResult* result, | 38 void InvokeResultAction(SearchResult* result, |
39 int action_index, | 39 int action_index, |
40 int event_flags); | 40 int event_flags); |
41 | 41 |
42 // Takes ownership of |provider| and associates it with given mixer group. | 42 // Takes ownership of |provider| and associates it with given mixer group. |
43 void AddProvider(Mixer::GroupId group, | 43 void AddProvider(Mixer::GroupId group, |
44 scoped_ptr<SearchProvider> provider); | 44 scoped_ptr<SearchProvider> provider); |
45 | 45 |
46 private: | 46 private: |
47 typedef ScopedVector<SearchProvider> Providers; | 47 typedef ScopedVector<SearchProvider> Providers; |
48 | 48 |
49 // Invoked when the search results are changed. | 49 // Invoked when the search results are changed. |
50 void OnResultsChanged(); | 50 void OnResultsChanged(); |
51 | 51 |
52 SearchBoxModel* search_box_; | 52 SearchBoxModel* search_box_; |
53 | 53 |
54 bool dispatching_query_; | 54 bool dispatching_query_; |
55 Providers providers_; | 55 Providers providers_; |
56 scoped_ptr<Mixer> mixer_; | 56 scoped_ptr<Mixer> mixer_; |
57 History* history_; // KeyedService, not owned. | 57 History* history_; // KeyedService, not owned. |
58 | 58 |
| 59 bool is_voice_query_; |
| 60 |
59 base::OneShotTimer<SearchController> stop_timer_; | 61 base::OneShotTimer<SearchController> stop_timer_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(SearchController); | 63 DISALLOW_COPY_AND_ASSIGN(SearchController); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace app_list | 66 } // namespace app_list |
65 | 67 |
66 #endif // UI_APP_LIST_SEARCH_CONTROLLER_H_ | 68 #endif // UI_APP_LIST_SEARCH_CONTROLLER_H_ |
OLD | NEW |