OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/serviceworkers/ServiceWorkerClients.h" | 5 #include "modules/serviceworkers/ServiceWorkerClients.h" |
6 | 6 |
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class ClientArray { | 29 class ClientArray { |
30 public: | 30 public: |
31 using WebType = const WebServiceWorkerClientsInfo&; | 31 using WebType = const WebServiceWorkerClientsInfo&; |
32 static HeapVector<Member<ServiceWorkerClient>> take( | 32 static HeapVector<Member<ServiceWorkerClient>> take( |
33 ScriptPromiseResolver*, | 33 ScriptPromiseResolver*, |
34 const WebServiceWorkerClientsInfo& webClients) { | 34 const WebServiceWorkerClientsInfo& webClients) { |
35 HeapVector<Member<ServiceWorkerClient>> clients; | 35 HeapVector<Member<ServiceWorkerClient>> clients; |
36 for (size_t i = 0; i < webClients.clients.size(); ++i) { | 36 for (size_t i = 0; i < webClients.clients.size(); ++i) { |
37 const WebServiceWorkerClientInfo& client = webClients.clients[i]; | 37 const WebServiceWorkerClientInfo& client = webClients.clients[i]; |
38 if (client.clientType == WebServiceWorkerClientTypeWindow) | 38 if (client.clientType == WebServiceWorkerClientTypeWindow) |
39 clients.append(ServiceWorkerWindowClient::create(client)); | 39 clients.push_back(ServiceWorkerWindowClient::create(client)); |
40 else | 40 else |
41 clients.append(ServiceWorkerClient::create(client)); | 41 clients.push_back(ServiceWorkerClient::create(client)); |
42 } | 42 } |
43 return clients; | 43 return clients; |
44 } | 44 } |
45 | 45 |
46 private: | 46 private: |
47 WTF_MAKE_NONCOPYABLE(ClientArray); | 47 WTF_MAKE_NONCOPYABLE(ClientArray); |
48 ClientArray() = delete; | 48 ClientArray() = delete; |
49 }; | 49 }; |
50 | 50 |
51 WebServiceWorkerClientType getClientType(const String& type) { | 51 WebServiceWorkerClientType getClientType(const String& type) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 return promise; | 185 return promise; |
186 } | 186 } |
187 context->consumeWindowInteraction(); | 187 context->consumeWindowInteraction(); |
188 | 188 |
189 ServiceWorkerGlobalScopeClient::from(context)->openWindow( | 189 ServiceWorkerGlobalScopeClient::from(context)->openWindow( |
190 parsedUrl, WTF::makeUnique<NavigateClientCallback>(resolver)); | 190 parsedUrl, WTF::makeUnique<NavigateClientCallback>(resolver)); |
191 return promise; | 191 return promise; |
192 } | 192 } |
193 | 193 |
194 } // namespace blink | 194 } // namespace blink |
OLD | NEW |