| Index: content/browser/service_worker/service_worker_context_core.cc
|
| diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc
|
| index 5647ef974e95d7b8414403356bd292894b7ccffb..17adebe1cb18b7807fae9c804597be70d7367997 100644
|
| --- a/content/browser/service_worker/service_worker_context_core.cc
|
| +++ b/content/browser/service_worker/service_worker_context_core.cc
|
| @@ -216,6 +216,23 @@ void ServiceWorkerContextCore::UnregisterServiceWorker(
|
| callback));
|
| }
|
|
|
| +void ServiceWorkerContextCore::GetRegistration(
|
| + const GURL& document_url,
|
| + const GetRegistrationCallback& callback) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + if (storage()->IsDisabled()) {
|
| + callback.Run(SERVICE_WORKER_ERROR_ABORT,
|
| + kInvalidServiceWorkerRegistrationId);
|
| + return;
|
| + }
|
| +
|
| + storage()->FindRegistrationForDocument(
|
| + document_url,
|
| + base::Bind(&ServiceWorkerContextCore::GetRegistrationComplete,
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| +}
|
| +
|
| void ServiceWorkerContextCore::UpdateServiceWorker(
|
| ServiceWorkerRegistration* registration) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| @@ -260,6 +277,23 @@ void ServiceWorkerContextCore::UnregistrationComplete(
|
| }
|
| }
|
|
|
| +void ServiceWorkerContextCore::GetRegistrationComplete(
|
| + const ServiceWorkerContextCore::GetRegistrationCallback& callback,
|
| + ServiceWorkerStatusCode status,
|
| + const scoped_refptr<ServiceWorkerRegistration>& registration) {
|
| + if (status == SERVICE_WORKER_ERROR_NOT_FOUND) {
|
| + DCHECK(!registration.get());
|
| + callback.Run(SERVICE_WORKER_OK, kInvalidServiceWorkerRegistrationId);
|
| + return;
|
| + }
|
| +
|
| + int64 registration_id = kInvalidServiceWorkerRegistrationId;
|
| + if (status == SERVICE_WORKER_OK && !registration->is_uninstalling())
|
| + registration_id = registration->id();
|
| +
|
| + callback.Run(status, registration_id);
|
| +}
|
| +
|
| ServiceWorkerRegistration* ServiceWorkerContextCore::GetLiveRegistration(
|
| int64 id) {
|
| RegistrationsMap::iterator it = live_registrations_.find(id);
|
|
|