Commit 048b61c2 authored by lazyboy@chromium.org's avatar lazyboy@chromium.org

Fix some webview plugin attach-ment code.

We would show error message on attach failure now, we used to always return true from attachWindowAndSetUpEvents().
attachWindowAndSetUpEvents() now return the value of -internal-attach call. -internal-attach did not used to return value, now it returns the status of the attachment call from BrowserPluginBindings.

Removed 3 unused variables referring to browserPluginNode.

BUG=None

Review URL: https://codereview.chromium.org/284183013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272634 0039d316-1c4b-4281-b951-d872f2087c98
parent ddd43d0c
...@@ -706,9 +706,7 @@ WebViewInternal.prototype.handleDialogEvent = ...@@ -706,9 +706,7 @@ WebViewInternal.prototype.handleDialogEvent =
}; };
var self = this; var self = this;
var browserPluginNode = this.browserPluginNode;
var webviewNode = this.webviewNode; var webviewNode = this.webviewNode;
var requestId = event.requestId; var requestId = event.requestId;
var actionTaken = false; var actionTaken = false;
...@@ -823,7 +821,6 @@ WebViewInternal.prototype.handleNewWindowEvent = ...@@ -823,7 +821,6 @@ WebViewInternal.prototype.handleNewWindowEvent =
}; };
var self = this; var self = this;
var browserPluginNode = this.browserPluginNode;
var webviewNode = this.webviewNode; var webviewNode = this.webviewNode;
var requestId = event.requestId; var requestId = event.requestId;
...@@ -929,9 +926,7 @@ WebViewInternal.prototype.handlePermissionEvent = ...@@ -929,9 +926,7 @@ WebViewInternal.prototype.handlePermissionEvent =
return; return;
} }
var browserPluginNode = this.browserPluginNode;
var webviewNode = this.webviewNode; var webviewNode = this.webviewNode;
var decisionMade = false; var decisionMade = false;
var validateCall = function() { var validateCall = function() {
...@@ -1078,9 +1073,7 @@ WebViewInternal.prototype.attachWindowAndSetUpEvents = function(instanceId) { ...@@ -1078,9 +1073,7 @@ WebViewInternal.prototype.attachWindowAndSetUpEvents = function(instanceId) {
this.setupEvent(eventName, events[eventName]); this.setupEvent(eventName, events[eventName]);
} }
this.browserPluginNode['-internal-attach'](this.instanceId, params); return this.browserPluginNode['-internal-attach'](this.instanceId, params);
return true;
}; };
// Registers browser plugin <object> custom element. // Registers browser plugin <object> custom element.
......
...@@ -236,6 +236,13 @@ class BrowserPluginBindingAttach: public BrowserPluginMethodBinding { ...@@ -236,6 +236,13 @@ class BrowserPluginBindingAttach: public BrowserPluginMethodBinding {
virtual bool Invoke(BrowserPluginBindings* bindings, virtual bool Invoke(BrowserPluginBindings* bindings,
const NPVariant* args, const NPVariant* args,
NPVariant* result) OVERRIDE { NPVariant* result) OVERRIDE {
bool attached = InvokeHelper(bindings, args);
BOOLEAN_TO_NPVARIANT(attached, *result);
return true;
}
private:
bool InvokeHelper(BrowserPluginBindings* bindings, const NPVariant* args) {
if (!bindings->instance()->render_view()) if (!bindings->instance()->render_view())
return false; return false;
...@@ -259,8 +266,6 @@ class BrowserPluginBindingAttach: public BrowserPluginMethodBinding { ...@@ -259,8 +266,6 @@ class BrowserPluginBindingAttach: public BrowserPluginMethodBinding {
bindings->instance()->Attach(instance_id, extra_params.Pass()); bindings->instance()->Attach(instance_id, extra_params.Pass());
return true; return true;
} }
private:
DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingAttach); DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingAttach);
}; };
......
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