| 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 "web/WorkerPermissionClient.h" | 32 #include "web/WorkerContentSettingsClient.h" |
| 33 | 33 |
| 34 #include "core/workers/WorkerGlobalScope.h" | 34 #include "core/workers/WorkerGlobalScope.h" |
| 35 #include "public/platform/WebPermissionCallbacks.h" | 35 #include "public/platform/WebPermissionCallbacks.h" |
| 36 #include "public/platform/WebString.h" | 36 #include "public/platform/WebString.h" |
| 37 #include "public/web/WebWorkerPermissionClientProxy.h" | 37 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
| 38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 PassOwnPtrWillBeRawPtr<WorkerPermissionClient> WorkerPermissionClient::create(Pa
ssOwnPtr<WebWorkerPermissionClientProxy> proxy) | 42 PassOwnPtrWillBeRawPtr<WorkerContentSettingsClient> WorkerContentSettingsClient:
:create(PassOwnPtr<WebWorkerContentSettingsClientProxy> proxy) |
| 43 { | 43 { |
| 44 return adoptPtrWillBeNoop(new WorkerPermissionClient(proxy)); | 44 return adoptPtrWillBeNoop(new WorkerContentSettingsClient(proxy)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 WorkerPermissionClient::~WorkerPermissionClient() | 47 WorkerContentSettingsClient::~WorkerContentSettingsClient() |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool WorkerPermissionClient::requestFileSystemAccessSync() | 51 bool WorkerContentSettingsClient::requestFileSystemAccessSync() |
| 52 { | 52 { |
| 53 if (!m_proxy) | 53 if (!m_proxy) |
| 54 return true; | 54 return true; |
| 55 return m_proxy->requestFileSystemAccessSync(); | 55 return m_proxy->requestFileSystemAccessSync(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool WorkerPermissionClient::allowIndexedDB(const WebString& name) | 58 bool WorkerContentSettingsClient::allowIndexedDB(const WebString& name) |
| 59 { | 59 { |
| 60 if (!m_proxy) | 60 if (!m_proxy) |
| 61 return true; | 61 return true; |
| 62 return m_proxy->allowIndexedDB(name); | 62 return m_proxy->allowIndexedDB(name); |
| 63 } | 63 } |
| 64 | 64 |
| 65 const char* WorkerPermissionClient::supplementName() | 65 const char* WorkerContentSettingsClient::supplementName() |
| 66 { | 66 { |
| 67 return "WorkerPermissionClient"; | 67 return "WorkerContentSettingsClient"; |
| 68 } | 68 } |
| 69 | 69 |
| 70 WorkerPermissionClient* WorkerPermissionClient::from(ExecutionContext& context) | 70 WorkerContentSettingsClient* WorkerContentSettingsClient::from(ExecutionContext&
context) |
| 71 { | 71 { |
| 72 WorkerClients* clients = toWorkerGlobalScope(context).clients(); | 72 WorkerClients* clients = toWorkerGlobalScope(context).clients(); |
| 73 ASSERT(clients); | 73 ASSERT(clients); |
| 74 return static_cast<WorkerPermissionClient*>(WillBeHeapSupplement<WorkerClien
ts>::from(*clients, supplementName())); | 74 return static_cast<WorkerContentSettingsClient*>(WillBeHeapSupplement<Worker
Clients>::from(*clients, supplementName())); |
| 75 } | 75 } |
| 76 | 76 |
| 77 WorkerPermissionClient::WorkerPermissionClient(PassOwnPtr<WebWorkerPermissionCli
entProxy> proxy) | 77 WorkerContentSettingsClient::WorkerContentSettingsClient(PassOwnPtr<WebWorkerCon
tentSettingsClientProxy> proxy) |
| 78 : m_proxy(proxy) | 78 : m_proxy(proxy) |
| 79 { | 79 { |
| 80 } | 80 } |
| 81 | 81 |
| 82 void providePermissionClientToWorker(WorkerClients* clients, PassOwnPtr<WebWorke
rPermissionClientProxy> proxy) | 82 void provideContentSettingsClientToWorker(WorkerClients* clients, PassOwnPtr<Web
WorkerContentSettingsClientProxy> proxy) |
| 83 { | 83 { |
| 84 ASSERT(clients); | 84 ASSERT(clients); |
| 85 WorkerPermissionClient::provideTo(*clients, WorkerPermissionClient::suppleme
ntName(), WorkerPermissionClient::create(proxy)); | 85 WorkerContentSettingsClient::provideTo(*clients, WorkerContentSettingsClient
::supplementName(), WorkerContentSettingsClient::create(proxy)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |