NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / app_list / search / mixer.h
blobb195d6371a842ff4ba2d554ee6a3f19aa4713845
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_MIXER_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_MIXER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_vector.h"
10 #include "chrome/browser/ui/app_list/search/history_types.h"
11 #include "ui/app_list/app_list_model.h"
13 namespace app_list {
15 class SearchProvider;
17 // Mixer collects results from providers, sorts them and publishes them to the
18 // SearchResults UI model. The targeted results have 6 slots to hold the
19 // result. These slots could be viewed as having three groups: main group
20 // (local apps and contacts), omnibox group and web store group. The
21 // main group takes no more than 4 slots. The web store takes no more than 2
22 // slots. The omnibox group takes all the remaining slots.
23 class Mixer {
24 public:
25 // The enum represents mixer groups. Note this must matches the order
26 // of group creation in Init().
27 enum GroupId {
28 MAIN_GROUP = 0,
29 OMNIBOX_GROUP = 1,
30 WEBSTORE_GROUP = 2,
31 PEOPLE_GROUP = 3,
34 explicit Mixer(AppListModel::SearchResults* ui_results);
35 ~Mixer();
37 // Creates mixer groups.
38 void Init();
40 // Associates a provider with a mixer group.
41 void AddProviderToGroup(GroupId group, SearchProvider* provider);
43 // Collects the results, sorts and publishes them.
44 void MixAndPublish(const KnownResults& known_results);
46 private:
47 class Group;
48 typedef ScopedVector<Group> Groups;
50 void FetchResults(const KnownResults& known_results);
52 AppListModel::SearchResults* ui_results_; // Not owned.
53 Groups groups_;
55 DISALLOW_COPY_AND_ASSIGN(Mixer);
58 } // namespace app_list
60 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_MIXER_H_