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

Side by Side Diff: extensions/renderer/resources/guest_view/guest_view_container.js

Issue 987473002: Added the onResize and onContentResize events to GuestViewEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This module implements the shared functionality for different guestview 5 // This module implements the shared functionality for different guestview
6 // containers, such as web_view, app_view, etc. 6 // containers, such as web_view, app_view, etc.
7 7
8 var DocumentNatives = requireNative('document_natives'); 8 var DocumentNatives = requireNative('document_natives');
9 var GuestView = require('guestView').GuestView; 9 var GuestView = require('guestView').GuestView;
10 var GuestViewInternalNatives = requireNative('guest_view_internal'); 10 var GuestViewInternalNatives = requireNative('guest_view_internal');
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return; 107 return;
108 } 108 }
109 this.guest.attach(this.internalInstanceId, 109 this.guest.attach(this.internalInstanceId,
110 this.viewInstanceId, 110 this.viewInstanceId,
111 this.buildParams()); 111 this.buildParams());
112 } 112 }
113 }; 113 };
114 114
115 GuestViewContainer.prototype.onElementResize = function(oldWidth, oldHeight, 115 GuestViewContainer.prototype.onElementResize = function(oldWidth, oldHeight,
116 newWidth, newHeight) { 116 newWidth, newHeight) {
117 // Dispatch the 'resize' event.
118 var resizeEvent = new Event('resize', { bubbles: true });
119 resizeEvent.oldWidth = oldWidth;
120 resizeEvent.oldHeight = oldHeight;
121 resizeEvent.newWidth = newWidth;
122 resizeEvent.newHeight = newHeight;
123 this.dispatchEvent(resizeEvent);
124
117 if (!this.guest.getId()) 125 if (!this.guest.getId())
118 return; 126 return;
119 this.guest.setSize( 127 this.guest.setSize({normal: {width: newWidth, height: newHeight}});
120 {normal: {width: newWidth, height: newHeight}});
121 }; 128 };
122 129
123 GuestViewContainer.prototype.buildParams = function() { 130 GuestViewContainer.prototype.buildParams = function() {
124 var params = this.buildContainerParams(); 131 var params = this.buildContainerParams();
125 params['instanceId'] = this.viewInstanceId; 132 params['instanceId'] = this.viewInstanceId;
126 var elementRect = this.element.getBoundingClientRect(); 133 var elementRect = this.element.getBoundingClientRect();
127 params['elementWidth'] = parseInt(elementRect.width); 134 params['elementWidth'] = parseInt(elementRect.width);
128 params['elementHeight'] = parseInt(elementRect.height); 135 params['elementHeight'] = parseInt(elementRect.height);
129 return params; 136 return params;
130 }; 137 };
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Delete the callbacks so developers cannot call them and produce unexpected 234 // Delete the callbacks so developers cannot call them and produce unexpected
228 // behavior. 235 // behavior.
229 delete proto.createdCallback; 236 delete proto.createdCallback;
230 delete proto.attachedCallback; 237 delete proto.attachedCallback;
231 delete proto.detachedCallback; 238 delete proto.detachedCallback;
232 delete proto.attributeChangedCallback; 239 delete proto.attributeChangedCallback;
233 } 240 }
234 241
235 // Exports. 242 // Exports.
236 exports.GuestViewContainer = GuestViewContainer; 243 exports.GuestViewContainer = GuestViewContainer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698