Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "content/browser/service_worker/embedded_worker_instance.h" | 14 #include "content/browser/service_worker/embedded_worker_instance.h" |
| 15 #include "content/browser/service_worker/service_worker_register_job_base.h" | 15 #include "content/browser/service_worker/service_worker_register_job_base.h" |
| 16 #include "content/browser/service_worker/service_worker_registration.h" | 16 #include "content/browser/service_worker/service_worker_registration.h" |
| 17 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" | |
|
leonhsl(Using Gerrit)
2017/04/23 03:33:10
We do not need this include here.
xiaofengzhang
2017/04/25 06:01:28
Done.
| |
| 17 #include "content/common/service_worker/service_worker_status_code.h" | 18 #include "content/common/service_worker/service_worker_status_code.h" |
| 19 #include "mojo/public/cpp/bindings/associated_binding.h" | |
|
leonhsl(Using Gerrit)
2017/04/23 03:33:10
We do not need this include here.
xiaofengzhang
2017/04/25 06:01:28
Done.
| |
| 18 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 19 | 21 |
| 20 namespace content { | 22 namespace content { |
| 21 | 23 |
| 22 // Handles the initial registration of a Service Worker and the | 24 // Handles the initial registration of a Service Worker and the |
| 23 // subsequent update of existing registrations. | 25 // subsequent update of existing registrations. |
| 24 // | 26 // |
| 25 // The control flow includes most or all of the following, | 27 // The control flow includes most or all of the following, |
| 26 // depending on what is already registered: | 28 // depending on what is already registered: |
| 27 // - creating a ServiceWorkerRegistration instance if there isn't | 29 // - creating a ServiceWorkerRegistration instance if there isn't |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 struct Internal { | 89 struct Internal { |
| 88 Internal(); | 90 Internal(); |
| 89 ~Internal(); | 91 ~Internal(); |
| 90 scoped_refptr<ServiceWorkerRegistration> registration; | 92 scoped_refptr<ServiceWorkerRegistration> registration; |
| 91 | 93 |
| 92 // Holds the version created by this job. It can be the 'installing', | 94 // Holds the version created by this job. It can be the 'installing', |
| 93 // 'waiting', or 'active' version depending on the phase. | 95 // 'waiting', or 'active' version depending on the phase. |
| 94 scoped_refptr<ServiceWorkerVersion> new_version; | 96 scoped_refptr<ServiceWorkerVersion> new_version; |
| 95 }; | 97 }; |
| 96 | 98 |
| 99 class InstallEventMethodsReceiver; | |
| 100 | |
| 97 void set_registration(scoped_refptr<ServiceWorkerRegistration> registration); | 101 void set_registration(scoped_refptr<ServiceWorkerRegistration> registration); |
| 98 ServiceWorkerRegistration* registration(); | 102 ServiceWorkerRegistration* registration(); |
| 99 void set_new_version(ServiceWorkerVersion* version); | 103 void set_new_version(ServiceWorkerVersion* version); |
| 100 ServiceWorkerVersion* new_version(); | 104 ServiceWorkerVersion* new_version(); |
| 101 | 105 |
| 102 void SetPhase(Phase phase); | 106 void SetPhase(Phase phase); |
| 103 | 107 |
| 104 void StartImpl(); | 108 void StartImpl(); |
| 105 void ContinueWithRegistration( | 109 void ContinueWithRegistration( |
| 106 ServiceWorkerStatusCode status, | 110 ServiceWorkerStatusCode status, |
| 107 scoped_refptr<ServiceWorkerRegistration> registration); | 111 scoped_refptr<ServiceWorkerRegistration> registration); |
| 108 void ContinueWithUpdate( | 112 void ContinueWithUpdate( |
| 109 ServiceWorkerStatusCode status, | 113 ServiceWorkerStatusCode status, |
| 110 scoped_refptr<ServiceWorkerRegistration> registration); | 114 scoped_refptr<ServiceWorkerRegistration> registration); |
| 111 void RegisterAndContinue(); | 115 void RegisterAndContinue(); |
| 112 void ContinueWithUninstallingRegistration( | 116 void ContinueWithUninstallingRegistration( |
| 113 scoped_refptr<ServiceWorkerRegistration> existing_registration, | 117 scoped_refptr<ServiceWorkerRegistration> existing_registration, |
| 114 ServiceWorkerStatusCode status); | 118 ServiceWorkerStatusCode status); |
| 115 void ContinueWithRegistrationForSameScriptUrl( | 119 void ContinueWithRegistrationForSameScriptUrl( |
| 116 scoped_refptr<ServiceWorkerRegistration> existing_registration, | 120 scoped_refptr<ServiceWorkerRegistration> existing_registration, |
| 117 ServiceWorkerStatusCode status); | 121 ServiceWorkerStatusCode status); |
| 118 void UpdateAndContinue(); | 122 void UpdateAndContinue(); |
| 119 void OnStartWorkerFinished(ServiceWorkerStatusCode status); | 123 void OnStartWorkerFinished(ServiceWorkerStatusCode status); |
| 120 void OnStoreRegistrationComplete(ServiceWorkerStatusCode status); | 124 void OnStoreRegistrationComplete(ServiceWorkerStatusCode status); |
| 121 void InstallAndContinue(); | 125 void InstallAndContinue(); |
| 122 void DispatchInstallEvent(); | 126 void DispatchInstallEvent(); |
| 123 void OnInstallFinished(int request_id, | 127 void OnInstallFinished(int request_id, |
| 124 blink::WebServiceWorkerEventResult result, | 128 ServiceWorkerStatusCode status, |
| 125 bool has_fetch_handler, | 129 bool has_fetch_handler, |
| 126 base::Time dispatch_event_time); | 130 base::Time dispatch_event_time); |
| 127 void OnInstallFailed(ServiceWorkerStatusCode status); | 131 void OnInstallFailed(ServiceWorkerStatusCode status); |
| 128 void Complete(ServiceWorkerStatusCode status); | 132 void Complete(ServiceWorkerStatusCode status); |
| 129 void Complete(ServiceWorkerStatusCode status, | 133 void Complete(ServiceWorkerStatusCode status, |
| 130 const std::string& status_message); | 134 const std::string& status_message); |
| 131 void CompleteInternal(ServiceWorkerStatusCode status, | 135 void CompleteInternal(ServiceWorkerStatusCode status, |
| 132 const std::string& status_message); | 136 const std::string& status_message); |
| 133 void ResolvePromise(ServiceWorkerStatusCode status, | 137 void ResolvePromise(ServiceWorkerStatusCode status, |
| 134 const std::string& status_message, | 138 const std::string& status_message, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 160 std::string promise_resolved_status_message_; | 164 std::string promise_resolved_status_message_; |
| 161 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; | 165 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; |
| 162 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; | 166 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; |
| 163 | 167 |
| 164 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); | 168 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); |
| 165 }; | 169 }; |
| 166 | 170 |
| 167 } // namespace content | 171 } // namespace content |
| 168 | 172 |
| 169 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 173 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
| OLD | NEW |