OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "core/workers/WorkerGlobalScope.h" | 34 #include "core/workers/WorkerGlobalScope.h" |
35 #include "platform/weborigin/SecurityOrigin.h" | 35 #include "platform/weborigin/SecurityOrigin.h" |
36 #include "public/platform/WebSecurityOrigin.h" | 36 #include "public/platform/WebSecurityOrigin.h" |
37 #include "public/web/WebContentSettingsClient.h" | 37 #include "public/web/WebContentSettingsClient.h" |
38 #include "public/web/WebKit.h" | 38 #include "public/web/WebKit.h" |
39 #include "web/WebLocalFrameImpl.h" | 39 #include "web/WebLocalFrameImpl.h" |
40 #include "web/WorkerContentSettingsClient.h" | 40 #include "web/WorkerContentSettingsClient.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 IndexedDBClient* IndexedDBClientImpl::create() { | 44 IndexedDBClient* IndexedDBClientImpl::create(LocalFrame& frame) { |
45 return new IndexedDBClientImpl(); | 45 return new IndexedDBClientImpl(frame); |
46 } | 46 } |
47 | 47 |
| 48 IndexedDBClient* IndexedDBClientImpl::create(WorkerClients& workerClients) { |
| 49 return new IndexedDBClientImpl(workerClients); |
| 50 } |
| 51 |
| 52 IndexedDBClientImpl::IndexedDBClientImpl(LocalFrame& frame) |
| 53 : IndexedDBClient(frame) {} |
| 54 |
| 55 IndexedDBClientImpl::IndexedDBClientImpl(WorkerClients& workerClients) |
| 56 : IndexedDBClient(workerClients) {} |
| 57 |
48 bool IndexedDBClientImpl::allowIndexedDB(ExecutionContext* context, | 58 bool IndexedDBClientImpl::allowIndexedDB(ExecutionContext* context, |
49 const String& name) { | 59 const String& name) { |
50 DCHECK(context->isContextThread()); | 60 DCHECK(context->isContextThread()); |
51 SECURITY_DCHECK(context->isDocument() || context->isWorkerGlobalScope()); | 61 SECURITY_DCHECK(context->isDocument() || context->isWorkerGlobalScope()); |
52 | 62 |
53 if (context->isDocument()) { | 63 if (context->isDocument()) { |
54 WebSecurityOrigin origin(context->getSecurityOrigin()); | 64 WebSecurityOrigin origin(context->getSecurityOrigin()); |
55 Document* document = toDocument(context); | 65 Document* document = toDocument(context); |
56 WebLocalFrameImpl* webFrame = | 66 WebLocalFrameImpl* webFrame = |
57 WebLocalFrameImpl::fromFrame(document->frame()); | 67 WebLocalFrameImpl::fromFrame(document->frame()); |
58 if (!webFrame) | 68 if (!webFrame) |
59 return false; | 69 return false; |
60 if (webFrame->contentSettingsClient()) | 70 if (webFrame->contentSettingsClient()) |
61 return webFrame->contentSettingsClient()->allowIndexedDB(name, origin); | 71 return webFrame->contentSettingsClient()->allowIndexedDB(name, origin); |
62 return true; | 72 return true; |
63 } | 73 } |
64 | 74 |
65 WorkerGlobalScope& workerGlobalScope = *toWorkerGlobalScope(context); | 75 WorkerGlobalScope& workerGlobalScope = *toWorkerGlobalScope(context); |
66 return WorkerContentSettingsClient::from(workerGlobalScope) | 76 return WorkerContentSettingsClient::from(workerGlobalScope) |
67 ->allowIndexedDB(name); | 77 ->allowIndexedDB(name); |
68 } | 78 } |
69 | 79 |
70 } // namespace blink | 80 } // namespace blink |
OLD | NEW |