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

Unified Diff: extensions/renderer/resources/guest_view/extension_view_api_methods.js

Issue 913393003: Restrict extensionview to chrome-extension:// (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: extensions/renderer/resources/guest_view/extension_view_api_methods.js
diff --git a/extensions/renderer/resources/guest_view/extension_view_api_methods.js b/extensions/renderer/resources/guest_view/extension_view_api_methods.js
new file mode 100644
index 0000000000000000000000000000000000000000..6f7030e1d1006c2cc4d2cc411fe79a4946f5c4e6
--- /dev/null
+++ b/extensions/renderer/resources/guest_view/extension_view_api_methods.js
@@ -0,0 +1,40 @@
+// 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.
+
+// This module implements the public-facing API functions for the
+// <extensionview> tag.
+
+var ExtensionViewInternal =
+ require('extensionViewInternal').ExtensionViewInternal;
+var ExtensionViewImpl = require('extensionView').ExtensionViewImpl;
+var ExtensionViewConstants =
+ require('extensionViewConstants').ExtensionViewConstants;
+
+// An array of <extensionview>'s public-facing API methods.
+var EXTENSION_VIEW_API_METHODS = [
+ // Sets the extension ID and src for the guest. Must be called every time
+ // the extension ID changes. This is the only way to set the extension ID.
+ 'connect'
+];
+
+// -----------------------------------------------------------------------------
+// Custom API method implementations.
+
+ExtensionViewImpl.prototype.connect = function(extension, src) {
+ this.guest.destroy();
+
+ // Sets the extension id and src.
+ this.attributes[ExtensionViewConstants.ATTRIBUTE_EXTENSION]
+ .setValueIgnoreMutation(extension);
+ this.attributes[ExtensionViewConstants.ATTRIBUTE_SRC]
+ .setValueIgnoreMutation(src);
+
+ this.createGuest();
+};
+
+// -----------------------------------------------------------------------------
+
+ExtensionViewImpl.getApiMethods = function() {
+ return EXTENSION_VIEW_API_METHODS;
+};

Powered by Google App Engine
This is Rietveld 408576698