Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / app_list / search / search_controller.h
blobcb4b922173330596db945e1deb1420026b469f38
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 CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_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 "chrome/browser/ui/app_list/search/mixer.h"
13 #include "ui/app_list/app_list_model.h"
15 class AppListControllerDelegate;
16 class Profile;
18 namespace app_list {
20 class History;
21 class SearchBoxModel;
22 class SearchProvider;
23 class SearchResult;
25 // Controller that collects query from given SearchBoxModel, dispatches it
26 // to all search providers, then invokes the mixer to mix and to publish the
27 // results to the given SearchResults UI model.
28 class SearchController {
29 public:
30 SearchController(Profile* profile,
31 SearchBoxModel* search_box,
32 AppListModel::SearchResults* results,
33 AppListControllerDelegate* list_controller);
34 ~SearchController();
36 void Init();
38 void Start();
39 void Stop();
41 void OpenResult(SearchResult* result, int event_flags);
42 void InvokeResultAction(SearchResult* result,
43 int action_index,
44 int event_flags);
46 private:
47 typedef ScopedVector<SearchProvider> Providers;
49 // Takes ownership of |provider| and associates it with given mixer group.
50 void AddProvider(Mixer::GroupId group,
51 scoped_ptr<SearchProvider> provider);
53 // Invoked when the search results are changed.
54 void OnResultsChanged();
56 Profile* profile_;
57 SearchBoxModel* search_box_;
58 AppListControllerDelegate* list_controller_;
60 bool dispatching_query_;
61 Providers providers_;
62 scoped_ptr<Mixer> mixer_;
63 History* history_; // BrowserContextKeyedService, not owned.
65 base::OneShotTimer<SearchController> stop_timer_;
67 DISALLOW_COPY_AND_ASSIGN(SearchController);
70 } // namespace app_list
72 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_