Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(889)

Unified Diff: chrome/browser/chromeos/launcher_search_provider/service.h

Issue 1137603005: Cache listener extension ids. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/launcher_search_provider/service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/launcher_search_provider/service.h
diff --git a/chrome/browser/chromeos/launcher_search_provider/service.h b/chrome/browser/chromeos/launcher_search_provider/service.h
index 17ebf97ce8d989bf33403f8666cbdf10e10f3779..8ff5c850ee94b8308e140a186ac416a0b884a134 100644
--- a/chrome/browser/chromeos/launcher_search_provider/service.h
+++ b/chrome/browser/chromeos/launcher_search_provider/service.h
@@ -12,6 +12,7 @@
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/extension.h"
namespace app_list {
@@ -31,7 +32,8 @@ const int kMaxSearchResultScore = 4;
// This service provides access control for it.
//
// TODO(yawano): Implement opt-in control (crbug.com/440649).
-class Service : public KeyedService {
+class Service : public KeyedService,
+ public extensions::ExtensionRegistryObserver {
public:
Service(Profile* profile, extensions::ExtensionRegistry* extension_registry);
~Service() override;
@@ -60,15 +62,25 @@ class Service : public KeyedService {
// Returns true if there is a running query.
bool IsQueryRunning() const;
+ // extensions::ExtensionRegistryObserver override.
+ void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const extensions::Extension* extension) override;
+ void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const extensions::Extension* extension,
+ extensions::UnloadedExtensionInfo::Reason reason) override;
+
private:
- // Returns extension ids of listener extensions.
- std::set<extensions::ExtensionId> GetListenerExtensionIds();
+ // Cache listener extension ids and set them to
+ // |cached_listener_extension_ids_|.
+ void CacheListenerExtensionIds();
Profile* const profile_;
extensions::ExtensionRegistry* extension_registry_;
app_list::LauncherSearchProvider* provider_;
int query_id_;
bool is_query_running_;
+ scoped_ptr<std::set<extensions::ExtensionId>> cached_listener_extension_ids_;
DISALLOW_COPY_AND_ASSIGN(Service);
};
« no previous file with comments | « no previous file | chrome/browser/chromeos/launcher_search_provider/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698