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

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

Issue 856563002: Added the infrastructure for surfaceProxy.onResize() and SurfaceView.onResize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
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 876b60623de0658eda154e87ca06920835bbb73f..c085c9a0d6e54170cb533c755ca77d1cd6744152 100644
--- a/extensions/renderer/resources/guest_view/guest_view_container.js
+++ b/extensions/renderer/resources/guest_view/guest_view_container.js
@@ -6,7 +6,9 @@
// containers, such as web_view, app_view, etc.
var DocumentNatives = requireNative('document_natives');
+var EventBindings = require('event_bindings');
var GuestView = require('guestView').GuestView;
+var GuestViewInternalNatives = requireNative('guest_view_internal');
var IdGenerator = requireNative('id_generator');
function GuestViewContainer(element, viewType) {
@@ -22,6 +24,8 @@ function GuestViewContainer(element, viewType) {
var shadowRoot = this.element.createShadowRoot();
shadowRoot.appendChild(privates(this).browserPluginElement);
+
+ this.setupResizeEvents();
}
// Forward public API methods from |proto| to their internal implementations.
@@ -81,6 +85,22 @@ GuestViewContainer.prototype.setupFocusPropagation = function() {
}.bind(this));
};
+GuestViewContainer.prototype.setupResizeEvents = function() {
+ // Track when the guest resizes using the onResize event.
+ var CreateEvent = function(name) {
+ var eventOpts = {supportsListeners: true, supportsFilters: true};
+ return new EventBindings.Event(name, undefined, eventOpts);
+ };
+ var resizeEvent = CreateEvent('guestViewInternal.onResize');
Fady Samuel 2015/01/15 21:40:12 Remove this for now? This doesn't seem to do anyth
paulmeyer 2015/01/19 23:45:35 Moved to guest_view.js, as discussed offline.
+ resizeEvent.addListener(function(e) {
+ this.onGuestResize(e.oldWidth, e.oldHeight, e.newWidth, e.newHeight);
+ }.bind(this), {instanceId: this.viewInstanceId});
+
+ // Track when the element resizes using the element resize callback.
+ GuestViewInternalNatives.RegisterElementResizeCallback(
+ this.internalInstanceId, this.onElementResize.bind(this));
+};
+
GuestViewContainer.prototype.attachWindow = function() {
if (!this.internalInstanceId) {
return true;
@@ -114,6 +134,10 @@ GuestViewContainer.prototype.onElementAttached = function() {};
GuestViewContainer.prototype.onElementDetached = function() {
this.guest.destroy();
};
+GuestViewContainer.prototype.onElementResize = function(oldWidth, oldHeight,
+ newWidth, newHeight) {};
+GuestViewContainer.prototype.onGuestResize = function(oldWidth, oldHeight,
+ newWidth, newHeight) {};
// Registers the browser plugin <object> custom element. |viewType| is the
// name of the specific guestview container (e.g. 'webview').

Powered by Google App Engine
This is Rietveld 408576698