| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // - firing the 'install' event at the ServiceWorkerVersion | 31 // - firing the 'install' event at the ServiceWorkerVersion |
| 32 // - firing the 'activate' event at the ServiceWorkerVersion | 32 // - firing the 'activate' event at the ServiceWorkerVersion |
| 33 // - waiting for older ServiceWorkerVersions to deactivate | 33 // - waiting for older ServiceWorkerVersions to deactivate |
| 34 // - designating the new version to be the 'active' version | 34 // - designating the new version to be the 'active' version |
| 35 // - updating storage | 35 // - updating storage |
| 36 class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase, | 36 class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase, |
| 37 public EmbeddedWorkerInstance::Listener, | 37 public EmbeddedWorkerInstance::Listener, |
| 38 public ServiceWorkerRegistration::Listener { | 38 public ServiceWorkerRegistration::Listener { |
| 39 public: | 39 public: |
| 40 typedef base::Callback<void(ServiceWorkerStatusCode status, | 40 typedef base::Callback<void(ServiceWorkerStatusCode status, |
| 41 ServiceWorkerRegistration* registration, | 41 ServiceWorkerRegistration* registration)> |
| 42 ServiceWorkerVersion* version)> | |
| 43 RegistrationCallback; | 42 RegistrationCallback; |
| 44 | 43 |
| 45 // For registration jobs. | 44 // For registration jobs. |
| 46 CONTENT_EXPORT ServiceWorkerRegisterJob( | 45 CONTENT_EXPORT ServiceWorkerRegisterJob( |
| 47 base::WeakPtr<ServiceWorkerContextCore> context, | 46 base::WeakPtr<ServiceWorkerContextCore> context, |
| 48 const GURL& pattern, | 47 const GURL& pattern, |
| 49 const GURL& script_url); | 48 const GURL& script_url); |
| 50 | 49 |
| 51 // For update jobs. | 50 // For update jobs. |
| 52 CONTENT_EXPORT ServiceWorkerRegisterJob( | 51 CONTENT_EXPORT ServiceWorkerRegisterJob( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 void UpdateAndContinue(); | 124 void UpdateAndContinue(); |
| 126 void OnStartWorkerFinished(ServiceWorkerStatusCode status); | 125 void OnStartWorkerFinished(ServiceWorkerStatusCode status); |
| 127 void OnStoreRegistrationComplete(ServiceWorkerStatusCode status); | 126 void OnStoreRegistrationComplete(ServiceWorkerStatusCode status); |
| 128 void InstallAndContinue(); | 127 void InstallAndContinue(); |
| 129 void OnInstallFinished(ServiceWorkerStatusCode status); | 128 void OnInstallFinished(ServiceWorkerStatusCode status); |
| 130 void ActivateAndContinue(); | 129 void ActivateAndContinue(); |
| 131 void OnActivateFinished(ServiceWorkerStatusCode status); | 130 void OnActivateFinished(ServiceWorkerStatusCode status); |
| 132 void Complete(ServiceWorkerStatusCode status); | 131 void Complete(ServiceWorkerStatusCode status); |
| 133 void CompleteInternal(ServiceWorkerStatusCode status); | 132 void CompleteInternal(ServiceWorkerStatusCode status); |
| 134 void ResolvePromise(ServiceWorkerStatusCode status, | 133 void ResolvePromise(ServiceWorkerStatusCode status, |
| 135 ServiceWorkerRegistration* registration, | 134 ServiceWorkerRegistration* registration); |
| 136 ServiceWorkerVersion* version); | |
| 137 | 135 |
| 138 // EmbeddedWorkerInstance::Listener override of OnPausedAfterDownload. | 136 // EmbeddedWorkerInstance::Listener override of OnPausedAfterDownload. |
| 139 virtual void OnPausedAfterDownload() OVERRIDE; | 137 virtual void OnPausedAfterDownload() OVERRIDE; |
| 140 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 138 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 141 | 139 |
| 142 // ServiceWorkerRegistration::Listener overrides | 140 // ServiceWorkerRegistration::Listener overrides |
| 143 virtual void OnRegistrationFinishedUninstalling( | 141 virtual void OnRegistrationFinishedUninstalling( |
| 144 ServiceWorkerRegistration* registration) OVERRIDE; | 142 ServiceWorkerRegistration* registration) OVERRIDE; |
| 145 | 143 |
| 146 void OnCompareScriptResourcesComplete( | 144 void OnCompareScriptResourcesComplete( |
| 147 ServiceWorkerVersion* most_recent_version, | |
| 148 ServiceWorkerStatusCode status, | 145 ServiceWorkerStatusCode status, |
| 149 bool are_equal); | 146 bool are_equal); |
| 150 | 147 |
| 151 void AssociateProviderHostsToRegistration( | 148 void AssociateProviderHostsToRegistration( |
| 152 ServiceWorkerRegistration* registration); | 149 ServiceWorkerRegistration* registration); |
| 153 | 150 |
| 154 // The ServiceWorkerContextCore object should always outlive this. | 151 // The ServiceWorkerContextCore object should always outlive this. |
| 155 base::WeakPtr<ServiceWorkerContextCore> context_; | 152 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 156 | 153 |
| 157 RegistrationJobType job_type_; | 154 RegistrationJobType job_type_; |
| 158 const GURL pattern_; | 155 const GURL pattern_; |
| 159 const GURL script_url_; | 156 const GURL script_url_; |
| 160 std::vector<RegistrationCallback> callbacks_; | 157 std::vector<RegistrationCallback> callbacks_; |
| 161 Phase phase_; | 158 Phase phase_; |
| 162 Internal internal_; | 159 Internal internal_; |
| 163 bool is_promise_resolved_; | 160 bool is_promise_resolved_; |
| 164 ServiceWorkerStatusCode promise_resolved_status_; | 161 ServiceWorkerStatusCode promise_resolved_status_; |
| 165 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; | 162 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; |
| 166 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_; | |
| 167 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; | 163 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; |
| 168 | 164 |
| 169 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); | 165 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); |
| 170 }; | 166 }; |
| 171 | 167 |
| 172 } // namespace content | 168 } // namespace content |
| 173 | 169 |
| 174 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 170 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
| OLD | NEW |