| 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 11 matching lines...) Expand all Loading... |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "InbandTextTrackPrivateImpl.h" | 32 #include "WorkerPermissionClient.h" |
| 33 | 33 |
| 34 #include "WebInbandTextTrack.h" | 34 #include "core/workers/WorkerGlobalScope.h" |
| 35 #include "core/platform/graphics/InbandTextTrackPrivateClient.h" | |
| 36 #include "public/platform/WebString.h" | 35 #include "public/platform/WebString.h" |
| 36 #include "public/web/WebWorkerPermissionClientProxy.h" |
| 37 #include "wtf/PassOwnPtr.h" |
| 38 |
| 39 using namespace WebCore; |
| 37 | 40 |
| 38 namespace WebKit { | 41 namespace WebKit { |
| 39 | 42 |
| 40 InbandTextTrackPrivateImpl::InbandTextTrackPrivateImpl(WebInbandTextTrack* track
) | 43 PassOwnPtr<WorkerPermissionClient> WorkerPermissionClient::create(PassOwnPtr<Web
WorkerPermissionClientProxy> proxy) |
| 41 : m_track(track) | |
| 42 { | 44 { |
| 43 ASSERT(track); | 45 return adoptPtr(new WorkerPermissionClient(proxy)); |
| 44 track->setClient(this); | |
| 45 } | 46 } |
| 46 | 47 |
| 47 InbandTextTrackPrivateImpl::~InbandTextTrackPrivateImpl() | 48 WorkerPermissionClient::~WorkerPermissionClient() |
| 48 { | 49 { |
| 49 m_track->setClient(0); | |
| 50 } | 50 } |
| 51 | 51 |
| 52 void InbandTextTrackPrivateImpl::setMode(Mode mode) | 52 bool WorkerPermissionClient::allowDatabase(const WebString& name, const WebStrin
g& displayName, unsigned long estimatedSize) |
| 53 { | 53 { |
| 54 m_track->setMode(static_cast<WebInbandTextTrack::Mode>(mode)); | 54 if (!m_proxy) |
| 55 return false; |
| 56 return m_proxy->allowDatabase(name, displayName, estimatedSize); |
| 55 } | 57 } |
| 56 | 58 |
| 57 WebCore::InbandTextTrackPrivate::Mode InbandTextTrackPrivateImpl::mode() const | 59 bool WorkerPermissionClient::allowFileSystem() |
| 58 { | 60 { |
| 59 return static_cast<WebCore::InbandTextTrackPrivate::Mode>(m_track->mode()); | 61 if (!m_proxy) |
| 62 return false; |
| 63 return m_proxy->allowFileSystem(); |
| 60 } | 64 } |
| 61 | 65 |
| 62 WebCore::InbandTextTrackPrivate::Kind InbandTextTrackPrivateImpl::kind() const | 66 bool WorkerPermissionClient::allowIndexedDB(const WebString& name) |
| 63 { | 67 { |
| 64 return static_cast<WebCore::InbandTextTrackPrivate::Kind>(m_track->kind()); | 68 if (!m_proxy) |
| 69 return false; |
| 70 return m_proxy->allowIndexedDB(name); |
| 65 } | 71 } |
| 66 | 72 |
| 67 bool InbandTextTrackPrivateImpl::isClosedCaptions() const | 73 const char* WorkerPermissionClient::supplementName() |
| 68 { | 74 { |
| 69 return m_track->isClosedCaptions(); | 75 return "WorkerPermissionClient"; |
| 70 } | 76 } |
| 71 | 77 |
| 72 AtomicString InbandTextTrackPrivateImpl::label() const | 78 WorkerPermissionClient* WorkerPermissionClient::from(ExecutionContext* context) |
| 73 { | 79 { |
| 74 return m_track->label(); | 80 return static_cast<WorkerPermissionClient*>(Supplement<WorkerClients>::from(
toWorkerGlobalScope(context)->clients(), supplementName())); |
| 75 } | 81 } |
| 76 | 82 |
| 77 AtomicString InbandTextTrackPrivateImpl::language() const | 83 WorkerPermissionClient::WorkerPermissionClient(PassOwnPtr<WebWorkerPermissionCli
entProxy> proxy) |
| 84 : m_proxy(proxy) |
| 78 { | 85 { |
| 79 return m_track->language(); | |
| 80 } | 86 } |
| 81 | 87 |
| 82 bool InbandTextTrackPrivateImpl::isDefault() const | 88 void providePermissionClientToWorker(WorkerClients* clients, PassOwnPtr<WebWorke
rPermissionClientProxy> proxy) |
| 83 { | 89 { |
| 84 return m_track->isDefault(); | 90 WorkerPermissionClient::provideTo(clients, WorkerPermissionClient::supplemen
tName(), WorkerPermissionClient::create(proxy)); |
| 85 } | |
| 86 | |
| 87 int InbandTextTrackPrivateImpl::textTrackIndex() const | |
| 88 { | |
| 89 return m_track->textTrackIndex(); | |
| 90 } | |
| 91 | |
| 92 void InbandTextTrackPrivateImpl::addWebVTTCue( | |
| 93 double start, | |
| 94 double end, | |
| 95 const WebString& id, | |
| 96 const WebString& content, | |
| 97 const WebString& settings) | |
| 98 { | |
| 99 client()->addWebVTTCue(this, start, end, id, content, settings); | |
| 100 } | 91 } |
| 101 | 92 |
| 102 } // namespace WebKit | 93 } // namespace WebKit |
| OLD | NEW |