Commit 997bf6df authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

GuestView: Use $ consistently to indicate method overwriting

When GuestViewCrossProcessFrames is enabled, we overwrite certain
methods in the guest view js implementation. It appears that the
intended naming convention is to have the methods that are overwritten
end with a "$". However, this was not done consistently.

Bug: None
Change-Id: Iac035cd43264d20e46036581bcaa070d2edd6bb7
Reviewed-on: https://chromium-review.googlesource.com/c/1311076
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604966}
parent f51f809a
......@@ -45,7 +45,7 @@ AppViewImpl.prototype.connect = function(app, data, callback) {
this.app = app;
this.data = data;
this.guest.destroy($Function.bind(this.prepareForReattach_, this));
this.guest.destroy($Function.bind(this.prepareForReattach$, this));
this.guest.create(this.buildParams(), $Function.bind(function() {
if (!this.guest.getId()) {
var errorMsg = 'Unable to connect to app "' + app + '".';
......
......@@ -39,7 +39,7 @@ ExtensionOptionsImpl.prototype.buildContainerParams = function() {
ExtensionOptionsImpl.prototype.createGuest = function() {
// Destroy the old guest if one exists.
this.guest.destroy($Function.bind(this.prepareForReattach_, this));
this.guest.destroy($Function.bind(this.prepareForReattach$, this));
this.guest.create(this.buildParams(), $Function.bind(function() {
if (!this.guest.getId()) {
......
......@@ -106,7 +106,7 @@ ExtensionViewImpl.prototype.loadNextSrc = function() {
if (extensionId !=
this.attributes[ExtensionViewConstants.ATTRIBUTE_EXTENSION]
.getValue()) {
this.guest.destroy($Function.bind(this.prepareForReattach_, this));
this.guest.destroy($Function.bind(this.prepareForReattach$, this));
// Update the extension and src attributes.
this.attributes[ExtensionViewConstants.ATTRIBUTE_EXTENSION]
......
......@@ -5,6 +5,10 @@
// This module implements a wrapper for a guestview that manages its
// creation, attaching, and destruction.
// Methods ending with $ will be overwritten by guest_view_iframe.js
// TODO(mcnee): When BrowserPlugin is removed, merge
// guest_view_iframe.js into this file.
var CreateEvent = require('guestViewEvents').CreateEvent;
var GuestViewInternal = getInternalApi ?
getInternalApi('guestViewInternal') :
......@@ -238,7 +242,7 @@ GuestViewImpl.prototype.sendCreateRequest = function(
};
// Internal implementation of destroy().
GuestViewImpl.prototype.destroyImpl = function(callback) {
GuestViewImpl.prototype.destroyImpl$ = function(callback) {
// Check the current state.
if (!this.checkState('destroy')) {
this.handleCallback(callback);
......@@ -329,8 +333,9 @@ GuestView.prototype.create = function(createParams, callback) {
// been destroyed.
GuestView.prototype.destroy = function(callback) {
var internal = privates(this).internal;
$Array.push(internal.actionQueue,
$Function.bind(internal.destroyImpl, internal, callback));
$Array.push(
internal.actionQueue,
$Function.bind(internal.destroyImpl$, internal, callback));
internal.performNextAction();
};
......@@ -366,6 +371,7 @@ GuestView.prototype.getId = function() {
// Exports
if (!apiBridge) {
exports.$set('GuestView', GuestView);
// TODO(mcnee): Don't export GuestViewImpl once guest_view_iframe.js is gone.
exports.$set('GuestViewImpl', GuestViewImpl);
exports.$set('ResizeEvent', ResizeEvent);
}
......@@ -5,6 +5,10 @@
// This module implements the shared functionality for different guestview
// containers, such as web_view, app_view, etc.
// Methods ending with $ will be overwritten by guest_view_iframe_container.js.
// TODO(mcnee): When BrowserPlugin is removed, merge
// guest_view_iframe_container.js into this file.
var GuestView = require('guestView').GuestView;
var GuestViewInternalNatives = requireNative('guest_view_internal');
var IdGenerator = requireNative('id_generator');
......@@ -69,7 +73,7 @@ GuestViewContainer.prototype.createInternalElement$ = function() {
return browserPluginElement;
};
GuestViewContainer.prototype.prepareForReattach_ = function() {};
GuestViewContainer.prototype.prepareForReattach$ = function() {};
GuestViewContainer.prototype.focus = function() {
// Focus the internal element when focus() is called on the GuestView element.
......@@ -156,9 +160,10 @@ GuestViewContainer.prototype.weakWrapper = function(func) {
};
};
GuestViewContainer.prototype.willAttachElement$ = function() {};
// Implemented by the specific view type, if needed.
GuestViewContainer.prototype.buildContainerParams = function() { return {}; };
GuestViewContainer.prototype.willAttachElement = function() {};
GuestViewContainer.prototype.onElementAttached = function() {};
GuestViewContainer.prototype.onElementDetached = function() {};
GuestViewContainer.prototype.setupAttributes = function() {};
......
......@@ -78,7 +78,7 @@ var customElementCallbacks = {
return;
internal.elementAttached = true;
internal.willAttachElement();
internal.willAttachElement$();
internal.onElementAttached();
},
......
......@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// --site-per-process overrides for guest_view.js.
// GuestViewCrossProcessFrames overrides for guest_view.js.
var GuestView = require('guestView').GuestView;
var GuestViewImpl = require('guestView').GuestViewImpl;
var GuestViewInternalNatives = requireNative('guest_view_internal');
var ResizeEvent = require('guestView').ResizeEvent;
......@@ -108,7 +107,7 @@ GuestViewImpl.prototype.createImpl$ = function(createParams, callback) {
};
// Internal implementation of destroy().
GuestViewImpl.prototype.destroyImpl = function(callback) {
GuestViewImpl.prototype.destroyImpl$ = function(callback) {
// Check the current state.
if (!this.checkState('destroy')) {
this.handleCallback(callback);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// --site-per-process overrides for guest_view_container.js
// GuestViewCrossProcessFrames overrides for guest_view_container.js
var GuestViewContainer = require('guestViewContainer').GuestViewContainer;
var IdGenerator = requireNative('id_generator');
......@@ -16,7 +16,7 @@ GuestViewContainer.prototype.createInternalElement$ = function() {
return iframeElement;
};
GuestViewContainer.prototype.prepareForReattach_ = function() {
GuestViewContainer.prototype.prepareForReattach$ = function() {
// Since attachment swaps a local frame for a remote frame, we need our
// internal iframe element to be local again before we can reattach.
var newFrame = this.createInternalElement$();
......@@ -32,7 +32,7 @@ GuestViewContainer.prototype.attachWindow$ = function() {
return true;
};
GuestViewContainer.prototype.willAttachElement = function () {
GuestViewContainer.prototype.willAttachElement$ = function() {
if (this.deferredAttachCallback) {
this.deferredAttachCallback();
this.deferredAttachCallback = null;
......
......@@ -184,7 +184,7 @@ WebViewImpl.prototype.attachWindow$ = function(opt_guestInstanceId) {
}
this.guest.destroy();
this.guest = new GuestView('webview', opt_guestInstanceId);
this.prepareForReattach_();
this.prepareForReattach$();
}
return $Function.call(GuestViewContainer.prototype.attachWindow$, this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment