| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Shim that simulates a <webview> tag via Mutation Observers. | 5 // Shim that simulates a <webview> tag via Mutation Observers. |
| 6 // | 6 // |
| 7 // The actual tag is implemented via the browser plugin. The internals of this | 7 // The actual tag is implemented via the browser plugin. The internals of this |
| 8 // are hidden via Shadow DOM. | 8 // are hidden via Shadow DOM. |
| 9 | 9 |
| 10 var WEB_VIEW_ATTRIBUTES = ['src']; | 10 var WEB_VIEW_ATTRIBUTES = ['src']; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 attributeName, this.node_.getAttribute(attributeName)); | 150 attributeName, this.node_.getAttribute(attributeName)); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 /** | 153 /** |
| 154 * @private | 154 * @private |
| 155 */ | 155 */ |
| 156 WebView.prototype.setupEvent_ = function(eventname, attribs) { | 156 WebView.prototype.setupEvent_ = function(eventname, attribs) { |
| 157 var node = this.node_; | 157 var node = this.node_; |
| 158 this.objectNode_.addEventListener('-internal-' + eventname, function(e) { | 158 this.objectNode_.addEventListener('-internal-' + eventname, function(e) { |
| 159 var evt = new Event(eventname); | 159 var evt = new Event(eventname); |
| 160 var detail = e.detail ? JSON.parse(e.detail) : {}; |
| 160 attribs.forEach(function(attribname) { | 161 attribs.forEach(function(attribname) { |
| 161 evt[attribname] = e.detail[attribname]; | 162 evt[attribname] = detail[attribname]; |
| 162 }); | 163 }); |
| 163 node.dispatchEvent(evt); | 164 node.dispatchEvent(evt); |
| 164 }); | 165 }); |
| 165 } | 166 } |
| OLD | NEW |