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'; |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 | 951 |
952 // Registers <webview> custom element. | 952 // Registers <webview> custom element. |
953 function registerWebViewElement() { | 953 function registerWebViewElement() { |
954 var proto = Object.create(HTMLElement.prototype); | 954 var proto = Object.create(HTMLElement.prototype); |
955 | 955 |
956 proto.createdCallback = function() { | 956 proto.createdCallback = function() { |
957 new WebViewInternal(this); | 957 new WebViewInternal(this); |
958 }; | 958 }; |
959 | 959 |
960 proto.attributeChangedCallback = function(name, oldValue, newValue) { | 960 proto.attributeChangedCallback = function(name, oldValue, newValue) { |
| 961 if (!this.internal_) { |
| 962 return; |
| 963 } |
961 var internal = this.internal_(secret); | 964 var internal = this.internal_(secret); |
962 internal.handleWebviewAttributeMutation_(name, oldValue, newValue); | 965 internal.handleWebviewAttributeMutation_(name, oldValue, newValue); |
963 }; | 966 }; |
964 | 967 |
965 proto.back = function() { | 968 proto.back = function() { |
966 this.go(-1); | 969 this.go(-1); |
967 }; | 970 }; |
968 | 971 |
969 proto.forward = function() { | 972 proto.forward = function() { |
970 this.go(1); | 973 this.go(1); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 * Implemented when the experimental API is available. | 1049 * Implemented when the experimental API is available. |
1047 * @private | 1050 * @private |
1048 */ | 1051 */ |
1049 WebViewInternal.prototype.maybeGetExperimentalPermissions_ = function() { | 1052 WebViewInternal.prototype.maybeGetExperimentalPermissions_ = function() { |
1050 return []; | 1053 return []; |
1051 }; | 1054 }; |
1052 | 1055 |
1053 exports.WebView = WebView; | 1056 exports.WebView = WebView; |
1054 exports.WebViewInternal = WebViewInternal; | 1057 exports.WebViewInternal = WebViewInternal; |
1055 exports.CreateEvent = CreateEvent; | 1058 exports.CreateEvent = CreateEvent; |
OLD | NEW |