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 'use strict'; | 10 'use strict'; |
11 | 11 |
12 var eventBindings = require('event_bindings'); | 12 var eventBindings = require('event_bindings'); |
13 var WebRequestEvent = require('webRequestInternal').WebRequestEvent; | 13 var WebRequestEvent = require('webRequestInternal').WebRequestEvent; |
14 var webRequestSchema = | 14 var webRequestSchema = |
15 requireNative('schema_registry').GetSchema('webRequest'); | 15 requireNative('schema_registry').GetSchema('webRequest'); |
16 var WebviewNatives = requireNative('webview_natives'); | |
16 | 17 |
17 // This secret enables hiding <webview> private members from the outside scope. | 18 // This secret enables hiding <webview> private members from the outside scope. |
18 // Outside of this file, |secret| is inaccessible. The only way to access the | 19 // Outside of this file, |secret| is inaccessible. The only way to access the |
19 // <webview> element's internal members is via the |secret|. Since it's only | 20 // <webview> element's internal members is via the |secret|. Since it's only |
20 // accessible by code here (and in web_view_experimental), only <webview>'s | 21 // accessible by code here (and in web_view_experimental), only <webview>'s |
21 // API can access it and not external developers. | 22 // API can access it and not external developers. |
22 var secret = {}; | 23 var secret = {}; |
23 | 24 |
24 /** @type {Array.<string>} */ | 25 /** @type {Array.<string>} */ |
25 var WEB_VIEW_ATTRIBUTES = ['name', 'src', 'partition', 'autosize', 'minheight', | 26 var WEB_VIEW_ATTRIBUTES = ['name', 'src', 'partition', 'autosize', 'minheight', |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
694 this.webviewNode_, | 695 this.webviewNode_, |
695 'request', | 696 'request', |
696 { | 697 { |
697 value: request, | 698 value: request, |
698 enumerable: true, | 699 enumerable: true, |
699 writable: false | 700 writable: false |
700 } | 701 } |
701 ); | 702 ); |
702 }; | 703 }; |
703 | 704 |
704 // Save document.register in a variable in case the developer attempts to | 705 // Save document.register in a variable in case the developer attempts to |
dominicc (has gone to gerrit)
2013/08/17 00:13:12
This comment can go now. No author is going to ove
Fady Samuel
2013/08/20 23:00:39
Done.
| |
705 // override it at some point. | 706 // override it at some point. |
706 var register = document.register; | 707 var register = WebviewNatives.RegisterElement; |
707 | 708 |
708 // Registers browser plugin <object> custom element. | 709 // Registers browser plugin <object> custom element. |
709 function registerBrowserPluginElement() { | 710 function registerBrowserPluginElement() { |
710 var proto = Object.create(HTMLObjectElement.prototype); | 711 var proto = Object.create(HTMLObjectElement.prototype); |
711 | 712 |
712 proto.createdCallback = function() { | 713 proto.createdCallback = function() { |
713 this.setAttribute('type', 'application/browser-plugin'); | 714 this.setAttribute('type', 'application/browser-plugin'); |
714 // The <object> node fills in the <webview> container. | 715 // The <object> node fills in the <webview> container. |
715 this.style.width = '100%'; | 716 this.style.width = '100%'; |
716 this.style.height = '100%'; | 717 this.style.height = '100%'; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
825 WebViewInternal.prototype.maybeGetWebviewExperimentalExtEvents_ = function() {}; | 826 WebViewInternal.prototype.maybeGetWebviewExperimentalExtEvents_ = function() {}; |
826 | 827 |
827 /** | 828 /** |
828 * Implemented when the experimental API is available. | 829 * Implemented when the experimental API is available. |
829 * @private | 830 * @private |
830 */ | 831 */ |
831 WebViewInternal.prototype.maybeAttachWebRequestEventToWebview_ = function() {}; | 832 WebViewInternal.prototype.maybeAttachWebRequestEventToWebview_ = function() {}; |
832 | 833 |
833 exports.WebViewInternal = WebViewInternal; | 834 exports.WebViewInternal = WebViewInternal; |
834 exports.CreateEvent = createEvent; | 835 exports.CreateEvent = createEvent; |
OLD | NEW |