Index: Source/web/WebPermissionClient.cpp |
diff --git a/Source/web/WebPermissionClient.cpp b/Source/web/WebPermissionClient.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..767aa9d39eba4e382dc9a64ffa68e44e6459ce91 |
--- /dev/null |
+++ b/Source/web/WebPermissionClient.cpp |
@@ -0,0 +1,27 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "config.h" |
+#include "public/platform/modules/permissions/WebPermissionClient.h" |
+ |
+#include "core/dom/Document.h" |
+#include "core/dom/ExecutionContext.h" |
+#include "modules/permissions/PermissionController.h" |
+#include "public/platform/Platform.h" |
+ |
+namespace blink { |
+ |
+WebPermissionClient* WebPermissionClient::get(ExecutionContext* executionContext) |
+{ |
+ if (executionContext->isDocument()) { |
+ Document* document = toDocument(executionContext); |
+ if (!document->frame()) |
+ return nullptr; |
+ PermissionController* controller = PermissionController::from(*document->frame()); |
+ return controller ? controller->client() : nullptr; |
+ } |
+ return Platform::current()->permissionClient(); |
+} |
+ |
+} // namespace blink |