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

Unified Diff: chrome/browser/extensions/extension_system.h

Issue 14757022: Add a non-blocking "OneShotEvent" class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename Latch to OneShotEvent Created 7 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
Index: chrome/browser/extensions/extension_system.h
diff --git a/chrome/browser/extensions/extension_system.h b/chrome/browser/extensions/extension_system.h
index c2bdc609f84d2d17dc27648ae4ca335c980aac9a..d84376c40ec217a65a07e7bc299c33586fb37cd5 100644
--- a/chrome/browser/extensions/extension_system.h
+++ b/chrome/browser/extensions/extension_system.h
@@ -15,6 +15,7 @@
#include "chrome/browser/extensions/api/usb/usb_device_resource.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
#include "chrome/common/extensions/extension_constants.h"
+#include "extensions/common/one_shot_event.h"
class ExtensionInfoMap;
class ExtensionProcessManager;
@@ -140,6 +141,15 @@ class ExtensionSystem : public ProfileKeyedService {
virtual void UnregisterExtensionWithRequestContexts(
const std::string& extension_id,
const extension_misc::UnloadedExtensionReason reason) {}
+
+ // Whether the extension system has completed its startup tasks.
not at google - send to devlin 2013/05/16 15:51:08 The comment (and in a way, method name) implies th
Jeffrey Yasskin 2013/05/16 19:05:36 Good point; re-commented.
+ virtual const OneShotEvent& ready() const = 0;
+
+ protected:
+ friend class ::ExtensionService;
+ // Called by the ExtensionService when it finishes loading extensions on
+ // startup.
+ virtual void ExtensionServiceReady() = 0;
not at google - send to devlin 2013/05/16 15:51:08 I can see why ExtensionService owns this event, bu
Jeffrey Yasskin 2013/05/16 19:05:36 I agree that it's icky, and I tried your suggestio
not at google - send to devlin 2013/05/16 21:38:17 A constructor parameter to ExtensionService won't
Jeffrey Yasskin 2013/05/16 22:19:21 That seems to work and be cleaner that this callba
};
// The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl.
@@ -189,6 +199,8 @@ class ExtensionSystemImpl : public ExtensionSystem {
const std::string& extension_id,
const extension_misc::UnloadedExtensionReason reason) OVERRIDE;
+ virtual const OneShotEvent& ready() const OVERRIDE;
+
private:
friend class ExtensionSystemSharedFactory;
@@ -220,6 +232,7 @@ class ExtensionSystemImpl : public ExtensionSystem {
LazyBackgroundTaskQueue* lazy_background_task_queue();
EventRouter* event_router();
ExtensionWarningService* warning_service();
+ OneShotEvent* ready() { return &ready_; }
private:
Profile* profile_;
@@ -249,8 +262,12 @@ class ExtensionSystemImpl : public ExtensionSystem {
scoped_refptr<ExtensionInfoMap> extension_info_map_;
scoped_ptr<ExtensionWarningService> extension_warning_service_;
scoped_ptr<ExtensionWarningBadgeService> extension_warning_badge_service_;
+
+ OneShotEvent ready_;
};
+ virtual void ExtensionServiceReady() OVERRIDE;
+
Profile* profile_;
Shared* shared_;

Powered by Google App Engine
This is Rietveld 408576698