| OLD | NEW |
| 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 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/html/HTMLIFrameElement.h" | 6 #include "sky/engine/core/html/HTMLIFrameElement.h" |
| 7 | 7 |
| 8 #include "gen/sky/core/HTMLNames.h" | 8 #include "gen/sky/core/HTMLNames.h" |
| 9 #include "mojo/edk/js/handle.h" |
| 9 #include "sky/engine/core/frame/LocalFrame.h" | 10 #include "sky/engine/core/frame/LocalFrame.h" |
| 10 #include "sky/engine/core/html/parser/HTMLParserIdioms.h" | 11 #include "sky/engine/core/html/parser/HTMLParserIdioms.h" |
| 11 #include "sky/engine/core/loader/FrameLoaderClient.h" | 12 #include "sky/engine/core/loader/FrameLoaderClient.h" |
| 12 #include "sky/engine/core/rendering/RenderIFrame.h" | 13 #include "sky/engine/core/rendering/RenderIFrame.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 PassRefPtr<HTMLIFrameElement> HTMLIFrameElement::create(Document& document) | 17 PassRefPtr<HTMLIFrameElement> HTMLIFrameElement::create(Document& document) |
| 17 { | 18 { |
| 18 return adoptRef(new HTMLIFrameElement(document)); | 19 return adoptRef(new HTMLIFrameElement(document)); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 { | 49 { |
| 49 return new RenderIFrame(this); | 50 return new RenderIFrame(this); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void HTMLIFrameElement::OnViewDestroyed(mojo::View* view) | 53 void HTMLIFrameElement::OnViewDestroyed(mojo::View* view) |
| 53 { | 54 { |
| 54 DCHECK_EQ(view, m_contentView); | 55 DCHECK_EQ(view, m_contentView); |
| 55 m_contentView = nullptr; | 56 m_contentView = nullptr; |
| 56 } | 57 } |
| 57 | 58 |
| 59 ScriptValue HTMLIFrameElement::takeServiceProvider(ScriptState* scriptState) |
| 60 { |
| 61 return ScriptValue(scriptState, gin::ConvertToV8(scriptState->isolate(), m_s
erviceProvider.release())); |
| 62 } |
| 63 |
| 58 void HTMLIFrameElement::createView() | 64 void HTMLIFrameElement::createView() |
| 59 { | 65 { |
| 60 String urlString = stripLeadingAndTrailingHTMLSpaces(getAttribute(HTMLNames:
:srcAttr)); | 66 String urlString = stripLeadingAndTrailingHTMLSpaces(getAttribute(HTMLNames:
:srcAttr)); |
| 61 if (urlString.isEmpty()) | 67 if (urlString.isEmpty()) |
| 62 urlString = blankURL().string(); | 68 urlString = blankURL().string(); |
| 63 | 69 |
| 64 LocalFrame* parentFrame = document().frame(); | 70 LocalFrame* parentFrame = document().frame(); |
| 65 if (!parentFrame) | 71 if (!parentFrame) |
| 66 return; | 72 return; |
| 67 | 73 |
| 68 KURL url = document().completeURL(urlString); | 74 KURL url = document().completeURL(urlString); |
| 69 m_contentView = parentFrame->loaderClient()->createChildFrame(); | 75 m_contentView = parentFrame->loaderClient()->createChildFrame(); |
| 70 if (!m_contentView) | 76 if (!m_contentView) |
| 71 return; | 77 return; |
| 72 | 78 |
| 73 m_contentView->Embed(mojo::String::From(url.string().utf8().data())); | 79 mojo::MessagePipe pipe; |
| 80 m_serviceProvider = pipe.handle0.Pass(); |
| 81 m_contentView->Embed(mojo::String::From(url.string().utf8().data()), |
| 82 mojo::MakeRequest<mojo::ServiceProvider>(pipe.handle1.Pass())); |
| 74 m_contentView->AddObserver(this); | 83 m_contentView->AddObserver(this); |
| 75 } | 84 } |
| 76 | 85 |
| 77 } | 86 } |
| OLD | NEW |