| 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 #ifndef CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/common/extensions/api/launcher_search_provider.h" | 9 #include "chrome/common/extensions/api/launcher_search_provider.h" |
| 10 #include "components/keyed_service/core/keyed_service.h" | 10 #include "components/keyed_service/core/keyed_service.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 static Service* Get(content::BrowserContext* context); | 36 static Service* Get(content::BrowserContext* context); |
| 37 | 37 |
| 38 // Dispatches onQueryStarted events to listener extensions. | 38 // Dispatches onQueryStarted events to listener extensions. |
| 39 void OnQueryStarted(app_list::LauncherSearchProvider* provider, | 39 void OnQueryStarted(app_list::LauncherSearchProvider* provider, |
| 40 const std::string& query, | 40 const std::string& query, |
| 41 const int max_result); | 41 const int max_result); |
| 42 | 42 |
| 43 // Dispatches onQueryEnded events to listener extensions. | 43 // Dispatches onQueryEnded events to listener extensions. |
| 44 void OnQueryEnded(); | 44 void OnQueryEnded(); |
| 45 | 45 |
| 46 // Dispatches onOpenResult event of |item_id| to |extension|. |
| 47 void OnOpenResult(const extensions::Extension* extension, |
| 48 const std::string& item_id); |
| 49 |
| 46 // Sets search results of a listener extension. | 50 // Sets search results of a listener extension. |
| 47 void SetSearchResults( | 51 void SetSearchResults( |
| 48 const extensions::Extension* extension, | 52 const extensions::Extension* extension, |
| 49 const std::string& query_id, | 53 const std::string& query_id, |
| 50 const std::vector<linked_ptr< | 54 const std::vector<linked_ptr< |
| 51 extensions::api::launcher_search_provider::SearchResult>>& results); | 55 extensions::api::launcher_search_provider::SearchResult>>& results); |
| 52 | 56 |
| 53 // Returns true if there is a running query. | 57 // Returns true if there is a running query. |
| 54 bool IsQueryRunning() const; | 58 bool IsQueryRunning() const; |
| 55 | 59 |
| 56 private: | 60 private: |
| 57 // Returns extension ids of listener extensions. | 61 // Returns extension ids of listener extensions. |
| 58 std::set<extensions::ExtensionId> GetListenerExtensionIds(); | 62 std::set<extensions::ExtensionId> GetListenerExtensionIds(); |
| 59 | 63 |
| 60 Profile* const profile_; | 64 Profile* const profile_; |
| 61 extensions::ExtensionRegistry* extension_registry_; | 65 extensions::ExtensionRegistry* extension_registry_; |
| 62 app_list::LauncherSearchProvider* provider_; | 66 app_list::LauncherSearchProvider* provider_; |
| 63 uint32 query_id_; | 67 uint32 query_id_; |
| 64 bool is_query_running_; | 68 bool is_query_running_; |
| 65 | 69 |
| 66 DISALLOW_COPY_AND_ASSIGN(Service); | 70 DISALLOW_COPY_AND_ASSIGN(Service); |
| 67 }; | 71 }; |
| 68 | 72 |
| 69 } // namespace launcher_search_provider | 73 } // namespace launcher_search_provider |
| 70 } // namespace chromeos | 74 } // namespace chromeos |
| 71 | 75 |
| 72 #endif // CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_ | 76 #endif // CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_SERVICE_H_ |
| OLD | NEW |