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) { |