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 watchForTag = require("tagWatcher").watchForTag; | 10 var watchForTag = require('tagWatcher').watchForTag; |
| 11 |
| 12 var chrome = requireNative('chrome').GetChrome(); |
11 | 13 |
12 var WEB_VIEW_ATTRIBUTES = ['name', 'src', 'partition', 'autosize', 'minheight', | 14 var WEB_VIEW_ATTRIBUTES = ['name', 'src', 'partition', 'autosize', 'minheight', |
13 'minwidth', 'maxheight', 'maxwidth']; | 15 'minwidth', 'maxheight', 'maxwidth']; |
14 | 16 |
15 // All exposed api methods for <webview>, these are forwarded to the browser | 17 // All exposed api methods for <webview>, these are forwarded to the browser |
16 // plugin. | 18 // plugin. |
17 var WEB_VIEW_API_METHODS = [ | 19 var WEB_VIEW_API_METHODS = [ |
18 'back', | 20 'back', |
19 'canGoBack', | 21 'canGoBack', |
20 'canGoForward', | 22 'canGoForward', |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 var node = this.node_; | 179 var node = this.node_; |
178 this.objectNode_.addEventListener('-internal-' + eventname, function(e) { | 180 this.objectNode_.addEventListener('-internal-' + eventname, function(e) { |
179 var evt = new Event(eventname, { bubbles: true }); | 181 var evt = new Event(eventname, { bubbles: true }); |
180 var detail = e.detail ? JSON.parse(e.detail) : {}; | 182 var detail = e.detail ? JSON.parse(e.detail) : {}; |
181 attribs.forEach(function(attribName) { | 183 attribs.forEach(function(attribName) { |
182 evt[attribName] = detail[attribName]; | 184 evt[attribName] = detail[attribName]; |
183 }); | 185 }); |
184 node.dispatchEvent(evt); | 186 node.dispatchEvent(evt); |
185 }); | 187 }); |
186 } | 188 } |
OLD | NEW |