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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 virtual ~ServiceWorkerRegisterJob(); | 54 virtual ~ServiceWorkerRegisterJob(); |
55 | 55 |
56 // Registers a callback to be called when the promise would resolve (whether | 56 // Registers a callback to be called when the promise would resolve (whether |
57 // successfully or not). Multiple callbacks may be registered. | 57 // successfully or not). Multiple callbacks may be registered. |
58 // If |provider_host| is not NULL, its process will be regarded as a candidate | 58 // If |provider_host| is not NULL, its process will be regarded as a candidate |
59 // process to run the worker. | 59 // process to run the worker. |
60 void AddCallback(const RegistrationCallback& callback, | 60 void AddCallback(const RegistrationCallback& callback, |
61 ServiceWorkerProviderHost* provider_host); | 61 ServiceWorkerProviderHost* provider_host); |
62 | 62 |
63 // ServiceWorkerRegisterJobBase implementation: | 63 // ServiceWorkerRegisterJobBase implementation: |
64 virtual void Start() OVERRIDE; | 64 virtual void Start() override; |
65 virtual void Abort() OVERRIDE; | 65 virtual void Abort() override; |
66 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; | 66 virtual bool Equals(ServiceWorkerRegisterJobBase* job) override; |
67 virtual RegistrationJobType GetType() OVERRIDE; | 67 virtual RegistrationJobType GetType() override; |
68 | 68 |
69 private: | 69 private: |
70 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, | 70 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, |
71 AssociateInstallingVersionToDocuments); | 71 AssociateInstallingVersionToDocuments); |
72 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, | 72 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, |
73 DisassociateVersionFromDocuments); | 73 DisassociateVersionFromDocuments); |
74 | 74 |
75 enum Phase { | 75 enum Phase { |
76 INITIAL, | 76 INITIAL, |
77 START, | 77 START, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void InstallAndContinue(); | 127 void InstallAndContinue(); |
128 void OnInstallFinished(ServiceWorkerStatusCode status); | 128 void OnInstallFinished(ServiceWorkerStatusCode status); |
129 void ActivateAndContinue(); | 129 void ActivateAndContinue(); |
130 void OnActivateFinished(ServiceWorkerStatusCode status); | 130 void OnActivateFinished(ServiceWorkerStatusCode status); |
131 void Complete(ServiceWorkerStatusCode status); | 131 void Complete(ServiceWorkerStatusCode status); |
132 void CompleteInternal(ServiceWorkerStatusCode status); | 132 void CompleteInternal(ServiceWorkerStatusCode status); |
133 void ResolvePromise(ServiceWorkerStatusCode status, | 133 void ResolvePromise(ServiceWorkerStatusCode status, |
134 ServiceWorkerRegistration* registration); | 134 ServiceWorkerRegistration* registration); |
135 | 135 |
136 // EmbeddedWorkerInstance::Listener override of OnPausedAfterDownload. | 136 // EmbeddedWorkerInstance::Listener override of OnPausedAfterDownload. |
137 virtual void OnPausedAfterDownload() OVERRIDE; | 137 virtual void OnPausedAfterDownload() override; |
138 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 138 virtual bool OnMessageReceived(const IPC::Message& message) override; |
139 | 139 |
140 // ServiceWorkerRegistration::Listener overrides | 140 // ServiceWorkerRegistration::Listener overrides |
141 virtual void OnRegistrationFinishedUninstalling( | 141 virtual void OnRegistrationFinishedUninstalling( |
142 ServiceWorkerRegistration* registration) OVERRIDE; | 142 ServiceWorkerRegistration* registration) override; |
143 | 143 |
144 void OnCompareScriptResourcesComplete( | 144 void OnCompareScriptResourcesComplete( |
145 ServiceWorkerStatusCode status, | 145 ServiceWorkerStatusCode status, |
146 bool are_equal); | 146 bool are_equal); |
147 | 147 |
148 void AssociateProviderHostsToRegistration( | 148 void AssociateProviderHostsToRegistration( |
149 ServiceWorkerRegistration* registration); | 149 ServiceWorkerRegistration* registration); |
150 | 150 |
151 // The ServiceWorkerContextCore object should always outlive this. | 151 // The ServiceWorkerContextCore object should always outlive this. |
152 base::WeakPtr<ServiceWorkerContextCore> context_; | 152 base::WeakPtr<ServiceWorkerContextCore> context_; |
153 | 153 |
154 RegistrationJobType job_type_; | 154 RegistrationJobType job_type_; |
155 const GURL pattern_; | 155 const GURL pattern_; |
156 const GURL script_url_; | 156 const GURL script_url_; |
157 std::vector<RegistrationCallback> callbacks_; | 157 std::vector<RegistrationCallback> callbacks_; |
158 Phase phase_; | 158 Phase phase_; |
159 Internal internal_; | 159 Internal internal_; |
160 bool is_promise_resolved_; | 160 bool is_promise_resolved_; |
161 ServiceWorkerStatusCode promise_resolved_status_; | 161 ServiceWorkerStatusCode promise_resolved_status_; |
162 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; | 162 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; |
163 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; | 163 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; |
164 | 164 |
165 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); | 165 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); |
166 }; | 166 }; |
167 | 167 |
168 } // namespace content | 168 } // namespace content |
169 | 169 |
170 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 170 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
OLD | NEW |