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

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: Fixed MixerTest and add MixerTest.VoiceQuery. 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
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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 explicit Mixer(AppListModel::SearchResults* ui_results); 42 explicit Mixer(AppListModel::SearchResults* ui_results);
43 ~Mixer(); 43 ~Mixer();
44 44
45 // Creates mixer groups. 45 // Creates mixer groups.
46 void Init(); 46 void Init();
47 47
48 // Associates a provider with a mixer group. 48 // Associates a provider with a mixer group.
49 void AddProviderToGroup(GroupId group, SearchProvider* provider); 49 void AddProviderToGroup(GroupId group, SearchProvider* provider);
50 50
51 // Collects the results, sorts and publishes them. 51 // Collects the results, sorts and publishes them.
52 void MixAndPublish(const KnownResults& known_results); 52 void MixAndPublish(bool is_voice_query, const KnownResults& known_results);
53 53
54 private: 54 private:
55 FRIEND_TEST_ALL_PREFIXES(test::MixerTest, Publish); 55 FRIEND_TEST_ALL_PREFIXES(test::MixerTest, Publish);
56 56
57 // Used for sorting and mixing results. 57 // Used for sorting and mixing results.
58 struct APP_LIST_EXPORT SortData { 58 struct APP_LIST_EXPORT SortData {
59 SortData(); 59 SortData();
60 SortData(SearchResult* result, double score); 60 SortData(SearchResult* result, double score);
61 61
62 bool operator<(const SortData& other) const; 62 bool operator<(const SortData& other) const;
63 63
64 SearchResult* result; // Not owned. 64 SearchResult* result; // Not owned.
65 double score; 65 double score;
66 }; 66 };
67 typedef std::vector<Mixer::SortData> SortedResults; 67 typedef std::vector<Mixer::SortData> SortedResults;
68 68
69 class Group; 69 class Group;
70 typedef std::map<GroupId, linked_ptr<Group>> Groups; 70 typedef std::map<GroupId, linked_ptr<Group>> Groups;
71 71
72 // Publishes the given |new_results| to |ui_results|, deleting any existing 72 // Publishes the given |new_results| to |ui_results|, deleting any existing
73 // results that are not in |new_results|. Results that already exist in 73 // results that are not in |new_results|. Results that already exist in
74 // |ui_results| are reused to avoid flickering caused by icon reload. 74 // |ui_results| are reused to avoid flickering caused by icon reload.
75 static void Publish(const SortedResults& results, 75 static void Publish(const SortedResults& results,
76 AppListModel::SearchResults* ui_results); 76 AppListModel::SearchResults* ui_results);
77 77
78 // Removes duplicates from |results|. 78 // Removes duplicates from |results|.
79 static void RemoveDuplicates(SortedResults* results); 79 static void RemoveDuplicates(SortedResults* results);
80 80
81 void FetchResults(const KnownResults& known_results); 81 void FetchResults(bool is_voice_query, const KnownResults& known_results);
82 82
83 AppListModel::SearchResults* ui_results_; // Not owned. 83 AppListModel::SearchResults* ui_results_; // Not owned.
84 Groups groups_; 84 Groups groups_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(Mixer); 86 DISALLOW_COPY_AND_ASSIGN(Mixer);
87 }; 87 };
88 88
89 } // namespace app_list 89 } // namespace app_list
90 90
91 #endif // UI_APP_LIST_SEARCH_MIXER_H_ 91 #endif // UI_APP_LIST_SEARCH_MIXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698