OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 resolver->reject(DOMException::create(SecurityError, "Can only unregiste
r for patterns in the document's origin.")); | 135 resolver->reject(DOMException::create(SecurityError, "Can only unregiste
r for patterns in the document's origin.")); |
136 return promise; | 136 return promise; |
137 } | 137 } |
138 | 138 |
139 m_provider->unregisterServiceWorker(patternURL, new CallbackPromiseAdapter<U
ndefinedValue, ServiceWorkerError>(resolver)); | 139 m_provider->unregisterServiceWorker(patternURL, new CallbackPromiseAdapter<U
ndefinedValue, ServiceWorkerError>(resolver)); |
140 return promise; | 140 return promise; |
141 } | 141 } |
142 | 142 |
143 void ServiceWorkerContainer::setCurrentServiceWorker(blink::WebServiceWorker* se
rviceWorker) | 143 void ServiceWorkerContainer::setCurrentServiceWorker(blink::WebServiceWorker* se
rviceWorker) |
144 { | 144 { |
| 145 setController(serviceWorker); |
| 146 } |
| 147 |
| 148 void ServiceWorkerContainer::setController(blink::WebServiceWorker* serviceWorke
r) |
| 149 { |
145 if (!executionContext()) { | 150 if (!executionContext()) { |
146 delete serviceWorker; | 151 delete serviceWorker; |
147 return; | 152 return; |
148 } | 153 } |
149 m_current = ServiceWorker::create(executionContext(), adoptPtr(serviceWorker
)); | 154 m_controller = ServiceWorker::create(executionContext(), adoptPtr(serviceWor
ker)); |
150 } | 155 } |
151 | 156 |
152 void ServiceWorkerContainer::dispatchMessageEvent(const blink::WebString& messag
e, const blink::WebMessagePortChannelArray& webChannels) | 157 void ServiceWorkerContainer::dispatchMessageEvent(const blink::WebString& messag
e, const blink::WebMessagePortChannelArray& webChannels) |
153 { | 158 { |
154 if (!executionContext() || !window()) | 159 if (!executionContext() || !window()) |
155 return; | 160 return; |
156 | 161 |
157 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(executionCo
ntext(), webChannels); | 162 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(executionCo
ntext(), webChannels); |
158 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(
message); | 163 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(
message); |
159 window()->dispatchEvent(MessageEvent::create(ports.release(), value)); | 164 window()->dispatchEvent(MessageEvent::create(ports.release(), value)); |
(...skipping 10 matching lines...) Expand all Loading... |
170 return; | 175 return; |
171 | 176 |
172 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { | 177 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { |
173 m_provider = client->provider(); | 178 m_provider = client->provider(); |
174 if (m_provider) | 179 if (m_provider) |
175 m_provider->setClient(this); | 180 m_provider->setClient(this); |
176 } | 181 } |
177 } | 182 } |
178 | 183 |
179 } // namespace WebCore | 184 } // namespace WebCore |
OLD | NEW |