Index: chrome/browser/component_updater/component_updater_service.h |
diff --git a/chrome/browser/component_updater/component_updater_service.h b/chrome/browser/component_updater/component_updater_service.h |
index 7125ff417534eb13c79a26355f9e274abfa3a5fd..a2291df2d2f4e6c67c8f40c6588a1d15caa6125b 100644 |
--- a/chrome/browser/component_updater/component_updater_service.h |
+++ b/chrome/browser/component_updater/component_updater_service.h |
@@ -50,6 +50,32 @@ class ComponentInstaller { |
virtual ~ComponentInstaller() {} |
}; |
+// Defines an interface to observe a CrxComponent. |
+class ComponentObserver { |
+ public: |
+ enum Events { |
+ // Sent when the component updater starts doing update checks. |
+ COMPONENT_UPDATER_STARTED, |
+ |
+ // Sent when the component updater is going to take a long nap. |
+ COMPONENT_UPDATER_SLEEPING, |
+ |
+ // Sent when there is a new version of a registered component. After |
+ // the notification is sent the component will be downloaded. |
+ COMPONENT_UPDATE_FOUND, |
+ |
+ // Sent when the new component has been downloaded and an installation |
+ // or upgrade is about to be attempted. |
+ COMPONENT_UPDATE_READY, |
+ }; |
+ |
+ virtual ~ComponentObserver() {} |
+ |
+ // The component updater service will call this function when an interesting |
+ // event happens for a specific component. |extra| is |event| dependent. |
+ virtual void OnEvent(Events event, int extra) = 0; |
+}; |
+ |
// Describes a particular component that can be installed or updated. This |
// structure is required to register a component with the component updater. |
// |pk_hash| is the SHA256 hash of the component's public key. If the component |
@@ -58,6 +84,7 @@ class ComponentInstaller { |
struct CrxComponent { |
std::vector<uint8> pk_hash; |
ComponentInstaller* installer; |
+ ComponentObserver* observer; |
Version version; |
std::string fingerprint; |
std::string name; |