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 27 matching lines...) Expand all Loading... |
38 ServiceWorkerVersion* version)> | 38 ServiceWorkerVersion* version)> |
39 RegistrationCallback; | 39 RegistrationCallback; |
40 | 40 |
41 CONTENT_EXPORT ServiceWorkerRegisterJob( | 41 CONTENT_EXPORT ServiceWorkerRegisterJob( |
42 base::WeakPtr<ServiceWorkerContextCore> context, | 42 base::WeakPtr<ServiceWorkerContextCore> context, |
43 const GURL& pattern, | 43 const GURL& pattern, |
44 const GURL& script_url); | 44 const GURL& script_url); |
45 virtual ~ServiceWorkerRegisterJob(); | 45 virtual ~ServiceWorkerRegisterJob(); |
46 | 46 |
47 // Registers a callback to be called when the promise would resolve (whether | 47 // Registers a callback to be called when the promise would resolve (whether |
48 // successfully or not). Multiple callbacks may be registered. |process_id| is | 48 // successfully or not). Multiple callbacks may be registered. If |process_id| |
49 // added via AddProcessToWorker to the ServiceWorkerVersion created by the | 49 // is not -1, it's used to create the Service Worker instance if there are no |
50 // registration job. | 50 // other clients. If it is -1, the registration must have been started from |
| 51 // ServiceWorkerContextWrapper::RegisterServiceWorker(browser_context), and |
| 52 // that browser_context will be used to create a process if there are no |
| 53 // existing clients. |
51 void AddCallback(const RegistrationCallback& callback, int process_id); | 54 void AddCallback(const RegistrationCallback& callback, int process_id); |
52 | 55 |
53 // ServiceWorkerRegisterJobBase implementation: | 56 // ServiceWorkerRegisterJobBase implementation: |
54 virtual void Start() OVERRIDE; | 57 virtual void Start() OVERRIDE; |
55 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; | 58 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; |
56 virtual RegistrationJobType GetType() OVERRIDE; | 59 virtual RegistrationJobType GetType() OVERRIDE; |
57 | 60 |
58 private: | 61 private: |
59 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerRegisterJobAndProviderHostTest, | 62 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerRegisterJobAndProviderHostTest, |
60 AssociatePendingVersionToDocuments); | 63 AssociatePendingVersionToDocuments); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; | 123 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; |
121 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_; | 124 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_; |
122 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; | 125 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; |
123 | 126 |
124 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); | 127 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); |
125 }; | 128 }; |
126 | 129 |
127 } // namespace content | 130 } // namespace content |
128 | 131 |
129 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 132 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
OLD | NEW |