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

Unified Diff: chrome/browser/component_updater/component_updater_service.h

Issue 20774003: First cut at the component observer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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/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..4a02157cf82e67f04a416b0d726d4e4437dc9e41 100644
--- a/chrome/browser/component_updater/component_updater_service.h
+++ b/chrome/browser/component_updater/component_updater_service.h
@@ -50,14 +50,41 @@ 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
// is to be installed then version should be "0" or "0.0", else it should be
-// the current version. |fingerprint| and |name| are optional.
+// the current version. |observer|, |fingerprint|, and |name| are optional.
struct CrxComponent {
std::vector<uint8> pk_hash;
ComponentInstaller* installer;
+ ComponentObserver* observer;
Version version;
std::string fingerprint;
std::string name;
« no previous file with comments | « chrome/browser/chrome_notification_types.h ('k') | chrome/browser/component_updater/component_updater_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698