| Index: chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
|
| diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
|
| index fbbb315e3af7d9f426408043d2987ed6081ba219..03597fc309765077b86df372eb6688d250153e43 100644
|
| --- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
|
| +++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
|
| @@ -25,6 +25,11 @@ using content::BrowserThread;
|
|
|
| namespace {
|
|
|
| +// If PNaCl isn't installed yet, but a user is running chrome with
|
| +// --enable-pnacl, this is the amount of time to wait before starting
|
| +// a background install.
|
| +const int kInitialDelaySeconds = 10;
|
| +
|
| // One of the Pnacl component files, for checking that expected files exist.
|
| // TODO(jvoung): perhaps replace this with a list of the expected files in the
|
| // manifest.json. Use that to check that everything is unpacked.
|
| @@ -127,10 +132,6 @@ void SetPnaclHash(CrxComponent* component) {
|
|
|
|
|
| // If we don't have Pnacl installed, this is the version we claim.
|
| -// TODO(jvoung): Is there a way to trick the configurator to ping the server
|
| -// earlier if there are components that are not yet installed (version 0.0.0.0),
|
| -// So that they will be available ASAP? Be careful not to hurt startup speed.
|
| -// Make kNullVersion part of ComponentUpdater in that case, to avoid skew?
|
| const char kNullVersion[] = "0.0.0.0";
|
|
|
| // Pnacl components have the version encoded in the path itself:
|
| @@ -314,6 +315,13 @@ bool PnaclComponentInstaller::Install(base::DictionaryValue* manifest,
|
|
|
| namespace {
|
|
|
| +void DoCheckForUpdate(ComponentUpdateService* cus,
|
| + const CrxComponent& pnacl) {
|
| + if (cus->CheckForUpdateSoon(pnacl) != ComponentUpdateService::kOk) {
|
| + LOG(WARNING) << "Pnacl check for update failed.";
|
| + }
|
| +}
|
| +
|
| // Finally, do the registration with the right version number.
|
| void FinishPnaclUpdateRegistration(ComponentUpdateService* cus,
|
| const Version& current_version) {
|
| @@ -328,6 +336,16 @@ void FinishPnaclUpdateRegistration(ComponentUpdateService* cus,
|
| if (cus->RegisterComponent(pnacl) != ComponentUpdateService::kOk) {
|
| NOTREACHED() << "Pnacl component registration failed.";
|
| }
|
| +
|
| + // If Pnacl is not yet installed, but it is requested by --enable-pnacl,
|
| + // we want it to be available "soon", so kick off an update check.
|
| + Version null_version(kNullVersion);
|
| + if (current_version.Equals(null_version)) {
|
| + BrowserThread::PostDelayedTask(
|
| + BrowserThread::UI, FROM_HERE,
|
| + base::Bind(DoCheckForUpdate, cus, pnacl),
|
| + base::TimeDelta::FromSeconds(kInitialDelaySeconds));
|
| + }
|
| }
|
|
|
| // Check if there is an existing version on disk first to know when
|
|
|