OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
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. | |
29 */ | |
30 | |
31 #include "web/DedicatedWorkerMessagingProxyProviderImpl.h" | |
32 | |
33 #include "core/dom/Document.h" | |
34 #include "core/frame/Settings.h" | |
35 #include "core/frame/WebLocalFrameBase.h" | |
36 #include "core/loader/WorkerFetchContext.h" | |
37 #include "core/workers/DedicatedWorkerMessagingProxy.h" | |
38 #include "core/workers/Worker.h" | |
39 #include "core/workers/WorkerClients.h" | |
40 #include "core/workers/WorkerContentSettingsClient.h" | |
41 #include "modules/filesystem/LocalFileSystemClient.h" | |
42 #include "modules/indexeddb/IndexedDBClientImpl.h" | |
43 #include "platform/wtf/PtrUtil.h" | |
44 #include "public/platform/Platform.h" | |
45 #include "public/platform/WebContentSettingsClient.h" | |
46 #include "public/platform/WebString.h" | |
47 #include "public/web/WebFrameClient.h" | |
48 | |
49 namespace blink { | |
50 | |
51 DedicatedWorkerMessagingProxyProviderImpl:: | |
52 DedicatedWorkerMessagingProxyProviderImpl(Page& page) | |
53 : DedicatedWorkerMessagingProxyProvider(page) {} | |
54 | |
55 InProcessWorkerMessagingProxy* | |
56 DedicatedWorkerMessagingProxyProviderImpl::CreateWorkerMessagingProxy( | |
57 Worker* worker) { | |
58 if (worker->GetExecutionContext()->IsDocument()) { | |
59 Document* document = ToDocument(worker->GetExecutionContext()); | |
60 WebLocalFrameBase* web_frame = | |
61 WebLocalFrameBase::FromFrame(document->GetFrame()); | |
62 WorkerClients* worker_clients = WorkerClients::Create(); | |
63 ProvideIndexedDBClientToWorker( | |
64 worker_clients, IndexedDBClientImpl::Create(*worker_clients)); | |
65 ProvideLocalFileSystemToWorker(worker_clients, | |
66 LocalFileSystemClient::Create()); | |
67 ProvideContentSettingsClientToWorker( | |
68 worker_clients, | |
69 web_frame->Client()->CreateWorkerContentSettingsClient()); | |
70 | |
71 // FIXME: call provideServiceWorkerContainerClientToWorker here when we | |
72 // support ServiceWorker in dedicated workers (http://crbug.com/371690) | |
73 return new DedicatedWorkerMessagingProxy(worker, worker_clients); | |
74 } | |
75 NOTREACHED(); | |
76 return 0; | |
77 } | |
78 | |
79 } // namespace blink | |
OLD | NEW |