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 CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_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 20 matching lines...) Expand all Loading... |
31 public: | 31 public: |
32 SearchController(Profile* profile, | 32 SearchController(Profile* profile, |
33 SearchBoxModel* search_box, | 33 SearchBoxModel* search_box, |
34 AppListModel::SearchResults* results, | 34 AppListModel::SearchResults* results, |
35 SpeechUIModel* speech_ui, | 35 SpeechUIModel* speech_ui, |
36 AppListControllerDelegate* list_controller); | 36 AppListControllerDelegate* list_controller); |
37 virtual ~SearchController(); | 37 virtual ~SearchController(); |
38 | 38 |
39 void Init(); | 39 void Init(); |
40 | 40 |
| 41 void FetchRecommendations(); |
41 void Start(); | 42 void Start(); |
42 void Stop(); | 43 void Stop(); |
43 | 44 |
44 void OpenResult(SearchResult* result, int event_flags); | 45 void OpenResult(SearchResult* result, int event_flags); |
45 void InvokeResultAction(SearchResult* result, | 46 void InvokeResultAction(SearchResult* result, |
46 int action_index, | 47 int action_index, |
47 int event_flags); | 48 int event_flags); |
48 | 49 |
49 private: | 50 private: |
50 typedef ScopedVector<SearchProvider> Providers; | 51 typedef ScopedVector<SearchProvider> Providers; |
51 | 52 |
| 53 // Starts the timer which will stop all providers if they time out. |
| 54 void InitiateStopTimer(); |
| 55 |
52 // Takes ownership of |provider| and associates it with given mixer group. | 56 // Takes ownership of |provider| and associates it with given mixer group. |
53 void AddProvider(Mixer::GroupId group, | 57 void AddProvider(Mixer::GroupId group, |
54 scoped_ptr<SearchProvider> provider); | 58 scoped_ptr<SearchProvider> provider); |
55 | 59 |
56 // Invoked when the search results are changed. | 60 // Invoked when the search results are changed. |
57 void OnResultsChanged(); | 61 void OnResultsChanged(); |
58 | 62 |
59 // SpeechUIModelObserver overrides: | 63 // SpeechUIModelObserver overrides: |
60 virtual void OnSpeechRecognitionStateChanged( | 64 virtual void OnSpeechRecognitionStateChanged( |
61 SpeechRecognitionState new_state) OVERRIDE; | 65 SpeechRecognitionState new_state) OVERRIDE; |
62 | 66 |
63 Profile* profile_; | 67 Profile* profile_; |
64 SearchBoxModel* search_box_; | 68 SearchBoxModel* search_box_; |
65 SpeechUIModel* speech_ui_; | 69 SpeechUIModel* speech_ui_; |
66 AppListControllerDelegate* list_controller_; | 70 AppListControllerDelegate* list_controller_; |
67 | 71 |
68 bool dispatching_query_; | 72 bool dispatching_query_; |
69 Providers providers_; | 73 Providers providers_; |
70 scoped_ptr<Mixer> mixer_; | 74 scoped_ptr<Mixer> mixer_; |
71 History* history_; // KeyedService, not owned. | 75 History* history_; // KeyedService, not owned. |
72 | 76 |
73 base::OneShotTimer<SearchController> stop_timer_; | 77 base::OneShotTimer<SearchController> stop_timer_; |
74 | 78 |
75 DISALLOW_COPY_AND_ASSIGN(SearchController); | 79 DISALLOW_COPY_AND_ASSIGN(SearchController); |
76 }; | 80 }; |
77 | 81 |
78 } // namespace app_list | 82 } // namespace app_list |
79 | 83 |
80 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_ | 84 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_ |
OLD | NEW |