Commit 8fce3374 authored by Ehsan Karamad's avatar Ehsan Karamad Committed by Commit Bot

[ MimeHandlerView ] (frame-based MHV) postMessage

This CL hooks up post messaging API for frame-based MimeHandlerView. A
current post message test which runs only for BrowserPlugin version is
now modified to run for frame-based MimeHandlerView as well.

Bug: 659750
Change-Id: Ie58fa733f463e697e38a100f78e0e50e7431b983
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539869Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644640}
parent 3115b343
......@@ -362,7 +362,7 @@ IN_PROC_BROWSER_TEST_P(MimeHandlerViewCrossProcessTest,
// The following tests will eventually converted into a parametric version which
// will run on both BrowserPlugin-based and cross-process-frame-based
// MimeHandlerView (https://crbug.com/659750).
IN_PROC_BROWSER_TEST_F(MimeHandlerViewTest, PostMessage) {
IN_PROC_BROWSER_TEST_P(MimeHandlerViewCrossProcessTest, PostMessage) {
RunTest("test_postmessage.html");
}
......
......@@ -88,7 +88,7 @@ void MimeHandlerViewContainer::DidResizeElement(const gfx::Size& new_size) {
v8::Local<v8::Object> MimeHandlerViewContainer::V8ScriptableObject(
v8::Isolate* isolate) {
return GetScriptableObject(isolate);
return GetScriptableObjectInternal(isolate);
}
void MimeHandlerViewContainer::OnCreateMimeHandlerViewGuestACK(
......
......@@ -399,7 +399,7 @@ void MimeHandlerViewContainerBase::SetEmbeddedLoader(
CreateMimeHandlerViewGuestIfNecessary();
}
v8::Local<v8::Object> MimeHandlerViewContainerBase::GetScriptableObject(
v8::Local<v8::Object> MimeHandlerViewContainerBase::GetScriptableObjectInternal(
v8::Isolate* isolate) {
if (scriptable_object_.IsEmpty()) {
v8::Local<v8::Object> object =
......
......@@ -76,7 +76,7 @@ class MimeHandlerViewContainerBase : public blink::WebAssociatedURLLoaderClient,
void DidLoadInternal();
void SendResourceRequest();
void EmbedderRenderFrameWillBeGone();
v8::Local<v8::Object> GetScriptableObject(v8::Isolate* isolate);
v8::Local<v8::Object> GetScriptableObjectInternal(v8::Isolate* isolate);
// Returns the frame which is embedding the corresponding plugin element.
content::RenderFrame* GetEmbedderRenderFrame() const;
......
......@@ -68,7 +68,15 @@ bool MimeHandlerViewFrameContainer::Create(
v8::Local<v8::Object> MimeHandlerViewFrameContainer::GetScriptableObject(
const blink::WebElement& plugin_element,
v8::Isolate* isolate) {
// TODO(ekaramad): Implement.
auto containers = FromRenderFrame(content::RenderFrame::FromWebFrame(
plugin_element.GetDocument().GetFrame()));
for (auto* container : containers) {
auto* frame_container =
static_cast<MimeHandlerViewFrameContainer*>(container);
if (frame_container->plugin_element_ != plugin_element)
continue;
return frame_container->GetScriptableObjectInternal(isolate);
}
return v8::Local<v8::Object>();
}
......
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