Index: content/browser/service_worker/service_worker_register_job.h |
diff --git a/content/browser/service_worker/service_worker_register_job.h b/content/browser/service_worker/service_worker_register_job.h |
index 221230a553f7f04c3b1c144153f97a751385ad00..f190b08a29b65af89cd20cefa33ffa920649fbcc 100644 |
--- a/content/browser/service_worker/service_worker_register_job.h |
+++ b/content/browser/service_worker/service_worker_register_job.h |
@@ -41,10 +41,16 @@ class ServiceWorkerRegisterJob |
ServiceWorkerVersion* version)> |
RegistrationCallback; |
+ // For registration jobs. |
CONTENT_EXPORT ServiceWorkerRegisterJob( |
base::WeakPtr<ServiceWorkerContextCore> context, |
const GURL& pattern, |
const GURL& script_url); |
+ |
+ // For update jobs. |
+ CONTENT_EXPORT ServiceWorkerRegisterJob( |
+ base::WeakPtr<ServiceWorkerContextCore> context, |
+ ServiceWorkerRegistration* registration); |
virtual ~ServiceWorkerRegisterJob(); |
// Registers a callback to be called when the promise would resolve (whether |
@@ -60,6 +66,22 @@ class ServiceWorkerRegisterJob |
virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; |
virtual RegistrationJobType GetType() OVERRIDE; |
+ // TODO(michaeln): Use the registration listerer's OnVersionAttributesChanged |
+ // method to replace these methods, have the host listen for changes |
+ // to their registration. |
+ CONTENT_EXPORT static void AssociateInstallingVersionToDocuments( |
+ base::WeakPtr<ServiceWorkerContextCore> context, |
+ ServiceWorkerVersion* version); |
+ static void AssociateWaitingVersionToDocuments( |
+ base::WeakPtr<ServiceWorkerContextCore> context, |
+ ServiceWorkerVersion* version); |
+ static void AssociateActiveVersionToDocuments( |
+ base::WeakPtr<ServiceWorkerContextCore> context, |
+ ServiceWorkerVersion* version); |
+ CONTENT_EXPORT static void DisassociateVersionFromDocuments( |
+ base::WeakPtr<ServiceWorkerContextCore> context, |
+ ServiceWorkerVersion* version); |
+ |
private: |
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, |
AssociateInstallingVersionToDocuments); |
@@ -97,11 +119,14 @@ class ServiceWorkerRegisterJob |
void SetPhase(Phase phase); |
- void HandleExistingRegistrationAndContinue( |
+ void ContinueWithRegistration( |
+ ServiceWorkerStatusCode status, |
+ const scoped_refptr<ServiceWorkerRegistration>& registration); |
+ void ContinueWithUpdate( |
ServiceWorkerStatusCode status, |
const scoped_refptr<ServiceWorkerRegistration>& registration); |
void RegisterAndContinue(ServiceWorkerStatusCode status); |
- void UpdateAndContinue(ServiceWorkerStatusCode status); |
+ void UpdateAndContinue(); |
void OnStartWorkerFinished(ServiceWorkerStatusCode status); |
void OnStoreRegistrationComplete(ServiceWorkerStatusCode status); |
void InstallAndContinue(); |
@@ -110,7 +135,6 @@ class ServiceWorkerRegisterJob |
void OnActivateFinished(ServiceWorkerStatusCode status); |
void Complete(ServiceWorkerStatusCode status); |
void CompleteInternal(ServiceWorkerStatusCode status); |
- |
void ResolvePromise(ServiceWorkerStatusCode status, |
ServiceWorkerRegistration* registration, |
ServiceWorkerVersion* version); |
@@ -119,32 +143,15 @@ class ServiceWorkerRegisterJob |
virtual void OnPausedAfterDownload() OVERRIDE; |
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
- // Associates an installing version to documents matched with a scope of the |
- // version. |
- CONTENT_EXPORT static void AssociateInstallingVersionToDocuments( |
- base::WeakPtr<ServiceWorkerContextCore> context, |
- ServiceWorkerVersion* version); |
- |
- // Associates a waiting version to documents matched with a scope of the |
- // version. |
- static void AssociateWaitingVersionToDocuments( |
- base::WeakPtr<ServiceWorkerContextCore> context, |
- ServiceWorkerVersion* version); |
- |
- // Associates an active version to documents matched with a scope of the |
- // version. |
- static void AssociateActiveVersionToDocuments( |
- base::WeakPtr<ServiceWorkerContextCore> context, |
- ServiceWorkerVersion* version); |
- |
- // Disassociates a version specified by |version_id| from documents. |
- CONTENT_EXPORT static void DisassociateVersionFromDocuments( |
- base::WeakPtr<ServiceWorkerContextCore> context, |
- ServiceWorkerVersion* version); |
+ void OnCompareScriptResourcesComplete( |
+ ServiceWorkerVersion* current_version, |
+ ServiceWorkerStatusCode status, |
+ int compare_result); |
// The ServiceWorkerContextCore object should always outlive this. |
base::WeakPtr<ServiceWorkerContextCore> context_; |
+ RegistrationJobType job_type_; |
const GURL pattern_; |
const GURL script_url_; |
std::vector<RegistrationCallback> callbacks_; |