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

Unified Diff: extensions/renderer/resources/guest_view/guest_view_container.js

Issue 1224573006: Calling webview.focus() now works correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/shim/main.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/guest_view/guest_view_container.js
diff --git a/extensions/renderer/resources/guest_view/guest_view_container.js b/extensions/renderer/resources/guest_view/guest_view_container.js
index f9d1a97a02a55d2cfa56530d64ced92e120aaf5b..3e471d4af01b2aa8cccd3dd3dd0148fb5ca816cb 100644
--- a/extensions/renderer/resources/guest_view/guest_view_container.js
+++ b/extensions/renderer/resources/guest_view/guest_view_container.js
@@ -111,6 +111,11 @@ GuestViewContainer.prototype.setupFocusPropagation = function() {
}));
};
+GuestViewContainer.prototype.focus = function() {
+ // Focus the internal element when focus() is called on the GuestView element.
+ privates(this).internalElement.focus();
+}
+
GuestViewContainer.prototype.attachWindow$ = function() {
if (!this.internalInstanceId) {
return true;
@@ -234,7 +239,7 @@ function registerInternalElement(viewType) {
// Registers the guestview container as a custom element.
// |guestViewContainerType| is the type of guestview container
-// (e.g.WebViewImpl).
+// (e.g. WebViewImpl).
function registerGuestViewElement(guestViewContainerType) {
var proto = $Object.create(HTMLElement.prototype);
@@ -272,6 +277,15 @@ function registerGuestViewElement(guestViewContainerType) {
internal.onElementDetached();
};
+ // Override |focus| to let |internal| handle it.
+ proto.focus = function() {
+ var internal = privates(this).internal;
+ if (!internal) {
+ return;
+ }
+ internal.focus();
+ };
+
// Let the specific view type add extra functionality to its custom element
// through |proto|.
if (guestViewContainerType.setupElement) {
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/shim/main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698