| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 this._server = server; | 45 this._server = server; |
| 46 this._id = id; | 46 this._id = id; |
| 47 this._iframe = createElement("iframe"); | 47 this._iframe = createElement("iframe"); |
| 48 this._iframe.addEventListener("load", this._onLoad.bind(this), false); | 48 this._iframe.addEventListener("load", this._onLoad.bind(this), false); |
| 49 this._iframe.src = src; | 49 this._iframe.src = src; |
| 50 this._iframe.className = className; | 50 this._iframe.className = className; |
| 51 this.setDefaultFocusedElement(this._iframe); | 51 this.setDefaultFocusedElement(this._iframe); |
| 52 | 52 |
| 53 this.element.appendChild(this._iframe); | 53 this.element.appendChild(this._iframe); |
| 54 } | 54 }; |
| 55 | 55 |
| 56 WebInspector.ExtensionView.prototype = { | 56 WebInspector.ExtensionView.prototype = { |
| 57 wasShown: function() | 57 wasShown: function() |
| 58 { | 58 { |
| 59 if (typeof this._frameIndex === "number") | 59 if (typeof this._frameIndex === "number") |
| 60 this._server.notifyViewShown(this._id, this._frameIndex); | 60 this._server.notifyViewShown(this._id, this._frameIndex); |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 willHide: function() | 63 willHide: function() |
| 64 { | 64 { |
| 65 if (typeof this._frameIndex === "number") | 65 if (typeof this._frameIndex === "number") |
| 66 this._server.notifyViewHidden(this._id); | 66 this._server.notifyViewHidden(this._id); |
| 67 }, | 67 }, |
| 68 | 68 |
| 69 _onLoad: function() | 69 _onLoad: function() |
| 70 { | 70 { |
| 71 var frames = /** @type {!Array.<!Window>} */ (window.frames); | 71 var frames = /** @type {!Array.<!Window>} */ (window.frames); |
| 72 this._frameIndex = Array.prototype.indexOf.call(frames, this._iframe.con
tentWindow); | 72 this._frameIndex = Array.prototype.indexOf.call(frames, this._iframe.con
tentWindow); |
| 73 if (this.isShowing()) | 73 if (this.isShowing()) |
| 74 this._server.notifyViewShown(this._id, this._frameIndex); | 74 this._server.notifyViewShown(this._id, this._frameIndex); |
| 75 }, | 75 }, |
| 76 | 76 |
| 77 __proto__: WebInspector.Widget.prototype | 77 __proto__: WebInspector.Widget.prototype |
| 78 } | 78 }; |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * @constructor | 81 * @constructor |
| 82 * @extends {WebInspector.VBox} | 82 * @extends {WebInspector.VBox} |
| 83 * @param {!WebInspector.ExtensionServer} server | 83 * @param {!WebInspector.ExtensionServer} server |
| 84 * @param {string} id | 84 * @param {string} id |
| 85 */ | 85 */ |
| 86 WebInspector.ExtensionNotifierView = function(server, id) | 86 WebInspector.ExtensionNotifierView = function(server, id) |
| 87 { | 87 { |
| 88 WebInspector.VBox.call(this); | 88 WebInspector.VBox.call(this); |
| 89 | 89 |
| 90 this._server = server; | 90 this._server = server; |
| 91 this._id = id; | 91 this._id = id; |
| 92 } | 92 }; |
| 93 | 93 |
| 94 WebInspector.ExtensionNotifierView.prototype = { | 94 WebInspector.ExtensionNotifierView.prototype = { |
| 95 wasShown: function() | 95 wasShown: function() |
| 96 { | 96 { |
| 97 this._server.notifyViewShown(this._id); | 97 this._server.notifyViewShown(this._id); |
| 98 }, | 98 }, |
| 99 | 99 |
| 100 willHide: function() | 100 willHide: function() |
| 101 { | 101 { |
| 102 this._server.notifyViewHidden(this._id); | 102 this._server.notifyViewHidden(this._id); |
| 103 }, | 103 }, |
| 104 | 104 |
| 105 __proto__: WebInspector.VBox.prototype | 105 __proto__: WebInspector.VBox.prototype |
| 106 } | 106 }; |
| OLD | NEW |