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

Unified Diff: chrome/browser/ui/app_list/search/mixer.cc

Issue 621823004: Simplifies the structure of app_list search a bit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/search/mixer.cc
diff --git a/chrome/browser/ui/app_list/search/mixer.cc b/chrome/browser/ui/app_list/search/mixer.cc
index b5145f71238be54b776be2e59bff0bf2e558255c..e635c42b40490693f54dc55e0e589e31d8cea871 100644
--- a/chrome/browser/ui/app_list/search/mixer.cc
+++ b/chrome/browser/ui/app_list/search/mixer.cc
@@ -10,8 +10,8 @@
#include <string>
#include <vector>
-#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "ui/app_list/search_provider.h"
+#include "ui/app_list/search_result.h"
namespace app_list {
@@ -26,8 +26,8 @@ const size_t kMaxPeopleResults = 2;
// A value to indicate no max number of results limit.
const size_t kNoMaxResultsLimit = 0;
-void UpdateResult(const ChromeSearchResult& source,
- ChromeSearchResult* target) {
+void UpdateResult(const SearchResult& source,
+ SearchResult* target) {
target->set_title(source.title());
target->set_title_tags(source.title_tags());
target->set_details(source.details());
@@ -39,7 +39,7 @@ void UpdateResult(const ChromeSearchResult& source,
Mixer::SortData::SortData() : result(NULL), score(0.0) {
}
-Mixer::SortData::SortData(ChromeSearchResult* result, double score)
+Mixer::SortData::SortData(SearchResult* result, double score)
: result(result), score(score) {
}
@@ -99,8 +99,7 @@ class Mixer::Group {
}
results_.push_back(
- SortData(static_cast<ChromeSearchResult*>(*result_it),
- (*result_it)->relevance() + boost));
+ SortData(*result_it, (*result_it)->relevance() + boost));
}
}
@@ -182,7 +181,7 @@ void Mixer::MixAndPublish(const KnownResults& known_results) {
void Mixer::Publish(const SortedResults& new_results,
AppListModel::SearchResults* ui_results) {
- typedef std::map<std::string, ChromeSearchResult*> IdToResultMap;
+ typedef std::map<std::string, SearchResult*> IdToResultMap;
// The following algorithm is used:
// 1. Transform the |ui_results| list into an unordered map from result ID
@@ -195,8 +194,7 @@ void Mixer::Publish(const SortedResults& new_results,
// A map of the items in |ui_results| that takes ownership of the items.
IdToResultMap ui_results_map;
for (size_t i = 0; i < ui_results->item_count(); ++i) {
- ChromeSearchResult* ui_result =
- static_cast<ChromeSearchResult*>(ui_results->GetItemAt(i));
+ SearchResult* ui_result = ui_results->GetItemAt(i);
ui_results_map[ui_result->id()] = ui_result;
}
// We have to erase all results at once so that observers are notified with
@@ -205,12 +203,12 @@ void Mixer::Publish(const SortedResults& new_results,
// Add items back to |ui_results| in the order of |new_results|.
for (size_t i = 0; i < new_results.size(); ++i) {
- ChromeSearchResult* new_result = new_results[i].result;
+ SearchResult* new_result = new_results[i].result;
IdToResultMap::const_iterator ui_result_it =
ui_results_map.find(new_result->id());
if (ui_result_it != ui_results_map.end()) {
// Update and use the old result if it exists.
- ChromeSearchResult* ui_result = ui_result_it->second;
+ SearchResult* ui_result = ui_result_it->second;
UpdateResult(*new_result, ui_result);
// |ui_results| takes back ownership from |ui_results_map| here.

Powered by Google App Engine
This is Rietveld 408576698