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

Unified Diff: sky/engine/core/html/HTMLIFrameElement.cpp

Issue 882723003: Make it possible to navigate <iframes> (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/html/HTMLIFrameElement.h ('k') | sky/engine/core/html/HTMLIFrameElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/html/HTMLIFrameElement.cpp
diff --git a/sky/engine/core/html/HTMLIFrameElement.cpp b/sky/engine/core/html/HTMLIFrameElement.cpp
index 9fb3e0ba9181bb059bfb8ab18fe566376a4b88e3..d47b2f5048e71194a2ffda88e55da98ff1d30377 100644
--- a/sky/engine/core/html/HTMLIFrameElement.cpp
+++ b/sky/engine/core/html/HTMLIFrameElement.cpp
@@ -34,8 +34,11 @@ HTMLIFrameElement::~HTMLIFrameElement()
void HTMLIFrameElement::insertedInto(ContainerNode* insertionPoint)
{
HTMLElement::insertedInto(insertionPoint);
- if (insertionPoint->inDocument())
- createView();
+ if (insertionPoint->inDocument()) {
+ if (LocalFrame* frame = document().frame())
+ m_contentView = frame->loaderClient()->createChildFrame();
+ navigateView();
+ }
}
void HTMLIFrameElement::removedFrom(ContainerNode* insertionPoint)
@@ -45,6 +48,15 @@ void HTMLIFrameElement::removedFrom(ContainerNode* insertionPoint)
m_contentView->Destroy();
}
+void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
+{
+ if (name == HTMLNames::srcAttr) {
+ navigateView();
+ } else {
+ HTMLElement::parseAttribute(name, value);
+ }
+}
+
RenderObject* HTMLIFrameElement::createRenderer(RenderStyle* style)
{
return new RenderIFrame(this);
@@ -56,29 +68,33 @@ void HTMLIFrameElement::OnViewDestroyed(mojo::View* view)
m_contentView = nullptr;
}
-ScriptValue HTMLIFrameElement::takeServiceProvider(ScriptState* scriptState)
+ScriptValue HTMLIFrameElement::takeServicesHandle(ScriptState* scriptState)
{
return ScriptValue(scriptState, gin::ConvertToV8(scriptState->isolate(), m_services.PassMessagePipe().release()));
}
-void HTMLIFrameElement::createView()
+ScriptValue HTMLIFrameElement::takeExposedServicesHandle(ScriptState* scriptState)
{
+ return ScriptValue(scriptState, gin::ConvertToV8(scriptState->isolate(), m_exposedServices.release()));
+}
+
+void HTMLIFrameElement::navigateView()
+{
+ if (!m_contentView)
+ return;
+
String urlString = stripLeadingAndTrailingHTMLSpaces(getAttribute(HTMLNames::srcAttr));
if (urlString.isEmpty())
urlString = blankURL().string();
- LocalFrame* parentFrame = document().frame();
- if (!parentFrame)
- return;
-
KURL url = document().completeURL(urlString);
- m_contentView = parentFrame->loaderClient()->createChildFrame();
- if (!m_contentView)
- return;
+
+ mojo::MessagePipe exposedServicesPipe;
+ m_exposedServices = exposedServicesPipe.handle0.Pass();
m_contentView->Embed(mojo::String::From(url.string().utf8().data()),
- GetProxy(&m_services),
- nullptr); // TODO(abarth) Expose the exposedService parameter.
+ mojo::GetProxy(&m_services),
+ mojo::MakeProxy<mojo::ServiceProvider>(exposedServicesPipe.handle1.Pass()));
m_contentView->AddObserver(this);
}
« no previous file with comments | « sky/engine/core/html/HTMLIFrameElement.h ('k') | sky/engine/core/html/HTMLIFrameElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698