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