Chromium Code Reviews| 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 // Deprecated, please use matchAll instead | |
|
falken
2015/02/13 10:15:59
nit: add a period
zhuoyu.qian
2015/02/13 10:47:05
Done.
| |
| 57 ScriptPromise ServiceWorkerClients::getAll(ScriptState* scriptState, const Clien tQueryOptions& options) | 58 ScriptPromise ServiceWorkerClients::getAll(ScriptState* scriptState, const Clien tQueryOptions& options) |
| 58 { | 59 { |
| 60 return matchAll(scriptState, options); | |
| 61 } | |
| 62 | |
| 63 ScriptPromise ServiceWorkerClients::matchAll(ScriptState* scriptState, const Cli entQueryOptions& options) | |
| 64 { | |
| 59 ExecutionContext* executionContext = scriptState->executionContext(); | 65 ExecutionContext* executionContext = scriptState->executionContext(); |
| 60 // FIXME: May be null due to worker termination: http://crbug.com/413518. | 66 // FIXME: May be null due to worker termination: http://crbug.com/413518. |
| 61 if (!executionContext) | 67 if (!executionContext) |
| 62 return ScriptPromise(); | 68 return ScriptPromise(); |
| 63 | 69 |
| 64 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); | 70 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); |
| 65 ScriptPromise promise = resolver->promise(); | 71 ScriptPromise promise = resolver->promise(); |
| 66 | 72 |
| 67 if (options.includeUncontrolled()) { | 73 if (options.includeUncontrolled()) { |
| 68 // FIXME: Currently we don't support includeUncontrolled=true. | 74 // FIXME: Currently we don't support includeUncontrolled=true. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 resolver->reject(DOMException::create(InvalidAccessError, "Not allowed t o open a window.")); | 123 resolver->reject(DOMException::create(InvalidAccessError, "Not allowed t o open a window.")); |
| 118 return promise; | 124 return promise; |
| 119 } | 125 } |
| 120 context->consumeWindowInteraction(); | 126 context->consumeWindowInteraction(); |
| 121 | 127 |
| 122 ServiceWorkerGlobalScopeClient::from(context)->openWindow(parsedUrl, new Cal lbackPromiseAdapter<ServiceWorkerWindowClient, ServiceWorkerError>(resolver)); | 128 ServiceWorkerGlobalScopeClient::from(context)->openWindow(parsedUrl, new Cal lbackPromiseAdapter<ServiceWorkerWindowClient, ServiceWorkerError>(resolver)); |
| 123 return promise; | 129 return promise; |
| 124 } | 130 } |
| 125 | 131 |
| 126 } // namespace blink | 132 } // namespace blink |
| OLD | NEW |