Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: chrome/renderer/resources/extensions/web_view.js

Issue 127133004: Make WebView use new Custom Element callback names exclusively. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 } 932 }
933 var internal = this.internal_(secret); 933 var internal = this.internal_(secret);
934 internal.handleBrowserPluginAttributeMutation_(name, newValue); 934 internal.handleBrowserPluginAttributeMutation_(name, newValue);
935 }; 935 };
936 936
937 proto.attachedCallback = function() { 937 proto.attachedCallback = function() {
938 // Load the plugin immediately. 938 // Load the plugin immediately.
939 var unused = this.nonExistentAttribute; 939 var unused = this.nonExistentAttribute;
940 }; 940 };
941 941
942 // TODO(dominicc): Remove this line once Custom Elements renames
943 // enteredViewCallback to attachedCallback
944 proto.enteredViewCallback = proto.attachedCallback;
945
946 WebViewInternal.BrowserPlugin = 942 WebViewInternal.BrowserPlugin =
947 DocumentNatives.RegisterElement('browser-plugin', {extends: 'object', 943 DocumentNatives.RegisterElement('browser-plugin', {extends: 'object',
948 prototype: proto}); 944 prototype: proto});
949 945
950 delete proto.createdCallback; 946 delete proto.createdCallback;
951 delete proto.attachedCallback; 947 delete proto.attachedCallback;
952 delete proto.detachedCallback; 948 delete proto.detachedCallback;
953 delete proto.attributeChangedCallback; 949 delete proto.attributeChangedCallback;
954
955 // TODO(dominicc): Remove these lines once Custom Elements renames
956 // enteredView, leftView callbacks to attached, detached
957 // respectively.
958 delete proto.enteredViewCallback;
959 delete proto.leftViewCallback;
960 } 950 }
961 951
962 // Registers <webview> custom element. 952 // Registers <webview> custom element.
963 function registerWebViewElement() { 953 function registerWebViewElement() {
964 var proto = Object.create(HTMLElement.prototype); 954 var proto = Object.create(HTMLElement.prototype);
965 955
966 proto.createdCallback = function() { 956 proto.createdCallback = function() {
967 new WebViewInternal(this); 957 new WebViewInternal(this);
968 }; 958 };
969 959
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1011
1022 window.WebView = 1012 window.WebView =
1023 DocumentNatives.RegisterElement('webview', {prototype: proto}); 1013 DocumentNatives.RegisterElement('webview', {prototype: proto});
1024 1014
1025 // Delete the callbacks so developers cannot call them and produce unexpected 1015 // Delete the callbacks so developers cannot call them and produce unexpected
1026 // behavior. 1016 // behavior.
1027 delete proto.createdCallback; 1017 delete proto.createdCallback;
1028 delete proto.attachedCallback; 1018 delete proto.attachedCallback;
1029 delete proto.detachedCallback; 1019 delete proto.detachedCallback;
1030 delete proto.attributeChangedCallback; 1020 delete proto.attributeChangedCallback;
1031
1032 // TODO(dominicc): Remove these lines once Custom Elements renames
1033 // enteredView, leftView callbacks to attached, detached
1034 // respectively.
1035 delete proto.enteredViewCallback;
1036 delete proto.leftViewCallback;
1037 } 1021 }
1038 1022
1039 var useCapture = true; 1023 var useCapture = true;
1040 window.addEventListener('readystatechange', function listener(event) { 1024 window.addEventListener('readystatechange', function listener(event) {
1041 if (document.readyState == 'loading') 1025 if (document.readyState == 'loading')
1042 return; 1026 return;
1043 1027
1044 registerBrowserPluginElement(); 1028 registerBrowserPluginElement();
1045 registerWebViewElement(); 1029 registerWebViewElement();
1046 window.removeEventListener(event.type, listener, useCapture); 1030 window.removeEventListener(event.type, listener, useCapture);
(...skipping 15 matching lines...) Expand all
1062 * Implemented when the experimental API is available. 1046 * Implemented when the experimental API is available.
1063 * @private 1047 * @private
1064 */ 1048 */
1065 WebViewInternal.prototype.maybeGetExperimentalPermissions_ = function() { 1049 WebViewInternal.prototype.maybeGetExperimentalPermissions_ = function() {
1066 return []; 1050 return [];
1067 }; 1051 };
1068 1052
1069 exports.WebView = WebView; 1053 exports.WebView = WebView;
1070 exports.WebViewInternal = WebViewInternal; 1054 exports.WebViewInternal = WebViewInternal;
1071 exports.CreateEvent = CreateEvent; 1055 exports.CreateEvent = CreateEvent;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698