| Index: content/browser/service_worker/service_worker_provider_host.cc
|
| diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc
|
| index 85ea2cae79391c90355ff0bb6b2fe5dfe5b4680a..21a58dd7e4398cd5c0d63044123845370bd98e07 100644
|
| --- a/content/browser/service_worker/service_worker_provider_host.cc
|
| +++ b/content/browser/service_worker/service_worker_provider_host.cc
|
| @@ -41,6 +41,20 @@ ServiceWorkerProviderHost::~ServiceWorkerProviderHost() {
|
| waiting_version_->RemovePotentialControllee(this);
|
| if (installing_version_)
|
| installing_version_->RemovePotentialControllee(this);
|
| + if (associated_registration_)
|
| + associated_registration_->RemoveListener(this);
|
| +}
|
| +
|
| +void ServiceWorkerProviderHost::OnVersionAttributesChanged(
|
| + ServiceWorkerRegistration* registration,
|
| + ChangedVersionAttributesMask changed_mask,
|
| + const ServiceWorkerRegistrationInfo& info) {
|
| + if (changed_mask.installing_changed())
|
| + SetInstallingVersion(registration->installing_version());
|
| + if (changed_mask.waiting_changed())
|
| + SetWaitingVersion(registration->waiting_version());
|
| + if (changed_mask.active_changed())
|
| + SetActiveVersion(registration->active_version());
|
| }
|
|
|
| void ServiceWorkerProviderHost::SetDocumentUrl(const GURL& url) {
|
| @@ -159,6 +173,14 @@ bool ServiceWorkerProviderHost::SetHostedVersionId(int64 version_id) {
|
| return true;
|
| }
|
|
|
| +void ServiceWorkerProviderHost::SetRegistration(
|
| + ServiceWorkerRegistration* registration) {
|
| + DCHECK(registration);
|
| + DCHECK(CanAssociateRegistration());
|
| + associated_registration_ = registration;
|
| + associated_registration_->AddListener(this);
|
| +}
|
| +
|
| scoped_ptr<ServiceWorkerRequestHandler>
|
| ServiceWorkerProviderHost::CreateRequestHandler(
|
| ResourceType resource_type,
|
| @@ -201,6 +223,12 @@ bool ServiceWorkerProviderHost::CanAssociateVersion(
|
| version->registration_id();
|
| }
|
|
|
| +bool ServiceWorkerProviderHost::CanAssociateRegistration() {
|
| + if (!context_ || associated_registration_)
|
| + return false;
|
| + return true;
|
| +}
|
| +
|
| void ServiceWorkerProviderHost::PostMessage(
|
| const base::string16& message,
|
| const std::vector<int>& sent_message_port_ids) {
|
|
|