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 #include "ui/app_list/search/mixer.h" | 5 #include "ui/app_list/search/mixer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 UpdateResult(new_result, ui_result); | 313 UpdateResult(new_result, ui_result); |
314 ui_result->set_relevance(sort_data.score); | 314 ui_result->set_relevance(sort_data.score); |
315 | 315 |
316 // |ui_results| takes back ownership from |ui_results_map| here. | 316 // |ui_results| takes back ownership from |ui_results_map| here. |
317 ui_results->Add(ui_result); | 317 ui_results->Add(ui_result); |
318 | 318 |
319 // Remove the item from the map so that it ends up only with unused | 319 // Remove the item from the map so that it ends up only with unused |
320 // results. | 320 // results. |
321 ui_results_map.erase(ui_result->id()); | 321 ui_results_map.erase(ui_result->id()); |
322 } else { | 322 } else { |
323 scoped_ptr<SearchResult> result_copy = new_result.Duplicate(); | 323 std::unique_ptr<SearchResult> result_copy = new_result.Duplicate(); |
324 result_copy->set_relevance(sort_data.score); | 324 result_copy->set_relevance(sort_data.score); |
325 // Copy the result from |new_results| otherwise. | 325 // Copy the result from |new_results| otherwise. |
326 ui_results->Add(result_copy.release()); | 326 ui_results->Add(result_copy.release()); |
327 } | 327 } |
328 } | 328 } |
329 | 329 |
330 // Delete the results remaining in the map as they are not in the new results. | 330 // Delete the results remaining in the map as they are not in the new results. |
331 for (const auto& ui_result : ui_results_map) { | 331 for (const auto& ui_result : ui_results_map) { |
332 delete ui_result.second; | 332 delete ui_result.second; |
333 } | 333 } |
(...skipping 16 matching lines...) Expand all Loading... |
350 results->swap(final); | 350 results->swap(final); |
351 } | 351 } |
352 | 352 |
353 void Mixer::FetchResults(bool is_voice_query, | 353 void Mixer::FetchResults(bool is_voice_query, |
354 const KnownResults& known_results) { | 354 const KnownResults& known_results) { |
355 for (auto* group : groups_) | 355 for (auto* group : groups_) |
356 group->FetchResults(is_voice_query, known_results); | 356 group->FetchResults(is_voice_query, known_results); |
357 } | 357 } |
358 | 358 |
359 } // namespace app_list | 359 } // namespace app_list |
OLD | NEW |