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/chromeos/launcher_search_provider/service.h" | 5 #include "chrome/browser/chromeos/launcher_search_provider/service.h" |
6 | 6 |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chromeos/launcher_search_provider/service_factory.h" | 9 #include "chrome/browser/chromeos/launcher_search_provider/service_factory.h" |
10 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov ider.h" | 10 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov ider.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 search_results.push_back(search_result); | 127 search_results.push_back(search_result); |
128 } | 128 } |
129 provider_->SetSearchResults(extension->id(), search_results.Pass()); | 129 provider_->SetSearchResults(extension->id(), search_results.Pass()); |
130 } | 130 } |
131 | 131 |
132 bool Service::IsQueryRunning() const { | 132 bool Service::IsQueryRunning() const { |
133 return is_query_running_; | 133 return is_query_running_; |
134 } | 134 } |
135 | 135 |
136 std::set<ExtensionId> Service::GetListenerExtensionIds() { | 136 std::set<ExtensionId> Service::GetListenerExtensionIds() { |
137 // TODO(yawano): Cache this result for optimization. | |
satorux1
2015/04/22 01:44:53
also add a link to crbug.com?
yawano
2015/04/22 12:23:47
Done.
| |
137 std::set<ExtensionId> extension_ids; | 138 std::set<ExtensionId> extension_ids; |
138 | 139 |
139 const ExtensionSet& extension_set = extension_registry_->enabled_extensions(); | 140 const ExtensionSet& extension_set = extension_registry_->enabled_extensions(); |
140 for (scoped_refptr<const extensions::Extension> extension : extension_set) { | 141 for (scoped_refptr<const extensions::Extension> extension : extension_set) { |
141 const extensions::PermissionsData* permission_data = | 142 const extensions::PermissionsData* permission_data = |
142 extension->permissions_data(); | 143 extension->permissions_data(); |
143 const bool has_permission = permission_data->HasAPIPermission( | 144 const bool has_permission = permission_data->HasAPIPermission( |
144 extensions::APIPermission::kLauncherSearchProvider); | 145 extensions::APIPermission::kLauncherSearchProvider); |
145 if (has_permission) | 146 if (has_permission) |
146 extension_ids.insert(extension->id()); | 147 extension_ids.insert(extension->id()); |
147 } | 148 } |
148 | 149 |
149 return extension_ids; | 150 return extension_ids; |
150 } | 151 } |
151 | 152 |
152 } // namespace launcher_search_provider | 153 } // namespace launcher_search_provider |
153 } // namespace chromeos | 154 } // namespace chromeos |
OLD | NEW |