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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
(...skipping 10 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 */
34 WebInspector.DartDispatcher = function(iframe)
35 {
36 this._iframe = iframe;
37 }
38
39 WebInspector.DartDispatcher.prototype = {
40 observatoryData: function(id, data)
41 {
42 this._iframe.contentWindow.postMessage({
43 id: id,
44 error: null,
45 data: data,
46 name: "observatoryData"
47 }, "*");
48 },
49
50 }
51
52 /**
53 * @constructor
33 * @extends {WebInspector.View} 54 * @extends {WebInspector.View}
34 * @param {string} id 55 * @param {string} id
35 * @param {string} src 56 * @param {string} src
36 * @param {string} className 57 * @param {string} className
37 */ 58 */
38 WebInspector.ExtensionView = function(id, src, className) 59 WebInspector.DartView = function(id, src, className)
39 { 60 {
40 WebInspector.View.call(this); 61 WebInspector.View.call(this);
41 this.element.className = "fill"; 62 this.element.className = "fill";
42 63
43 this._id = id; 64 this._id = id;
44 this._iframe = document.createElement("iframe"); 65 this._iframe = document.createElement("iframe");
45 this._iframe.addEventListener("load", this._onLoad.bind(this), false); 66 this._iframe.addEventListener("load", this._onLoad.bind(this), false);
46 this._iframe.src = src; 67 this._iframe.src = src;
47 this._iframe.className = className; 68 this._iframe.className = className;
48 this.setDefaultFocusedElement(this._iframe); 69 this.setDefaultFocusedElement(this._iframe);
49 70
71 window.addEventListener('message', this._onMessage.bind(this), false);
72 InspectorBackend.registerDartDispatcher(new WebInspector.DartDispatcher(this ._iframe));
50 this.element.appendChild(this._iframe); 73 this.element.appendChild(this._iframe);
51 } 74 }
52 75
53 WebInspector.ExtensionView.prototype = { 76
77 WebInspector.DartView.prototype = {
54 wasShown: function() 78 wasShown: function()
55 { 79 {
80 DartAgent
81 /*
56 if (typeof this._frameIndex === "number") 82 if (typeof this._frameIndex === "number")
57 WebInspector.extensionServer.notifyViewShown(this._id, this._frameIn dex); 83 // WebInspector.extensionServer.notifyViewShown(this._id, this._fram eIndex);
84 // XXX
85 */
58 }, 86 },
59 87
60 willHide: function() 88 willHide: function()
61 { 89 {
90 /*
62 if (typeof this._frameIndex === "number") 91 if (typeof this._frameIndex === "number")
63 WebInspector.extensionServer.notifyViewHidden(this._id); 92 // WebInspector.extensionServer.notifyViewHidden(this._id);
93 */
94 },
95
96 _onMessage: function(e)
97 {
98 var data = JSON.parse(e.data);
99 if (e.source == this._iframe.contentWindow && data.method == "observator yQuery") {
100 var iframeContentWindow = this._iframe.contentWindow;
101 var id = data.id;
102 DartAgent.observatoryQuery(id, data.query);
103 }
64 }, 104 },
65 105
66 _onLoad: function() 106 _onLoad: function()
67 { 107 {
68 var frames = /** @type {Window} */ (window.frames); 108 var frames = /** @type {Window} */ (window.frames);
69 this._frameIndex = Array.prototype.indexOf.call(frames, this._iframe.con tentWindow); 109 this._frameIndex = Array.prototype.indexOf.call(frames, this._iframe.con tentWindow);
110 /*
70 if (this.isShowing()) 111 if (this.isShowing())
71 WebInspector.extensionServer.notifyViewShown(this._id, this._frameIn dex); 112 // WebInspector.extensionServer.notifyViewShown(this._id, this._fram eIndex);
113 */
72 }, 114 },
73 115
74 __proto__: WebInspector.View.prototype 116 __proto__: WebInspector.View.prototype
75 }
76
77 /**
78 * @constructor
79 * @extends {WebInspector.View}
80 * @param {string} id
81 */
82 WebInspector.ExtensionNotifierView = function(id)
83 {
84 WebInspector.View.call(this);
85
86 this._id = id;
87 }
88
89 WebInspector.ExtensionNotifierView.prototype = {
90 wasShown: function()
91 {
92 WebInspector.extensionServer.notifyViewShown(this._id);
93 },
94
95 willHide: function()
96 {
97 WebInspector.extensionServer.notifyViewHidden(this._id);
98 },
99
100 __proto__: WebInspector.View.prototype
101 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698