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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 /** | 639 /** |
640 * @private | 640 * @private |
641 */ | 641 */ |
642 WebViewInternal.prototype.handleLoadCommitEvent_ = | 642 WebViewInternal.prototype.handleLoadCommitEvent_ = |
643 function(event, webViewEvent) { | 643 function(event, webViewEvent) { |
644 this.currentEntryIndex_ = event.currentEntryIndex; | 644 this.currentEntryIndex_ = event.currentEntryIndex; |
645 this.entryCount_ = event.entryCount; | 645 this.entryCount_ = event.entryCount; |
646 this.processId_ = event.processId; | 646 this.processId_ = event.processId; |
647 var oldValue = this.webviewNode_.getAttribute('src'); | 647 var oldValue = this.webviewNode_.getAttribute('src'); |
648 var newValue = event.url; | 648 var newValue = event.url; |
649 if (event.isTopLevel && (oldValue != newValue)) { | 649 if (event.isTopLevel && !DocumentNatives.CompareURLs(oldValue, newValue)) { |
650 // Touching the src attribute triggers a navigation. To avoid | 650 // Touching the src attribute triggers a navigation. To avoid |
651 // triggering a page reload on every guest-initiated navigation, | 651 // triggering a page reload on every guest-initiated navigation, |
652 // we use the flag ignoreNextSrcAttributeChange_ here. | 652 // we use the flag ignoreNextSrcAttributeChange_ here. |
653 this.ignoreNextSrcAttributeChange_ = true; | 653 this.ignoreNextSrcAttributeChange_ = true; |
654 this.webviewNode_.setAttribute('src', newValue); | 654 this.webviewNode_.setAttribute('src', newValue); |
655 } | 655 } |
656 this.webviewNode_.dispatchEvent(webViewEvent); | 656 this.webviewNode_.dispatchEvent(webViewEvent); |
657 } | 657 } |
658 | 658 |
659 /** | 659 /** |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 * Implemented when the experimental API is available. | 1010 * Implemented when the experimental API is available. |
1011 * @private | 1011 * @private |
1012 */ | 1012 */ |
1013 WebViewInternal.prototype.maybeGetExperimentalPermissions_ = function() { | 1013 WebViewInternal.prototype.maybeGetExperimentalPermissions_ = function() { |
1014 return []; | 1014 return []; |
1015 }; | 1015 }; |
1016 | 1016 |
1017 exports.WebView = WebView; | 1017 exports.WebView = WebView; |
1018 exports.WebViewInternal = WebViewInternal; | 1018 exports.WebViewInternal = WebViewInternal; |
1019 exports.CreateEvent = CreateEvent; | 1019 exports.CreateEvent = CreateEvent; |
OLD | NEW |