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; |
+}; |