Fix some clang warnings with -Wmissing-braces in rlz.
[chromium-blink-merge.git] / ui / app_list / search_controller.h
blobf1e45d5fe1f2b135c6f80ebc6c049eb7f9485892
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
3 // found in the LICENSE file.
5 #ifndef UI_APP_LIST_SEARCH_CONTROLLER_H_
6 #define UI_APP_LIST_SEARCH_CONTROLLER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h"
11 #include "base/timer/timer.h"
12 #include "ui/app_list/app_list_export.h"
13 #include "ui/app_list/app_list_model.h"
14 #include "ui/app_list/search/mixer.h"
15 #include "ui/app_list/speech_ui_model_observer.h"
17 namespace app_list {
19 class History;
20 class SearchBoxModel;
21 class SearchProvider;
22 class SearchResult;
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
26 // results to the given SearchResults UI model.
27 class APP_LIST_EXPORT SearchController {
28 public:
29 SearchController(SearchBoxModel* search_box,
30 AppListModel::SearchResults* results,
31 History* history);
32 virtual ~SearchController();
34 void Start(bool is_voice_query);
35 void Stop();
37 void OpenResult(SearchResult* result, int event_flags);
38 void InvokeResultAction(SearchResult* result,
39 int action_index,
40 int event_flags);
42 // Adds a new mixer group. See Mixer::AddGroup.
43 size_t AddGroup(size_t max_results, double boost, double multiplier);
45 // Adds a new mixer group. See Mixer::AddOmniboxGroup.
46 size_t AddOmniboxGroup(size_t max_results, double boost, double multiplier);
48 // Takes ownership of |provider| and associates it with given mixer group.
49 void AddProvider(size_t group_id, scoped_ptr<SearchProvider> provider);
51 private:
52 typedef ScopedVector<SearchProvider> Providers;
54 // Invoked when the search results are changed.
55 void OnResultsChanged();
57 SearchBoxModel* search_box_;
59 bool dispatching_query_;
60 Providers providers_;
61 scoped_ptr<Mixer> mixer_;
62 History* history_; // KeyedService, not owned.
64 bool is_voice_query_;
66 base::OneShotTimer<SearchController> stop_timer_;
68 DISALLOW_COPY_AND_ASSIGN(SearchController);
71 } // namespace app_list
73 #endif // UI_APP_LIST_SEARCH_CONTROLLER_H_