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

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 OnRegistrationDeleted(
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_; }
(...skipping 25 matching lines...) Expand all
75 // If version is the installing, waiting, active version of this 77 // If version is the installing, waiting, active version of this
76 // registation, the method will reset that field to NULL, and notify 78 // registation, the method will reset that field to NULL, and notify
77 // listeners via OnVersionAttributesChanged. 79 // listeners via OnVersionAttributesChanged.
78 void UnsetVersion(ServiceWorkerVersion* version); 80 void UnsetVersion(ServiceWorkerVersion* version);
79 81
80 // Triggers the [[Activate]] algorithm when the currently active version 82 // Triggers the [[Activate]] algorithm when the currently active version
81 // has no controllees. If there are no controllees at the time the method 83 // has no controllees. If there are no controllees at the time the method
82 // is called, activation is initiated immediately. 84 // is called, activation is initiated immediately.
83 void ActivateWaitingVersionWhenReady(); 85 void ActivateWaitingVersionWhenReady();
84 86
87 // Sets |is_deleted_| and notify listeners via OnRegistrationDeleted.
88 void SetIsDeleted();
89
85 bool is_deleted() const { return is_deleted_; } 90 bool is_deleted() const { return is_deleted_; }
86 void set_is_deleted() { is_deleted_ = true; }
87 91
88 private: 92 private:
89 friend class base::RefCounted<ServiceWorkerRegistration>; 93 friend class base::RefCounted<ServiceWorkerRegistration>;
90 94
91 virtual ~ServiceWorkerRegistration(); 95 virtual ~ServiceWorkerRegistration();
92 96
93 void SetVersionInternal( 97 void SetVersionInternal(
94 ServiceWorkerVersion* version, 98 ServiceWorkerVersion* version,
95 scoped_refptr<ServiceWorkerVersion>* data_member, 99 scoped_refptr<ServiceWorkerVersion>* data_member,
96 int change_flag); 100 int change_flag);
(...skipping 20 matching lines...) Expand all
117 scoped_refptr<ServiceWorkerVersion> active_version_; 121 scoped_refptr<ServiceWorkerVersion> active_version_;
118 scoped_refptr<ServiceWorkerVersion> waiting_version_; 122 scoped_refptr<ServiceWorkerVersion> waiting_version_;
119 scoped_refptr<ServiceWorkerVersion> installing_version_; 123 scoped_refptr<ServiceWorkerVersion> installing_version_;
120 ObserverList<Listener> listeners_; 124 ObserverList<Listener> listeners_;
121 base::WeakPtr<ServiceWorkerContextCore> context_; 125 base::WeakPtr<ServiceWorkerContextCore> context_;
122 126
123 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); 127 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
124 }; 128 };
125 } // namespace content 129 } // namespace content
126 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 130 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698