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

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

Issue 847893002: Implemented explicit resizing from guestview. (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 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 IdGenerator = requireNative('id_generator'); 10 var IdGenerator = requireNative('id_generator');
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Blur the BrowserPlugin when the GuestViewContainer loses focus. 79 // Blur the BrowserPlugin when the GuestViewContainer loses focus.
80 privates(this).browserPluginElement.blur(); 80 privates(this).browserPluginElement.blur();
81 }.bind(this)); 81 }.bind(this));
82 }; 82 };
83 83
84 GuestViewContainer.prototype.attachWindow = function() { 84 GuestViewContainer.prototype.attachWindow = function() {
85 if (!this.internalInstanceId) { 85 if (!this.internalInstanceId) {
86 return true; 86 return true;
87 } 87 }
88 88
89 this.guest.attach(this.internalInstanceId, 89 // Augment the attach parameters with the element size, so that the guestview
90 this.viewInstanceId, 90 // can fit the element initially.
91 this.buildAttachParams()); 91 var attachParams = this.buildAttachParams();
92 attachParams['elementWidth'] = parseInt(this.element.style.width);
93 attachParams['elementHeight'] = parseInt(this.element.style.height);
94
95 this.guest.attach(this.internalInstanceId, this.viewInstanceId, attachParams);
92 return true; 96 return true;
93 }; 97 };
94 98
95 GuestViewContainer.prototype.handleBrowserPluginAttributeMutation = 99 GuestViewContainer.prototype.handleBrowserPluginAttributeMutation =
96 function(name, oldValue, newValue) { 100 function(name, oldValue, newValue) {
97 if (name == 'internalinstanceid' && !oldValue && !!newValue) { 101 if (name == 'internalinstanceid' && !oldValue && !!newValue) {
98 privates(this).browserPluginElement.removeAttribute('internalinstanceid'); 102 privates(this).browserPluginElement.removeAttribute('internalinstanceid');
99 this.internalInstanceId = parseInt(newValue); 103 this.internalInstanceId = parseInt(newValue);
100 104
101 if (!this.guest.getId()) { 105 if (!this.guest.getId()) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Delete the callbacks so developers cannot call them and produce unexpected 204 // Delete the callbacks so developers cannot call them and produce unexpected
201 // behavior. 205 // behavior.
202 delete proto.createdCallback; 206 delete proto.createdCallback;
203 delete proto.attachedCallback; 207 delete proto.attachedCallback;
204 delete proto.detachedCallback; 208 delete proto.detachedCallback;
205 delete proto.attributeChangedCallback; 209 delete proto.attributeChangedCallback;
206 } 210 }
207 211
208 // Exports. 212 // Exports.
209 exports.GuestViewContainer = GuestViewContainer; 213 exports.GuestViewContainer = GuestViewContainer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698