OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov
ider.h" | 5 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov
ider.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
9 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/chromeos/launcher_search_provider/launcher_search_provi
der_service.h" | 12 #include "chrome/browser/chromeos/launcher_search_provider/launcher_search_provi
der_service.h" |
12 | 13 |
13 using chromeos::launcher_search_provider::Service; | 14 using chromeos::launcher_search_provider::Service; |
14 | 15 |
15 namespace app_list { | 16 namespace app_list { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (service->IsQueryRunning()) | 55 if (service->IsQueryRunning()) |
55 service->OnQueryEnded(); | 56 service->OnQueryEnded(); |
56 } | 57 } |
57 | 58 |
58 void LauncherSearchProvider::SetSearchResults( | 59 void LauncherSearchProvider::SetSearchResults( |
59 const extensions::ExtensionId& extension_id, | 60 const extensions::ExtensionId& extension_id, |
60 ScopedVector<LauncherSearchResult> results) { | 61 ScopedVector<LauncherSearchResult> results) { |
61 DCHECK(Service::Get(profile_)->IsQueryRunning()); | 62 DCHECK(Service::Get(profile_)->IsQueryRunning()); |
62 | 63 |
63 // Add this extension's results (erasing any existing results). | 64 // Add this extension's results (erasing any existing results). |
64 extension_results_[extension_id] = make_scoped_ptr( | 65 extension_results_[extension_id] = base::WrapUnique( |
65 new ScopedVector<LauncherSearchResult>(std::move(results))); | 66 new ScopedVector<LauncherSearchResult>(std::move(results))); |
66 | 67 |
67 // Update results with other extension results. | 68 // Update results with other extension results. |
68 ClearResults(); | 69 ClearResults(); |
69 for (const auto& item : extension_results_) { | 70 for (const auto& item : extension_results_) { |
70 for (const auto* result : *item.second) | 71 for (const auto* result : *item.second) |
71 Add(result->Duplicate()); | 72 Add(result->Duplicate()); |
72 } | 73 } |
73 } | 74 } |
74 | 75 |
(...skipping 10 matching lines...) Expand all Loading... |
85 } | 86 } |
86 | 87 |
87 void LauncherSearchProvider::StartInternal(const base::string16& query) { | 88 void LauncherSearchProvider::StartInternal(const base::string16& query) { |
88 if (!query.empty()) { | 89 if (!query.empty()) { |
89 Service::Get(profile_)->OnQueryStarted(this, base::UTF16ToUTF8(query), | 90 Service::Get(profile_)->OnQueryStarted(this, base::UTF16ToUTF8(query), |
90 kLauncherSearchProviderMaxResults); | 91 kLauncherSearchProviderMaxResults); |
91 } | 92 } |
92 } | 93 } |
93 | 94 |
94 } // namespace app_list | 95 } // namespace app_list |
OLD | NEW |