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

Side by Side Diff: sky/engine/core/html/HTMLIFrameElement.cpp

Issue 862943004: <iframe> should expose its mojo::ServiceProvider handle (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« 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