| OLD | NEW |
| 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 CHROME_BROWSER_UI_APP_LIST_SEARCH_MIXER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_MIXER_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_MIXER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_MIXER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 bool operator<(const SortData& other) const; | 60 bool operator<(const SortData& other) const; |
| 61 | 61 |
| 62 ChromeSearchResult* result; // Not owned. | 62 ChromeSearchResult* result; // Not owned. |
| 63 double score; | 63 double score; |
| 64 }; | 64 }; |
| 65 typedef std::vector<Mixer::SortData> SortedResults; | 65 typedef std::vector<Mixer::SortData> SortedResults; |
| 66 | 66 |
| 67 class Group; | 67 class Group; |
| 68 typedef ScopedVector<Group> Groups; | 68 typedef ScopedVector<Group> Groups; |
| 69 | 69 |
| 70 // Publishes the given |results| to |ui_results|. Reuse existing ones to avoid | 70 // Publishes the given |new_results| to |ui_results|, deleting any existing |
| 71 // flickering. | 71 // results that are not in |new_results|. Results that already exist in |
| 72 // |ui_results| are reused to avoid flickering caused by icon reload. |
| 72 static void Publish(const SortedResults& results, | 73 static void Publish(const SortedResults& results, |
| 73 AppListModel::SearchResults* ui_results); | 74 AppListModel::SearchResults* ui_results); |
| 74 | 75 |
| 75 // Removes duplicates from |results|. | 76 // Removes duplicates from |results|. |
| 76 static void RemoveDuplicates(SortedResults* results); | 77 static void RemoveDuplicates(SortedResults* results); |
| 77 | 78 |
| 78 void FetchResults(const KnownResults& known_results); | 79 void FetchResults(const KnownResults& known_results); |
| 79 | 80 |
| 80 AppListModel::SearchResults* ui_results_; // Not owned. | 81 AppListModel::SearchResults* ui_results_; // Not owned. |
| 81 Groups groups_; | 82 Groups groups_; |
| 82 | 83 |
| 83 DISALLOW_COPY_AND_ASSIGN(Mixer); | 84 DISALLOW_COPY_AND_ASSIGN(Mixer); |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 } // namespace app_list | 87 } // namespace app_list |
| 87 | 88 |
| 88 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_MIXER_H_ | 89 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_MIXER_H_ |
| OLD | NEW |