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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void UnsetVersion(ServiceWorkerVersion* version); | 81 void UnsetVersion(ServiceWorkerVersion* version); |
82 | 82 |
83 // Triggers the [[Activate]] algorithm when the currently active version | 83 // Triggers the [[Activate]] algorithm when the currently active version |
84 // has no controllees. If there are no controllees at the time the method | 84 // has no controllees. If there are no controllees at the time the method |
85 // is called, activation is initiated immediately. | 85 // is called, activation is initiated immediately. |
86 void ActivateWaitingVersionWhenReady(); | 86 void ActivateWaitingVersionWhenReady(); |
87 | 87 |
88 bool is_deleted() const { return is_deleted_; } | 88 bool is_deleted() const { return is_deleted_; } |
89 void set_is_deleted() { is_deleted_ = true; } | 89 void set_is_deleted() { is_deleted_ = true; } |
90 | 90 |
| 91 // The time of the most recent update check. |
| 92 base::Time last_update_check() const { return last_update_check_; } |
| 93 void set_last_update_check(base::Time last) { last_update_check_ = last; } |
| 94 |
91 private: | 95 private: |
92 friend class base::RefCounted<ServiceWorkerRegistration>; | 96 friend class base::RefCounted<ServiceWorkerRegistration>; |
93 | 97 |
94 virtual ~ServiceWorkerRegistration(); | 98 virtual ~ServiceWorkerRegistration(); |
95 | 99 |
96 void SetVersionInternal( | 100 void SetVersionInternal( |
97 ServiceWorkerVersion* version, | 101 ServiceWorkerVersion* version, |
98 scoped_refptr<ServiceWorkerVersion>* data_member, | 102 scoped_refptr<ServiceWorkerVersion>* data_member, |
99 int change_flag); | 103 int change_flag); |
100 void UnsetVersionInternal( | 104 void UnsetVersionInternal( |
101 ServiceWorkerVersion* version, | 105 ServiceWorkerVersion* version, |
102 ChangedVersionAttributesMask* mask); | 106 ChangedVersionAttributesMask* mask); |
103 | 107 |
104 // ServiceWorkerVersion::Listener override. | 108 // ServiceWorkerVersion::Listener override. |
105 virtual void OnNoControllees(ServiceWorkerVersion* version) OVERRIDE; | 109 virtual void OnNoControllees(ServiceWorkerVersion* version) OVERRIDE; |
106 | 110 |
107 // This method corresponds to the [[Activate]] algorithm. | 111 // This method corresponds to the [[Activate]] algorithm. |
108 void ActivateWaitingVersion(); | 112 void ActivateWaitingVersion(); |
109 void OnActivateEventFinished( | 113 void OnActivateEventFinished( |
110 ServiceWorkerVersion* activating_version, | 114 ServiceWorkerVersion* activating_version, |
111 ServiceWorkerStatusCode status); | 115 ServiceWorkerStatusCode status); |
112 void ResetShouldActivateWhenReady(); | 116 void ResetShouldActivateWhenReady(); |
113 void OnDeleteFinished(ServiceWorkerStatusCode status); | 117 void OnDeleteFinished(ServiceWorkerStatusCode status); |
114 | 118 |
115 const GURL pattern_; | 119 const GURL pattern_; |
116 const GURL script_url_; | 120 const GURL script_url_; |
117 const int64 registration_id_; | 121 const int64 registration_id_; |
118 bool is_deleted_; | 122 bool is_deleted_; |
119 bool should_activate_when_ready_; | 123 bool should_activate_when_ready_; |
| 124 base::Time last_update_check_; |
120 scoped_refptr<ServiceWorkerVersion> active_version_; | 125 scoped_refptr<ServiceWorkerVersion> active_version_; |
121 scoped_refptr<ServiceWorkerVersion> waiting_version_; | 126 scoped_refptr<ServiceWorkerVersion> waiting_version_; |
122 scoped_refptr<ServiceWorkerVersion> installing_version_; | 127 scoped_refptr<ServiceWorkerVersion> installing_version_; |
123 ObserverList<Listener> listeners_; | 128 ObserverList<Listener> listeners_; |
124 base::WeakPtr<ServiceWorkerContextCore> context_; | 129 base::WeakPtr<ServiceWorkerContextCore> context_; |
125 | 130 |
126 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); | 131 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); |
127 }; | 132 }; |
128 } // namespace content | 133 } // namespace content |
129 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ | 134 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
OLD | NEW |