| 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 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 #ifndef WorkerPermissionClient_h | 31 #ifndef WebServiceWorkerContextClient_h |
| 32 #define WorkerPermissionClient_h | 32 #define WebServiceWorkerContextClient_h |
| 33 | 33 |
| 34 #include "core/workers/WorkerClients.h" | 34 #include "WebWorkerPermissionClientProxy.h" |
| 35 #include "wtf/Forward.h" | |
| 36 | |
| 37 namespace WebCore { | |
| 38 class ExecutionContext; | |
| 39 } | |
| 40 | 35 |
| 41 namespace blink { | 36 namespace blink { |
| 42 | 37 |
| 43 class WebFrame; | |
| 44 class WebString; | 38 class WebString; |
| 45 class WebWorkerPermissionClientProxy; | 39 class WebServiceWorkerContextProxy; |
| 46 | 40 |
| 47 class WorkerPermissionClient : public WebCore::Supplement<WebCore::WorkerClients
> { | 41 // This interface is implemented by the client. It is suppoed to be created |
| 42 // on the main thread and then passed on to the worker thread to be owned |
| 43 // by a newly created WorkerGlobalScope. All methods of this class are |
| 44 // called on the worker thread. |
| 45 class WebServiceWorkerContextClient { |
| 48 public: | 46 public: |
| 49 static PassOwnPtr<WorkerPermissionClient> create(PassOwnPtr<WebWorkerPermiss
ionClientProxy>); | 47 // A new WorkerGlobalScope is created and started to run on the |
| 48 // worker thread. |
| 49 // This also gives back a proxy to the client to talk to the |
| 50 // newly created WorkerGlobalScope. The proxy is held by WorkerGlobalScope |
| 51 // and should not be held by the caller. No proxy methods should be called |
| 52 // after workerContextDestroyed() is called. |
| 53 virtual void workerContextStarted(WebServiceWorkerContextProxy*) { } |
| 50 | 54 |
| 51 virtual ~WorkerPermissionClient(); | 55 // WorkerGlobalScope.close() is called. |
| 56 virtual void workerContextClosed() { } |
| 52 | 57 |
| 53 bool allowDatabase(const WebString& name, const WebString& displayName, unsi
gned long estimatedSize); | 58 // WorkerGlobalScope is destroyed. The client should clear the |
| 54 bool allowFileSystem(); | 59 // WebServiceWorkerGlobalScopeProxy when this is called. |
| 55 bool allowIndexedDB(const WebString& name); | 60 virtual void workerContextDestroyed() { } |
| 56 | 61 |
| 57 static const char* supplementName(); | 62 virtual void dispatchDevToolsMessage(const WebString&) { } |
| 58 static WorkerPermissionClient* from(WebCore::ExecutionContext*); | 63 virtual void saveDevToolsAgentState(const WebString&) { } |
| 59 | |
| 60 private: | |
| 61 explicit WorkerPermissionClient(PassOwnPtr<WebWorkerPermissionClientProxy>); | |
| 62 | |
| 63 OwnPtr<WebWorkerPermissionClientProxy> m_proxy; | |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 void providePermissionClientToWorker(WebCore::WorkerClients*, PassOwnPtr<WebWork
erPermissionClientProxy>); | |
| 67 | |
| 68 } // namespace blink | 66 } // namespace blink |
| 69 | 67 |
| 70 #endif // WorkerPermissionClient_h | 68 #endif // WebWorkerContextClient_h |
| OLD | NEW |