| 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 23 matching lines...) Expand all Loading... |
| 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/WebWorkerPermissionClientProxy.h" |
| 38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 39 | 39 |
| 40 using namespace WebCore; | 40 using namespace WebCore; |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 PassOwnPtr<WorkerPermissionClient> WorkerPermissionClient::create(PassOwnPtr<Web
WorkerPermissionClientProxy> proxy) | 44 PassOwnPtrWillBeRawPtr<WorkerPermissionClient> WorkerPermissionClient::create(Pa
ssOwnPtr<WebWorkerPermissionClientProxy> proxy) |
| 45 { | 45 { |
| 46 return adoptPtr(new WorkerPermissionClient(proxy)); | 46 return adoptPtrWillBeNoop(new WorkerPermissionClient(proxy)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 WorkerPermissionClient::~WorkerPermissionClient() | 49 WorkerPermissionClient::~WorkerPermissionClient() |
| 50 { | 50 { |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool WorkerPermissionClient::allowDatabase(const WebString& name, const WebStrin
g& displayName, unsigned long estimatedSize) | 53 bool WorkerPermissionClient::allowDatabase(const WebString& name, const WebStrin
g& displayName, unsigned long estimatedSize) |
| 54 { | 54 { |
| 55 if (!m_proxy) | 55 if (!m_proxy) |
| 56 return true; | 56 return true; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 83 | 83 |
| 84 const char* WorkerPermissionClient::supplementName() | 84 const char* WorkerPermissionClient::supplementName() |
| 85 { | 85 { |
| 86 return "WorkerPermissionClient"; | 86 return "WorkerPermissionClient"; |
| 87 } | 87 } |
| 88 | 88 |
| 89 WorkerPermissionClient* WorkerPermissionClient::from(ExecutionContext& context) | 89 WorkerPermissionClient* WorkerPermissionClient::from(ExecutionContext& context) |
| 90 { | 90 { |
| 91 WorkerClients* clients = toWorkerGlobalScope(context).clients(); | 91 WorkerClients* clients = toWorkerGlobalScope(context).clients(); |
| 92 ASSERT(clients); | 92 ASSERT(clients); |
| 93 return static_cast<WorkerPermissionClient*>(Supplement<WorkerClients>::from(
*clients, supplementName())); | 93 return static_cast<WorkerPermissionClient*>(WillBeHeapSupplement<WorkerClien
ts>::from(*clients, supplementName())); |
| 94 } | 94 } |
| 95 | 95 |
| 96 WorkerPermissionClient::WorkerPermissionClient(PassOwnPtr<WebWorkerPermissionCli
entProxy> proxy) | 96 WorkerPermissionClient::WorkerPermissionClient(PassOwnPtr<WebWorkerPermissionCli
entProxy> proxy) |
| 97 : m_proxy(proxy) | 97 : m_proxy(proxy) |
| 98 { | 98 { |
| 99 } | 99 } |
| 100 | 100 |
| 101 void providePermissionClientToWorker(WorkerClients* clients, PassOwnPtr<WebWorke
rPermissionClientProxy> proxy) | 101 void providePermissionClientToWorker(WorkerClients* clients, PassOwnPtr<WebWorke
rPermissionClientProxy> proxy) |
| 102 { | 102 { |
| 103 ASSERT(clients); | 103 ASSERT(clients); |
| 104 WorkerPermissionClient::provideTo(*clients, WorkerPermissionClient::suppleme
ntName(), WorkerPermissionClient::create(proxy)); | 104 WorkerPermissionClient::provideTo(*clients, WorkerPermissionClient::suppleme
ntName(), WorkerPermissionClient::create(proxy)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace blink | 107 } // namespace blink |
| OLD | NEW |