| 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_LAUNCHER_SEARCH_PROVIDE
R_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_LAUNCHER_SEARCH_PROVIDE
R_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_LAUNCHER_SEARCH_PROVIDE
R_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_LAUNCHER_SEARCH_PROVIDE
R_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h" | 11 #include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/extensions/api/launcher_search_provider.h" | 13 #include "chrome/common/extensions/api/launcher_search_provider.h" |
| 13 #include "components/keyed_service/core/keyed_service.h" | 14 #include "components/keyed_service/core/keyed_service.h" |
| 14 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
| 15 #include "extensions/browser/event_router.h" | 16 #include "extensions/browser/event_router.h" |
| 16 #include "extensions/browser/extension_registry_observer.h" | 17 #include "extensions/browser/extension_registry_observer.h" |
| 17 #include "extensions/common/extension.h" | 18 #include "extensions/common/extension.h" |
| 18 | 19 |
| 19 namespace app_list { | 20 namespace app_list { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 48 // Dispatches onQueryEnded events to listener extensions. | 49 // Dispatches onQueryEnded events to listener extensions. |
| 49 void OnQueryEnded(); | 50 void OnQueryEnded(); |
| 50 | 51 |
| 51 // Dispatches onOpenResult event of |item_id| to |extension_id|. | 52 // Dispatches onOpenResult event of |item_id| to |extension_id|. |
| 52 void OnOpenResult(const extensions::ExtensionId& extension_id, | 53 void OnOpenResult(const extensions::ExtensionId& extension_id, |
| 53 const std::string& item_id); | 54 const std::string& item_id); |
| 54 | 55 |
| 55 // Sets search results of a listener extension. | 56 // Sets search results of a listener extension. |
| 56 void SetSearchResults( | 57 void SetSearchResults( |
| 57 const extensions::Extension* extension, | 58 const extensions::Extension* extension, |
| 58 scoped_ptr<ErrorReporter> error_reporter, | 59 std::unique_ptr<ErrorReporter> error_reporter, |
| 59 const int query_id, | 60 const int query_id, |
| 60 const std::vector< | 61 const std::vector< |
| 61 extensions::api::launcher_search_provider::SearchResult>& results); | 62 extensions::api::launcher_search_provider::SearchResult>& results); |
| 62 | 63 |
| 63 // Returns true if there is a running query. | 64 // Returns true if there is a running query. |
| 64 bool IsQueryRunning() const; | 65 bool IsQueryRunning() const; |
| 65 | 66 |
| 66 // extensions::ExtensionRegistryObserver override. | 67 // extensions::ExtensionRegistryObserver override. |
| 67 void OnExtensionLoaded(content::BrowserContext* browser_context, | 68 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 68 const extensions::Extension* extension) override; | 69 const extensions::Extension* extension) override; |
| 69 void OnExtensionUnloaded( | 70 void OnExtensionUnloaded( |
| 70 content::BrowserContext* browser_context, | 71 content::BrowserContext* browser_context, |
| 71 const extensions::Extension* extension, | 72 const extensions::Extension* extension, |
| 72 extensions::UnloadedExtensionInfo::Reason reason) override; | 73 extensions::UnloadedExtensionInfo::Reason reason) override; |
| 73 | 74 |
| 74 private: | 75 private: |
| 75 // Cache listener extension ids and set them to | 76 // Cache listener extension ids and set them to |
| 76 // |cached_listener_extension_ids_|. | 77 // |cached_listener_extension_ids_|. |
| 77 void CacheListenerExtensionIds(); | 78 void CacheListenerExtensionIds(); |
| 78 | 79 |
| 79 Profile* const profile_; | 80 Profile* const profile_; |
| 80 extensions::ExtensionRegistry* extension_registry_; | 81 extensions::ExtensionRegistry* extension_registry_; |
| 81 app_list::LauncherSearchProvider* provider_; | 82 app_list::LauncherSearchProvider* provider_; |
| 82 int query_id_; | 83 int query_id_; |
| 83 bool is_query_running_; | 84 bool is_query_running_; |
| 84 scoped_ptr<std::set<extensions::ExtensionId>> cached_listener_extension_ids_; | 85 std::unique_ptr<std::set<extensions::ExtensionId>> |
| 86 cached_listener_extension_ids_; |
| 85 | 87 |
| 86 DISALLOW_COPY_AND_ASSIGN(Service); | 88 DISALLOW_COPY_AND_ASSIGN(Service); |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 } // namespace launcher_search_provider | 91 } // namespace launcher_search_provider |
| 90 } // namespace chromeos | 92 } // namespace chromeos |
| 91 | 93 |
| 92 #endif // CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_LAUNCHER_SEARCH_PROV
IDER_SERVICE_H_ | 94 #endif // CHROME_BROWSER_CHROMEOS_LAUNCHER_SEARCH_PROVIDER_LAUNCHER_SEARCH_PROV
IDER_SERVICE_H_ |
| OLD | NEW |