| 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 adfde80ae1f9b33bd9b8d89bc98253813505231b..562011be42aef6ea4eacc790a87fa2df67505ad3 100644
|
| --- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
|
| +++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc
|
| @@ -191,8 +191,7 @@ bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest,
|
| PnaclComponentInstaller::PnaclComponentInstaller()
|
| : per_user_(false),
|
| updates_disabled_(false),
|
| - cus_(NULL),
|
| - callback_nums_(0) {
|
| + cus_(NULL) {
|
| #if defined(OS_CHROMEOS)
|
| per_user_ = true;
|
| #endif
|
| @@ -302,27 +301,14 @@ bool PnaclComponentInstaller::GetInstalledFile(
|
| void PnaclComponentInstaller::AddInstallCallback(
|
| const InstallCallback& cb) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - int num = ++callback_nums_;
|
| - install_callbacks_.push_back(std::make_pair(cb, num));
|
| -}
|
| -
|
| -void PnaclComponentInstaller::CancelCallback(int num) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - for (std::list<std::pair<InstallCallback, int> >::iterator
|
| - i = install_callbacks_.begin(),
|
| - e = install_callbacks_.end(); i != e; ++i) {
|
| - if (i->second == num) {
|
| - i->first.Run(false);
|
| - install_callbacks_.erase(i);
|
| - return;
|
| - }
|
| - }
|
| + updater_observer_->EnsureObserving();
|
| + install_callbacks_.push_back(cb);
|
| }
|
|
|
| void PnaclComponentInstaller::NotifyAllWithResult(bool status) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| while (!install_callbacks_.empty()) {
|
| - install_callbacks_.front().first.Run(status);
|
| + install_callbacks_.front().Run(status);
|
| install_callbacks_.pop_front();
|
| }
|
| }
|
| @@ -347,17 +333,23 @@ void PnaclComponentInstaller::NotifyInstallSuccess() {
|
| }
|
| }
|
|
|
| +CrxComponent PnaclComponentInstaller::GetCrxComponent() {
|
| + CrxComponent pnacl_component;
|
| + pnacl_component.version = current_version();
|
| + pnacl_component.name = "pnacl";
|
| + pnacl_component.installer = this;
|
| + SetPnaclHash(&pnacl_component);
|
| +
|
| + return pnacl_component;
|
| +}
|
| +
|
| namespace {
|
|
|
| void FinishPnaclUpdateRegistration(const Version& current_version,
|
| PnaclComponentInstaller* pci) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - CrxComponent pnacl_component;
|
| - pnacl_component.version = current_version;
|
| - pnacl_component.name = "pnacl";
|
| - pnacl_component.installer = pci;
|
| pci->set_current_version(current_version);
|
| - SetPnaclHash(&pnacl_component);
|
| + CrxComponent pnacl_component = pci->GetCrxComponent();
|
|
|
| ComponentUpdateService::Status status =
|
| pci->cus()->RegisterComponent(pnacl_component);
|
| @@ -468,13 +460,8 @@ void RequestFirstInstall(ComponentUpdateService* cus,
|
| PnaclComponentInstaller* pci,
|
| const base::Callback<void(bool)>& installed) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - Version null_version(kNullVersion);
|
| - CrxComponent pnacl_component;
|
| - pci->set_current_version(null_version);
|
| - pnacl_component.version = null_version;
|
| - pnacl_component.name = "pnacl";
|
| - pnacl_component.installer = pci;
|
| - SetPnaclHash(&pnacl_component);
|
| + pci->set_current_version(Version(kNullVersion));
|
| + CrxComponent pnacl_component = pci->GetCrxComponent();
|
| ComponentUpdateService::Status status = cus->CheckForUpdateSoon(
|
| pnacl_component);
|
| if (status != ComponentUpdateService::kOk) {
|
|
|