Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1747)

Side by Side Diff: ui/app_list/search/mixer.h

Issue 796293002: App list voice searches now prioritize exact-match web results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/app_list/search/omnibox_provider.cc ('k') | ui/app_list/search/mixer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MIXER_H_ 5 #ifndef UI_APP_LIST_SEARCH_MIXER_H_
6 #define UI_APP_LIST_SEARCH_MIXER_H_ 6 #define UI_APP_LIST_SEARCH_MIXER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 explicit Mixer(AppListModel::SearchResults* ui_results); 44 explicit Mixer(AppListModel::SearchResults* ui_results);
45 ~Mixer(); 45 ~Mixer();
46 46
47 // Creates mixer groups. 47 // Creates mixer groups.
48 void Init(); 48 void Init();
49 49
50 // Associates a provider with a mixer group. 50 // Associates a provider with a mixer group.
51 void AddProviderToGroup(GroupId group, SearchProvider* provider); 51 void AddProviderToGroup(GroupId group, SearchProvider* provider);
52 52
53 // Collects the results, sorts and publishes them. 53 // Collects the results, sorts and publishes them.
54 void MixAndPublish(const KnownResults& known_results); 54 void MixAndPublish(bool is_voice_query, const KnownResults& known_results);
55 55
56 private: 56 private:
57 FRIEND_TEST_ALL_PREFIXES(test::MixerTest, Publish); 57 FRIEND_TEST_ALL_PREFIXES(test::MixerTest, Publish);
58 58
59 // Used for sorting and mixing results. 59 // Used for sorting and mixing results.
60 struct APP_LIST_EXPORT SortData { 60 struct APP_LIST_EXPORT SortData {
61 SortData(); 61 SortData();
62 SortData(SearchResult* result, double score); 62 SortData(SearchResult* result, double score);
63 63
64 bool operator<(const SortData& other) const; 64 bool operator<(const SortData& other) const;
65 65
66 SearchResult* result; // Not owned. 66 SearchResult* result; // Not owned.
67 double score; 67 double score;
68 }; 68 };
69 typedef std::vector<Mixer::SortData> SortedResults; 69 typedef std::vector<Mixer::SortData> SortedResults;
70 70
71 class Group; 71 class Group;
72 typedef std::map<GroupId, linked_ptr<Group>> Groups; 72 typedef std::map<GroupId, linked_ptr<Group>> Groups;
73 73
74 // Publishes the given |new_results| to |ui_results|, deleting any existing 74 // Publishes the given |new_results| to |ui_results|, deleting any existing
75 // results that are not in |new_results|. Results that already exist in 75 // results that are not in |new_results|. Results that already exist in
76 // |ui_results| are reused to avoid flickering caused by icon reload. 76 // |ui_results| are reused to avoid flickering caused by icon reload.
77 static void Publish(const SortedResults& results, 77 static void Publish(const SortedResults& results,
78 AppListModel::SearchResults* ui_results); 78 AppListModel::SearchResults* ui_results);
79 79
80 // Removes duplicates from |results|. 80 // Removes duplicates from |results|.
81 static void RemoveDuplicates(SortedResults* results); 81 static void RemoveDuplicates(SortedResults* results);
82 82
83 void FetchResults(const KnownResults& known_results); 83 void FetchResults(bool is_voice_query, const KnownResults& known_results);
84 84
85 AppListModel::SearchResults* ui_results_; // Not owned. 85 AppListModel::SearchResults* ui_results_; // Not owned.
86 Groups groups_; 86 Groups groups_;
87 87
88 DISALLOW_COPY_AND_ASSIGN(Mixer); 88 DISALLOW_COPY_AND_ASSIGN(Mixer);
89 }; 89 };
90 90
91 } // namespace app_list 91 } // namespace app_list
92 92
93 #endif // UI_APP_LIST_SEARCH_MIXER_H_ 93 #endif // UI_APP_LIST_SEARCH_MIXER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/search/omnibox_provider.cc ('k') | ui/app_list/search/mixer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698