Index: chrome/browser/ui/app_list/search/mixer.h |
diff --git a/chrome/browser/ui/app_list/search/mixer.h b/chrome/browser/ui/app_list/search/mixer.h |
index b195d6371a842ff4ba2d554ee6a3f19aa4713845..f84c701167d45386c44dcee3ee01d167a62bbdb0 100644 |
--- a/chrome/browser/ui/app_list/search/mixer.h |
+++ b/chrome/browser/ui/app_list/search/mixer.h |
@@ -6,12 +6,18 @@ |
#define CHROME_BROWSER_UI_APP_LIST_SEARCH_MIXER_H_ |
#include "base/basictypes.h" |
+#include "base/gtest_prod_util.h" |
#include "base/memory/scoped_vector.h" |
#include "chrome/browser/ui/app_list/search/history_types.h" |
#include "ui/app_list/app_list_model.h" |
namespace app_list { |
+namespace test { |
+FORWARD_DECLARE_TEST(MixerTest, Publish); |
+} |
+ |
+class ChromeSearchResult; |
class SearchProvider; |
// Mixer collects results from providers, sorts them and publishes them to the |
@@ -44,11 +50,33 @@ class Mixer { |
void MixAndPublish(const KnownResults& known_results); |
private: |
+ FRIEND_TEST_ALL_PREFIXES(test::MixerTest, Publish); |
+ |
+ // Used for sorting and mixing results. |
+ struct SortData { |
+ SortData(); |
+ SortData(ChromeSearchResult* result, double score); |
+ |
+ bool operator<(const SortData& other) const; |
+ |
+ ChromeSearchResult* result; // Not owned. |
+ double score; |
+ }; |
+ typedef std::vector<Mixer::SortData> SortedResults; |
+ |
class Group; |
typedef ScopedVector<Group> Groups; |
+ // Publishes the given |results| to |ui_results|. Reuse existing ones to avoid |
+ // flickering. |
+ void Publish(const SortedResults& results, |
Matt Giuca
2014/07/08 06:09:08
Please make this (and RemoveDuplicates) static. (T
calamity
2014/07/08 07:54:31
Done.
|
+ AppListModel::SearchResults* ui_results); |
+ |
void FetchResults(const KnownResults& known_results); |
+ // Removes duplicates from |results|. |
+ void RemoveDuplicates(SortedResults* results); |
+ |
AppListModel::SearchResults* ui_results_; // Not owned. |
Groups groups_; |