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

Unified Diff: chrome/browser/component_updater/pnacl/pnacl_component_installer.h

Issue 17001003: Replace early check for PNaCl with an on-demand check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup a bit Created 7 years, 6 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/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_

Powered by Google App Engine
This is Rietveld 408576698