| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/serviceworkers/ServiceWorkerClients.h" | 6 #include "modules/serviceworkers/ServiceWorkerClients.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 ServiceWorkerClients* ServiceWorkerClients::create() | 48 ServiceWorkerClients* ServiceWorkerClients::create() |
| 49 { | 49 { |
| 50 return new ServiceWorkerClients(); | 50 return new ServiceWorkerClients(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 ServiceWorkerClients::ServiceWorkerClients() | 53 ServiceWorkerClients::ServiceWorkerClients() |
| 54 { | 54 { |
| 55 } | 55 } |
| 56 | 56 |
| 57 ScriptPromise ServiceWorkerClients::getAll(ScriptState* scriptState, const Clien
tQueryOptions& options) | 57 ScriptPromise ServiceWorkerClients::matchAll(ScriptState* scriptState, const Cli
entQueryOptions& options) |
| 58 { | 58 { |
| 59 ExecutionContext* executionContext = scriptState->executionContext(); | 59 ExecutionContext* executionContext = scriptState->executionContext(); |
| 60 // FIXME: May be null due to worker termination: http://crbug.com/413518. | 60 // FIXME: May be null due to worker termination: http://crbug.com/413518. |
| 61 if (!executionContext) | 61 if (!executionContext) |
| 62 return ScriptPromise(); | 62 return ScriptPromise(); |
| 63 | 63 |
| 64 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); | 64 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); |
| 65 ScriptPromise promise = resolver->promise(); | 65 ScriptPromise promise = resolver->promise(); |
| 66 | 66 |
| 67 if (options.includeUncontrolled()) { | 67 if (options.includeUncontrolled()) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 resolver->reject(DOMException::create(InvalidAccessError, "Not allowed t
o open a window.")); | 117 resolver->reject(DOMException::create(InvalidAccessError, "Not allowed t
o open a window.")); |
| 118 return promise; | 118 return promise; |
| 119 } | 119 } |
| 120 context->consumeWindowInteraction(); | 120 context->consumeWindowInteraction(); |
| 121 | 121 |
| 122 ServiceWorkerGlobalScopeClient::from(context)->openWindow(parsedUrl, new Cal
lbackPromiseAdapter<ServiceWorkerWindowClient, ServiceWorkerError>(resolver)); | 122 ServiceWorkerGlobalScopeClient::from(context)->openWindow(parsedUrl, new Cal
lbackPromiseAdapter<ServiceWorkerWindowClient, ServiceWorkerError>(resolver)); |
| 123 return promise; | 123 return promise; |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace blink | 126 } // namespace blink |
| OLD | NEW |