Index: chrome/browser/component_updater/pnacl/pnacl_component_installer.h |
diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.h b/chrome/browser/component_updater/pnacl/pnacl_component_installer.h |
index 9ba2997297b63ce6c0fd64f75b84c4a0b6bf97d1..952cbfcfc255ca4dcb75eda6ea76b9d6b9d46e39 100644 |
--- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.h |
+++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.h |
@@ -5,6 +5,9 @@ |
#ifndef CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
#define CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |
+#include <list> |
+ |
+#include "base/callback_forward.h" |
#include "base/files/file_path.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/version.h" |
@@ -53,12 +56,26 @@ class PnaclComponentInstaller : public ComponentInstaller { |
ComponentUpdateService* cus() const { return cus_; } |
+ typedef base::Callback<void(bool)> InstallCallback; |
+ void AddInstallCallback(const InstallCallback& cb); |
+ |
private: |
+ // Cancel a particular callback after a timeout. |
+ void CancelCallback(int callback_num); |
+ |
+ void NotifyAllWithResult(bool status); |
+ void NotifyInstallError(); |
+ void NotifyInstallSuccess(); |
+ |
bool per_user_; |
scoped_ptr<PnaclProfileObserver> profile_observer_; |
base::FilePath current_profile_path_; |
base::Version current_version_; |
ComponentUpdateService* cus_; |
+ // Counter to issue identifiers to each callback. |
+ int callback_nums_; |
+ // List of callbacks to issue when an install completes successfully. |
+ std::list<std::pair<InstallCallback, int> > install_callbacks_; |
DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller); |
}; |
@@ -67,4 +84,11 @@ class PnaclComponentInstaller : public ComponentInstaller { |
bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest, |
base::Version* version_out); |
+// Ask the given component updater service to do a first-install for PNaCl. |
+// The |installed| callback will be run with |true| on success, |
+// or run with |false| on an error. The callback is called on the UI thread. |
+void RequestFirstInstall(ComponentUpdateService* cus, |
+ PnaclComponentInstaller* pci, |
+ const base::Callback<void(bool)>& installed); |
+ |
#endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_COMPONENT_INSTALLER_H_ |