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_REGISTRATION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 class Listener { | 32 class Listener { |
33 public: | 33 public: |
34 virtual void OnVersionAttributesChanged( | 34 virtual void OnVersionAttributesChanged( |
35 ServiceWorkerRegistration* registration, | 35 ServiceWorkerRegistration* registration, |
36 ChangedVersionAttributesMask changed_mask, | 36 ChangedVersionAttributesMask changed_mask, |
37 const ServiceWorkerRegistrationInfo& info) {} | 37 const ServiceWorkerRegistrationInfo& info) {} |
38 virtual void OnRegistrationFailed( | 38 virtual void OnRegistrationFailed( |
39 ServiceWorkerRegistration* registration) {} | 39 ServiceWorkerRegistration* registration) {} |
40 virtual void OnRegistrationFinishedUninstalling( | 40 virtual void OnRegistrationFinishedUninstalling( |
41 ServiceWorkerRegistration* registration) {} | 41 ServiceWorkerRegistration* registration) {} |
| 42 virtual void OnUpdateFound( |
| 43 ServiceWorkerRegistration* registration) {} |
42 }; | 44 }; |
43 | 45 |
44 ServiceWorkerRegistration(const GURL& pattern, | 46 ServiceWorkerRegistration(const GURL& pattern, |
45 int64 registration_id, | 47 int64 registration_id, |
46 base::WeakPtr<ServiceWorkerContextCore> context); | 48 base::WeakPtr<ServiceWorkerContextCore> context); |
47 | 49 |
48 int64 id() const { return registration_id_; } | 50 int64 id() const { return registration_id_; } |
49 const GURL& pattern() const { return pattern_; } | 51 const GURL& pattern() const { return pattern_; } |
50 | 52 |
51 bool is_deleted() const { return is_deleted_; } | 53 bool is_deleted() const { return is_deleted_; } |
(...skipping 11 matching lines...) Expand all Loading... |
63 | 65 |
64 ServiceWorkerVersion* installing_version() const { | 66 ServiceWorkerVersion* installing_version() const { |
65 return installing_version_.get(); | 67 return installing_version_.get(); |
66 } | 68 } |
67 | 69 |
68 ServiceWorkerVersion* GetNewestVersion() const; | 70 ServiceWorkerVersion* GetNewestVersion() const; |
69 | 71 |
70 void AddListener(Listener* listener); | 72 void AddListener(Listener* listener); |
71 void RemoveListener(Listener* listener); | 73 void RemoveListener(Listener* listener); |
72 void NotifyRegistrationFailed(); | 74 void NotifyRegistrationFailed(); |
| 75 void NotifyUpdateFound(); |
73 | 76 |
74 ServiceWorkerRegistrationInfo GetInfo(); | 77 ServiceWorkerRegistrationInfo GetInfo(); |
75 | 78 |
76 // Sets the corresposding version attribute and resets the position | 79 // Sets the corresposding version attribute and resets the position |
77 // (if any) left vacant (ie. by a waiting version being promoted). | 80 // (if any) left vacant (ie. by a waiting version being promoted). |
78 // Also notifies listeners via OnVersionAttributesChanged. | 81 // Also notifies listeners via OnVersionAttributesChanged. |
79 void SetActiveVersion(ServiceWorkerVersion* version); | 82 void SetActiveVersion(ServiceWorkerVersion* version); |
80 void SetWaitingVersion(ServiceWorkerVersion* version); | 83 void SetWaitingVersion(ServiceWorkerVersion* version); |
81 void SetInstallingVersion(ServiceWorkerVersion* version); | 84 void SetInstallingVersion(ServiceWorkerVersion* version); |
82 | 85 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 scoped_refptr<ServiceWorkerVersion> installing_version_; | 147 scoped_refptr<ServiceWorkerVersion> installing_version_; |
145 ObserverList<Listener> listeners_; | 148 ObserverList<Listener> listeners_; |
146 base::WeakPtr<ServiceWorkerContextCore> context_; | 149 base::WeakPtr<ServiceWorkerContextCore> context_; |
147 | 150 |
148 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); | 151 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); |
149 }; | 152 }; |
150 | 153 |
151 } // namespace content | 154 } // namespace content |
152 | 155 |
153 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ | 156 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
OLD | NEW |