Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1483)

Unified Diff: Source/web/IDBFactoryBackendProxy.cpp

Issue 50773002: Introduce WebWorkerPermissionClientProxy to deprecate WorkerAllowMainThreadBridge (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: updated comments, minor code fix Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/DatabaseObserver.cpp ('k') | Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/IDBFactoryBackendProxy.cpp
diff --git a/Source/web/IDBFactoryBackendProxy.cpp b/Source/web/IDBFactoryBackendProxy.cpp
index f0eb7f60a359052023c631ccec0c76a210190af5..79963c345cb99deb919b3539d533967ef59cb2e0 100644
--- a/Source/web/IDBFactoryBackendProxy.cpp
+++ b/Source/web/IDBFactoryBackendProxy.cpp
@@ -44,6 +44,7 @@
#include "WebWorkerBase.h"
#include "WebWorkerClientImpl.h"
#include "WorkerAllowMainThreadBridgeBase.h"
+#include "WorkerPermissionClient.h"
#include "bindings/v8/WorkerScriptController.h"
#include "core/dom/CrossThreadTask.h"
#include "core/dom/DOMError.h"
@@ -121,6 +122,17 @@ bool IDBFactoryBackendProxy::allowIndexedDB(ExecutionContext* context, const Str
allowed = !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(webFrame, name, origin);
} else {
WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
+ WorkerPermissionClient* permissionClient = WorkerPermissionClient::from(workerGlobalScope);
+ if (permissionClient->proxy()) {
+ allowed = permissionClient->allowIndexedDB(name);
+ if (!allowed)
+ callbacks->onError(WebIDBDatabaseError(UnknownError, "The user denied permission to access the database."));
+
+ return allowed;
+ }
+
+ // FIXME: Deprecate this bridge code when PermissionClientProxy is
+ // implemented by the embedder.
WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(workerGlobalScope->thread()->workerLoaderProxy().toWebWorkerBase());
WorkerRunLoop& runLoop = workerGlobalScope->thread()->runLoop();
« no previous file with comments | « Source/web/DatabaseObserver.cpp ('k') | Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698