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/launcher_search_provi
der_service.h" | 5 #include "chrome/browser/chromeos/launcher_search_provider/launcher_search_provi
der_service.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chromeos/launcher_search_provider/launcher_search_provi
der_service_factory.h" | 11 #include "chrome/browser/chromeos/launcher_search_provider/launcher_search_provi
der_service_factory.h" |
10 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov
ider.h" | 12 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_prov
ider.h" |
11 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_resu
lt.h" | 13 #include "chrome/browser/ui/app_list/search/launcher_search/launcher_search_resu
lt.h" |
12 #include "extensions/browser/extension_registry.h" | 14 #include "extensions/browser/extension_registry.h" |
13 #include "extensions/common/extension_set.h" | 15 #include "extensions/common/extension_set.h" |
14 #include "extensions/common/permissions/permissions_data.h" | 16 #include "extensions/common/permissions/permissions_data.h" |
15 | 17 |
16 namespace api_launcher_search_provider = | 18 namespace api_launcher_search_provider = |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 provider_ = provider; | 50 provider_ = provider; |
49 | 51 |
50 ++query_id_; | 52 ++query_id_; |
51 | 53 |
52 extensions::EventRouter* event_router = | 54 extensions::EventRouter* event_router = |
53 extensions::EventRouter::Get(profile_); | 55 extensions::EventRouter::Get(profile_); |
54 | 56 |
55 CacheListenerExtensionIds(); | 57 CacheListenerExtensionIds(); |
56 for (const ExtensionId extension_id : *cached_listener_extension_ids_.get()) { | 58 for (const ExtensionId extension_id : *cached_listener_extension_ids_.get()) { |
57 // Convert query_id_ to string here since queryId is defined as string in | 59 // Convert query_id_ to string here since queryId is defined as string in |
58 // javascript side API while we use uint32 internally to generate it. | 60 // javascript side API while we use uint32_t internally to generate it. |
59 event_router->DispatchEventToExtension( | 61 event_router->DispatchEventToExtension( |
60 extension_id, | 62 extension_id, |
61 make_scoped_ptr(new extensions::Event( | 63 make_scoped_ptr(new extensions::Event( |
62 extensions::events::LAUNCHER_SEARCH_PROVIDER_ON_QUERY_STARTED, | 64 extensions::events::LAUNCHER_SEARCH_PROVIDER_ON_QUERY_STARTED, |
63 api_launcher_search_provider::OnQueryStarted::kEventName, | 65 api_launcher_search_provider::OnQueryStarted::kEventName, |
64 api_launcher_search_provider::OnQueryStarted::Create( | 66 api_launcher_search_provider::OnQueryStarted::Create( |
65 query_id_, query, max_result)))); | 67 query_id_, query, max_result)))); |
66 } | 68 } |
67 } | 69 } |
68 | 70 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 extension->permissions_data(); | 169 extension->permissions_data(); |
168 const bool has_permission = permission_data->HasAPIPermission( | 170 const bool has_permission = permission_data->HasAPIPermission( |
169 extensions::APIPermission::kLauncherSearchProvider); | 171 extensions::APIPermission::kLauncherSearchProvider); |
170 if (has_permission) | 172 if (has_permission) |
171 cached_listener_extension_ids_->insert(extension->id()); | 173 cached_listener_extension_ids_->insert(extension->id()); |
172 } | 174 } |
173 } | 175 } |
174 | 176 |
175 } // namespace launcher_search_provider | 177 } // namespace launcher_search_provider |
176 } // namespace chromeos | 178 } // namespace chromeos |
OLD | NEW |