| 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 65%
|
| copy from Source/devtools/front_end/ExtensionView.js
|
| copy to Source/devtools/front_end/DartView.js
|
| index cc2a19a2e309ce65f8baa89c18530f79686e5e22..445c3bcce0831ad76a6bb7d88c9f139176c1e310 100644
|
| --- a/Source/devtools/front_end/ExtensionView.js
|
| +++ b/Source/devtools/front_end/DartView.js
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (C) 2012 Google Inc. All rights reserved.
|
| + * Copyright (C) 2013 Google Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions are
|
| @@ -30,12 +30,33 @@
|
|
|
| /**
|
| * @constructor
|
| + */
|
| +WebInspector.DartDispatcher = function(iframe)
|
| +{
|
| + this._iframe = iframe;
|
| +}
|
| +
|
| +WebInspector.DartDispatcher.prototype = {
|
| + observatoryData: function(id, data)
|
| + {
|
| + 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 +68,49 @@ 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);
|
| + }
|
| },
|
|
|
| _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
|
|
|