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

Unified Diff: Source/devtools/front_end/DartView.js

Issue 104433004: Enable VM service inside Dartium Renderer processes (Closed) Base URL: svn://svn.chromium.org/multivm/branches/1650/blink
Patch Set: Created 7 years 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: Source/devtools/front_end/DartView.js
diff --git a/Source/devtools/front_end/ExtensionView.js b/Source/devtools/front_end/DartView.js
similarity index 63%
copy from Source/devtools/front_end/ExtensionView.js
copy to Source/devtools/front_end/DartView.js
index cc2a19a2e309ce65f8baa89c18530f79686e5e22..a4af19c3bd424e8a29020afb664904beccbf96dc 100644
--- a/Source/devtools/front_end/ExtensionView.js
+++ b/Source/devtools/front_end/DartView.js
@@ -30,12 +30,35 @@
/**
* @constructor
+ */
+WebInspector.DartDispatcher = function(iframe)
+{
+ this._iframe = iframe;
+}
+
+WebInspector.DartDispatcher.prototype = {
+ // FIXME this one isn't hooked up on the other side. is it needed?
Jacob 2013/12/05 22:56:12 remove FIXME. it is out of date
Cutch 2013/12/05 23:09:37 Done.
+ observatoryData: function(id, data)
+ {
+ window.console.log("XXX payload is:", id, data);
Jacob 2013/12/05 22:56:12 remove XXX log message.
Cutch 2013/12/05 23:09:37 Done.
+ this._iframe.contentWindow.postMessage({
+ id: id,
+ error: null,
+ data: data,
+ name: "observatoryData"
+ }, "*");
+ },
+
+}
+
+/**
+ * @constructor
* @extends {WebInspector.View}
* @param {string} id
* @param {string} src
* @param {string} className
*/
-WebInspector.ExtensionView = function(id, src, className)
+WebInspector.DartView = function(id, src, className)
{
WebInspector.View.call(this);
this.element.className = "fill";
@@ -47,54 +70,51 @@ WebInspector.ExtensionView = function(id, src, className)
this._iframe.className = className;
this.setDefaultFocusedElement(this._iframe);
+ window.addEventListener('message', this._onMessage.bind(this), false);
+ InspectorBackend.registerDartDispatcher(new WebInspector.DartDispatcher(this._iframe));
this.element.appendChild(this._iframe);
}
-WebInspector.ExtensionView.prototype = {
+
+WebInspector.DartView.prototype = {
wasShown: function()
{
+ DartAgent
+ /*
if (typeof this._frameIndex === "number")
- WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex);
+ // WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex);
+ // XXX
+ */
},
willHide: function()
{
+ /*
if (typeof this._frameIndex === "number")
- WebInspector.extensionServer.notifyViewHidden(this._id);
+ // WebInspector.extensionServer.notifyViewHidden(this._id);
+ */
+ },
+
+ _onMessage: function(e)
+ {
+ var data = JSON.parse(e.data);
+ if (e.source == this._iframe.contentWindow && data.method == "observatoryQuery") {
+ var iframeContentWindow = this._iframe.contentWindow;
+ var id = data.id;
+ DartAgent.observatoryQuery(id, data.query);
+ } else {
+ window.console.log("XXX ignoring spurious event:", e);
+ }
},
_onLoad: function()
{
var frames = /** @type {Window} */ (window.frames);
this._frameIndex = Array.prototype.indexOf.call(frames, this._iframe.contentWindow);
+ /*
if (this.isShowing())
- WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex);
- },
-
- __proto__: WebInspector.View.prototype
-}
-
-/**
- * @constructor
- * @extends {WebInspector.View}
- * @param {string} id
- */
-WebInspector.ExtensionNotifierView = function(id)
-{
- WebInspector.View.call(this);
-
- this._id = id;
-}
-
-WebInspector.ExtensionNotifierView.prototype = {
- wasShown: function()
- {
- WebInspector.extensionServer.notifyViewShown(this._id);
- },
-
- willHide: function()
- {
- WebInspector.extensionServer.notifyViewHidden(this._id);
+ // WebInspector.extensionServer.notifyViewShown(this._id, this._frameIndex);
+ */
},
__proto__: WebInspector.View.prototype

Powered by Google App Engine
This is Rietveld 408576698