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

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: observer instead of timeout 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..e5423d5cb4b76d9d44feb1e9256ed0782d973713 100644
--- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.h
+++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.h
@@ -5,11 +5,15 @@
#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"
#include "chrome/browser/component_updater/component_updater_service.h"
#include "chrome/browser/component_updater/pnacl/pnacl_profile_observer.h"
+#include "chrome/browser/component_updater/pnacl/pnacl_updater_observer.h"
class CommandLine;
@@ -53,12 +57,31 @@ class PnaclComponentInstaller : public ComponentInstaller {
ComponentUpdateService* cus() const { return cus_; }
+ typedef base::Callback<void(bool)> InstallCallback;
+ void AddInstallCallback(const InstallCallback& cb);
+
+ void NotifyInstallError();
+
+ void NotifyInstallSuccess();
+
private:
+ // Cancel a particular callback after a timeout.
+ void CancelCallback(int callback_num);
+
+ void NotifyAllWithResult(bool status);
+
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_;
+ // Component updater service observer, to determine when an on-demand
+ // install request failed.
+ scoped_ptr<PnaclUpdaterObserver> updater_observer_;
DISALLOW_COPY_AND_ASSIGN(PnaclComponentInstaller);
};
@@ -67,4 +90,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