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

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..e38bd34b237b4faeafaeebfa2a5e26e59d968620
--- /dev/null
+++ b/extensions/renderer/resources/guest_view/extension_view_api_methods.js
@@ -0,0 +1,48 @@
+// 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',
+
+ // Returns Chrome's internal process ID for the guest web page's current
+ // process.
+ 'getProcessId',
Fady Samuel 2015/02/16 19:26:28 Do you need this?
apacible 2015/02/17 18:31:26 No. I kept this around to make a note of it but fo
+];
+
+// -----------------------------------------------------------------------------
+// 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.prototype.getProcessId = function() {
+ return this.processId;
Fady Samuel 2015/02/16 19:26:28 What's this? How is this populated?
apacible 2015/02/17 18:31:26 Removed.
+};
+
+// -----------------------------------------------------------------------------
+
+ExtensionViewImpl.getApiMethods = function() {
+ return EXTENSION_VIEW_API_METHODS;
+};

Powered by Google App Engine
This is Rietveld 408576698