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

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

Issue 417043006: ServiceWorker: Make SWProviderHost listen to SWRegistration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address michael's comments Created 6 years, 4 months 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 | Annotate | Revision Log
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 "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 18 matching lines...) Expand all
29 : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerRegistration>), 29 : NON_EXPORTED_BASE(public base::RefCounted<ServiceWorkerRegistration>),
30 public ServiceWorkerVersion::Listener { 30 public ServiceWorkerVersion::Listener {
31 public: 31 public:
32 typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback; 32 typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback;
33 33
34 class Listener { 34 class Listener {
35 public: 35 public:
36 virtual void OnVersionAttributesChanged( 36 virtual void OnVersionAttributesChanged(
37 ServiceWorkerRegistration* registration, 37 ServiceWorkerRegistration* registration,
38 ChangedVersionAttributesMask changed_mask, 38 ChangedVersionAttributesMask changed_mask,
39 const ServiceWorkerRegistrationInfo& info) = 0; 39 const ServiceWorkerRegistrationInfo& info) = 0;
40 virtual void OnRegistrationFailed(
41 ServiceWorkerRegistration* registration) = 0;
40 }; 42 };
41 43
42 ServiceWorkerRegistration(const GURL& pattern, 44 ServiceWorkerRegistration(const GURL& pattern,
43 const GURL& script_url, 45 const GURL& script_url,
44 int64 registration_id, 46 int64 registration_id,
45 base::WeakPtr<ServiceWorkerContextCore> context); 47 base::WeakPtr<ServiceWorkerContextCore> context);
46 48
47 int64 id() const { return registration_id_; } 49 int64 id() const { return registration_id_; }
48 const GURL& script_url() const { return script_url_; } 50 const GURL& script_url() const { return script_url_; }
49 const GURL& pattern() const { return pattern_; } 51 const GURL& pattern() const { return pattern_; }
50 52
51 ServiceWorkerVersion* active_version() const { 53 ServiceWorkerVersion* active_version() const {
52 return active_version_.get(); 54 return active_version_.get();
53 } 55 }
54 56
55 ServiceWorkerVersion* waiting_version() const { 57 ServiceWorkerVersion* waiting_version() const {
56 return waiting_version_.get(); 58 return waiting_version_.get();
57 } 59 }
58 60
59 ServiceWorkerVersion* installing_version() const { 61 ServiceWorkerVersion* installing_version() const {
60 return installing_version_.get(); 62 return installing_version_.get();
61 } 63 }
62 64
63 void AddListener(Listener* listener); 65 void AddListener(Listener* listener);
64 void RemoveListener(Listener* listener); 66 void RemoveListener(Listener* listener);
67 void NotifyRegistrationFailed();
65 68
66 ServiceWorkerRegistrationInfo GetInfo(); 69 ServiceWorkerRegistrationInfo GetInfo();
67 70
68 // Sets the corresposding version attribute and resets the position 71 // Sets the corresposding version attribute and resets the position
69 // (if any) left vacant (ie. by a waiting version being promoted). 72 // (if any) left vacant (ie. by a waiting version being promoted).
70 // Also notifies listeners via OnVersionAttributesChanged. 73 // Also notifies listeners via OnVersionAttributesChanged.
71 void SetActiveVersion(ServiceWorkerVersion* version); 74 void SetActiveVersion(ServiceWorkerVersion* version);
72 void SetWaitingVersion(ServiceWorkerVersion* version); 75 void SetWaitingVersion(ServiceWorkerVersion* version);
73 void SetInstallingVersion(ServiceWorkerVersion* version); 76 void SetInstallingVersion(ServiceWorkerVersion* version);
74 77
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 scoped_refptr<ServiceWorkerVersion> active_version_; 120 scoped_refptr<ServiceWorkerVersion> active_version_;
118 scoped_refptr<ServiceWorkerVersion> waiting_version_; 121 scoped_refptr<ServiceWorkerVersion> waiting_version_;
119 scoped_refptr<ServiceWorkerVersion> installing_version_; 122 scoped_refptr<ServiceWorkerVersion> installing_version_;
120 ObserverList<Listener> listeners_; 123 ObserverList<Listener> listeners_;
121 base::WeakPtr<ServiceWorkerContextCore> context_; 124 base::WeakPtr<ServiceWorkerContextCore> context_;
122 125
123 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); 126 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
124 }; 127 };
125 } // namespace content 128 } // namespace content
126 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 129 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698