Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Side by Side Diff: content/browser/service_worker/service_worker_registration.h

Issue 2451373003: service worker: Implement NavigationPreloadManager.setHeaderValue (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 ServiceWorkerVersion* installing_version() const { 90 ServiceWorkerVersion* installing_version() const {
91 return installing_version_.get(); 91 return installing_version_.get();
92 } 92 }
93 93
94 bool has_installed_version() const { 94 bool has_installed_version() const {
95 return active_version() || waiting_version(); 95 return active_version() || waiting_version();
96 } 96 }
97 97
98 bool is_navigation_preload_enabled() const { 98 bool is_navigation_preload_enabled() const {
99 return is_navigation_preload_enabled_; 99 return navigation_preload_state_.enabled;
100 }
101
102 const std::string& navigation_preload_header() const {
103 return navigation_preload_state_.header;
100 } 104 }
101 105
102 ServiceWorkerVersion* GetNewestVersion() const; 106 ServiceWorkerVersion* GetNewestVersion() const;
103 107
104 void AddListener(Listener* listener); 108 void AddListener(Listener* listener);
105 void RemoveListener(Listener* listener); 109 void RemoveListener(Listener* listener);
106 void NotifyRegistrationFailed(); 110 void NotifyRegistrationFailed();
107 void NotifyUpdateFound(); 111 void NotifyUpdateFound();
108 void NotifyVersionAttributesChanged(ChangedVersionAttributesMask mask); 112 void NotifyVersionAttributesChanged(ChangedVersionAttributesMask mask);
109 113
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // registration from storage if there is no longer a stored version. 152 // registration from storage if there is no longer a stored version.
149 void DeleteVersion(const scoped_refptr<ServiceWorkerVersion>& version); 153 void DeleteVersion(const scoped_refptr<ServiceWorkerVersion>& version);
150 154
151 void RegisterRegistrationFinishedCallback(const base::Closure& callback); 155 void RegisterRegistrationFinishedCallback(const base::Closure& callback);
152 void NotifyRegistrationFinished(); 156 void NotifyRegistrationFinished();
153 157
154 void SetTaskRunnerForTest( 158 void SetTaskRunnerForTest(
155 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 159 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
156 160
157 void EnableNavigationPreload(bool enable); 161 void EnableNavigationPreload(bool enable);
162 void SetNavigationPreloadHeader(const std::string& value);
158 163
159 private: 164 private:
160 friend class base::RefCounted<ServiceWorkerRegistration>; 165 friend class base::RefCounted<ServiceWorkerRegistration>;
161 166
162 ~ServiceWorkerRegistration() override; 167 ~ServiceWorkerRegistration() override;
163 168
164 void UnsetVersionInternal( 169 void UnsetVersionInternal(
165 ServiceWorkerVersion* version, 170 ServiceWorkerVersion* version,
166 ChangedVersionAttributesMask* mask); 171 ChangedVersionAttributesMask* mask);
167 172
(...skipping 23 matching lines...) Expand all
191 void OnRestoreFinished(const StatusCallback& callback, 196 void OnRestoreFinished(const StatusCallback& callback,
192 scoped_refptr<ServiceWorkerVersion> version, 197 scoped_refptr<ServiceWorkerVersion> version,
193 ServiceWorkerStatusCode status); 198 ServiceWorkerStatusCode status);
194 199
195 const GURL pattern_; 200 const GURL pattern_;
196 const int64_t registration_id_; 201 const int64_t registration_id_;
197 bool is_deleted_; 202 bool is_deleted_;
198 bool is_uninstalling_; 203 bool is_uninstalling_;
199 bool is_uninstalled_; 204 bool is_uninstalled_;
200 bool should_activate_when_ready_; 205 bool should_activate_when_ready_;
201 bool is_navigation_preload_enabled_; 206 NavigationPreloadState navigation_preload_state_;
202 base::Time last_update_check_; 207 base::Time last_update_check_;
203 int64_t resources_total_size_bytes_; 208 int64_t resources_total_size_bytes_;
204 209
205 // This registration is the primary owner of these versions. 210 // This registration is the primary owner of these versions.
206 scoped_refptr<ServiceWorkerVersion> active_version_; 211 scoped_refptr<ServiceWorkerVersion> active_version_;
207 scoped_refptr<ServiceWorkerVersion> waiting_version_; 212 scoped_refptr<ServiceWorkerVersion> waiting_version_;
208 scoped_refptr<ServiceWorkerVersion> installing_version_; 213 scoped_refptr<ServiceWorkerVersion> installing_version_;
209 214
210 base::ObserverList<Listener> listeners_; 215 base::ObserverList<Listener> listeners_;
211 std::vector<base::Closure> registration_finished_callbacks_; 216 std::vector<base::Closure> registration_finished_callbacks_;
212 base::WeakPtr<ServiceWorkerContextCore> context_; 217 base::WeakPtr<ServiceWorkerContextCore> context_;
213 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 218 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
214 219
215 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); 220 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
216 }; 221 };
217 222
218 } // namespace content 223 } // namespace content
219 224
220 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 225 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698