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 added to the existing clients when deciding in which |
50 // registration job. | 50 // process to create the Service Worker instance. If there are no existing |
| 51 // clients, a new RenderProcessHost will be created. |
51 void AddCallback(const RegistrationCallback& callback, int process_id); | 52 void AddCallback(const RegistrationCallback& callback, int process_id); |
52 | 53 |
53 // ServiceWorkerRegisterJobBase implementation: | 54 // ServiceWorkerRegisterJobBase implementation: |
54 virtual void Start() OVERRIDE; | 55 virtual void Start() OVERRIDE; |
55 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; | 56 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; |
56 virtual RegistrationJobType GetType() OVERRIDE; | 57 virtual RegistrationJobType GetType() OVERRIDE; |
57 | 58 |
58 private: | 59 private: |
59 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerRegisterJobAndProviderHostTest, | 60 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerRegisterJobAndProviderHostTest, |
60 AssociatePendingVersionToDocuments); | 61 AssociatePendingVersionToDocuments); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; | 121 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; |
121 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_; | 122 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_; |
122 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; | 123 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; |
123 | 124 |
124 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); | 125 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); |
125 }; | 126 }; |
126 | 127 |
127 } // namespace content | 128 } // namespace content |
128 | 129 |
129 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 130 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
OLD | NEW |