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 #include "content/browser/service_worker/service_worker_registration.h" | 5 #include "content/browser/service_worker/service_worker_registration.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 class RegistrationListener : public ServiceWorkerRegistration::Listener { | 46 class RegistrationListener : public ServiceWorkerRegistration::Listener { |
47 public: | 47 public: |
48 RegistrationListener() {} | 48 RegistrationListener() {} |
49 ~RegistrationListener() { | 49 ~RegistrationListener() { |
50 if (observed_registration_.get()) | 50 if (observed_registration_.get()) |
51 observed_registration_->RemoveListener(this); | 51 observed_registration_->RemoveListener(this); |
52 } | 52 } |
53 | 53 |
54 virtual void OnVersionAttributesChanged( | 54 void OnVersionAttributesChanged( |
55 ServiceWorkerRegistration* registration, | 55 ServiceWorkerRegistration* registration, |
56 ChangedVersionAttributesMask changed_mask, | 56 ChangedVersionAttributesMask changed_mask, |
57 const ServiceWorkerRegistrationInfo& info) override { | 57 const ServiceWorkerRegistrationInfo& info) override { |
58 observed_registration_ = registration; | 58 observed_registration_ = registration; |
59 observed_changed_mask_ = changed_mask; | 59 observed_changed_mask_ = changed_mask; |
60 observed_info_ = info; | 60 observed_info_ = info; |
61 } | 61 } |
62 | 62 |
63 virtual void OnRegistrationFailed( | 63 void OnRegistrationFailed( |
64 ServiceWorkerRegistration* registration) override { | 64 ServiceWorkerRegistration* registration) override { |
65 NOTREACHED(); | 65 NOTREACHED(); |
66 } | 66 } |
67 | 67 |
68 virtual void OnRegistrationFinishedUninstalling( | 68 void OnRegistrationFinishedUninstalling( |
69 ServiceWorkerRegistration* registration) override { | 69 ServiceWorkerRegistration* registration) override { |
70 NOTREACHED(); | 70 NOTREACHED(); |
71 } | 71 } |
72 | 72 |
73 virtual void OnUpdateFound( | 73 void OnUpdateFound(ServiceWorkerRegistration* registration) override { |
74 ServiceWorkerRegistration* registration) override { | |
75 NOTREACHED(); | 74 NOTREACHED(); |
76 } | 75 } |
77 | 76 |
78 void Reset() { | 77 void Reset() { |
79 observed_registration_ = NULL; | 78 observed_registration_ = NULL; |
80 observed_changed_mask_ = ChangedVersionAttributesMask(); | 79 observed_changed_mask_ = ChangedVersionAttributesMask(); |
81 observed_info_ = ServiceWorkerRegistrationInfo(); | 80 observed_info_ = ServiceWorkerRegistrationInfo(); |
82 } | 81 } |
83 | 82 |
84 scoped_refptr<ServiceWorkerRegistration> observed_registration_; | 83 scoped_refptr<ServiceWorkerRegistration> observed_registration_; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 scoped_ptr<ServiceWorkerRegistrationHandle> handle( | 172 scoped_ptr<ServiceWorkerRegistrationHandle> handle( |
174 new ServiceWorkerRegistrationHandle(context_ptr_, | 173 new ServiceWorkerRegistrationHandle(context_ptr_, |
175 NULL, | 174 NULL, |
176 kProviderId, | 175 kProviderId, |
177 registration.get())); | 176 registration.get())); |
178 registration->NotifyRegistrationFailed(); | 177 registration->NotifyRegistrationFailed(); |
179 // Don't crash when handle gets destructed. | 178 // Don't crash when handle gets destructed. |
180 } | 179 } |
181 | 180 |
182 } // namespace content | 181 } // namespace content |
OLD | NEW |