diff --git a/engine/core/html/HTMLIFrameElement.cpp b/engine/core/html/HTMLIFrameElement.cpp
index de92eef7b89..edbbc748a1b 100644
--- a/engine/core/html/HTMLIFrameElement.cpp
+++ b/engine/core/html/HTMLIFrameElement.cpp
@@ -10,6 +10,7 @@
#include "sky/engine/core/html/parser/HTMLParserIdioms.h"
#include "sky/engine/core/loader/FrameLoaderClient.h"
#include "sky/engine/core/rendering/RenderIFrame.h"
+#include "sky/engine/tonic/mojo_converter.h"
namespace blink {
@@ -79,14 +80,13 @@ PassRefPtr HTMLIFrameElement::takeExposedServicesHandle(DartState*)
return DartValue::Create();
}
-void HTMLIFrameElement::embedViewManagerClient(DartValue* client) {
+void HTMLIFrameElement::embedViewManagerClient(RefPtr client)
+{
if (!m_contentView)
return;
- // TODO(dart)
- // mojo::MessagePipeHandle handle;
- // if (gin::ConvertFromV8(client.isolate(), client.v8Value(), &handle))
- // m_contentView->Embed(mojo::MakeProxy(mojo::MakeScopedHandle(handle)));
+ m_contentView->Embed(mojo::MakeProxy(
+ DartConverter::FromDart(client->dart_value())));
}
void HTMLIFrameElement::navigateView()
diff --git a/engine/core/html/HTMLIFrameElement.h b/engine/core/html/HTMLIFrameElement.h
index 640840c795b..a0f46cc7da6 100644
--- a/engine/core/html/HTMLIFrameElement.h
+++ b/engine/core/html/HTMLIFrameElement.h
@@ -28,7 +28,7 @@ public:
PassRefPtr takeServicesHandle(DartState*);
PassRefPtr takeExposedServicesHandle(DartState*);
- void embedViewManagerClient(DartValue* client);
+ void embedViewManagerClient(RefPtr client);
private:
explicit HTMLIFrameElement(Document&);
diff --git a/engine/core/html/HTMLIFrameElement.idl b/engine/core/html/HTMLIFrameElement.idl
index aace35fb905..25d3f91eaea 100644
--- a/engine/core/html/HTMLIFrameElement.idl
+++ b/engine/core/html/HTMLIFrameElement.idl
@@ -5,7 +5,7 @@
interface HTMLIFrameElement : HTMLElement {
[Reflect, URL] attribute DOMString src;
- // void embedViewManagerClient(any client);
+ void embedViewManagerClient(any client);
// [CallWith=ScriptState] any takeServicesHandle();
// [CallWith=ScriptState] any takeExposedServicesHandle();
};
diff --git a/engine/tonic/BUILD.gn b/engine/tonic/BUILD.gn
index e795a1c1ab2..f6a6ae05707 100644
--- a/engine/tonic/BUILD.gn
+++ b/engine/tonic/BUILD.gn
@@ -38,10 +38,12 @@ source_set("tonic") {
"dart_wrappable.cc",
"dart_wrappable.h",
"dart_wrapper_info.h",
+ "mojo_converter.h",
]
deps = [
"//base",
+ "//mojo/public/cpp/system",
"//sky/engine/wtf",
]
diff --git a/engine/tonic/mojo_converter.h b/engine/tonic/mojo_converter.h
new file mode 100644
index 00000000000..cfdd4b01628
--- /dev/null
+++ b/engine/tonic/mojo_converter.h
@@ -0,0 +1,32 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKY_ENGINE_TONIC_MOJO_CONVERTER_H_
+#define SKY_ENGINE_TONIC_MOJO_CONVERTER_H_
+
+#include "mojo/public/cpp/system/handle.h"
+#include "sky/engine/tonic/dart_converter.h"
+
+namespace blink {
+
+template
+struct DartConverter> {
+ static mojo::ScopedHandleBase FromDart(Dart_Handle handle) {
+ uint64_t mojo_handle64 = 0;
+ Dart_Handle result = Dart_IntegerToUint64(handle, &mojo_handle64);
+ if (Dart_IsError(result) || !mojo_handle64)
+ return mojo::ScopedHandleBase();
+
+ HandleType mojo_handle(static_cast(mojo_handle64));
+ return mojo::MakeScopedHandle(mojo_handle);
+ }
+
+ static Dart_Handle ToDart(mojo::ScopedHandleBase mojo_handle) {
+ return Dart_NewInteger(static_cast(mojo_handle.release().value()));
+ }
+};
+
+} // namespace blink
+
+#endif // SKY_ENGINE_TONIC_MOJO_CONVERTER_H_
diff --git a/framework/embedder.dart b/framework/embedder.dart
index 9f75db11ac3..90046be8aef 100644
--- a/framework/embedder.dart
+++ b/framework/embedder.dart
@@ -13,7 +13,7 @@ final _EmbedderImpl embedder = new _EmbedderImpl();
class _EmbedderImpl {
static final ShellProxy shell = new ShellProxy.fromHandle(
- new core.MojoHandle(internals.takeShellProxyHandle()));
+ new core.MojoHandle(internals.takeShellProxyHandle()));
static final ApplicationConnection connection = new ApplicationConnection(
new ServiceProviderStub.fromHandle(
diff --git a/tests/TestExpectations b/tests/TestExpectations
index 8c143932eb8..4b6c6c6d725 100644
--- a/tests/TestExpectations
+++ b/tests/TestExpectations
@@ -40,5 +40,4 @@ crbug.com/2 modules/load-event.sky [ Skip ]
crbug.com/2 modules/modules.sky [ Skip ]
crbug.com/2 modules/script-import.sky [ Skip ]
crbug.com/2 parser/script.sky [ Skip ]
-crbug.com/2 services/iframe-embed-vmc.sky [ Skip ]
crbug.com/2 services/iframe-service-provider.sky [ Skip ]
diff --git a/tests/services/iframe-embed-vmc.sky b/tests/services/iframe-embed-vmc.sky
index 7c4a1e1b3ef..4c0284fef85 100644
--- a/tests/services/iframe-embed-vmc.sky
+++ b/tests/services/iframe-embed-vmc.sky
@@ -1,34 +1,56 @@
-
-
-
-
-
-
-
-
-
+
-
+
diff --git a/viewer/internals.cc b/viewer/internals.cc
index f26a86f9d10..770042ff024 100644
--- a/viewer/internals.cc
+++ b/viewer/internals.cc
@@ -29,11 +29,6 @@ Internals* GetInternals() {
return static_cast(state->GetUserData(&kInternalsKey));
}
-void RenderTreeAsText(Dart_NativeArguments args) {
- Dart_Handle result = StdStringToDart(GetInternals()->RenderTreeAsText());
- Dart_SetReturnValue(args, result);
-}
-
void ContentAsText(Dart_NativeArguments args) {
Dart_Handle result = StdStringToDart(GetInternals()->ContentAsText());
Dart_SetReturnValue(args, result);
@@ -44,28 +39,33 @@ void NotifyTestComplete(Dart_NativeArguments args) {
GetInternals()->NotifyTestComplete(StdStringFromDart(test_result));
}
+void RenderTreeAsText(Dart_NativeArguments args) {
+ Dart_Handle result = StdStringToDart(GetInternals()->RenderTreeAsText());
+ Dart_SetReturnValue(args, result);
+}
+
void TakeShellProxyHandle(Dart_NativeArguments args) {
Dart_SetIntegerReturnValue(args,
GetInternals()->TakeShellProxyHandle().value());
}
-void TakeServicesProvidedToEmbedder(Dart_NativeArguments args) {
- Dart_SetIntegerReturnValue(args,
- GetInternals()->TakeServicesProvidedToEmbedder().value());
+void TakeServicesProvidedByEmbedder(Dart_NativeArguments args) {
+ Dart_SetIntegerReturnValue(
+ args, GetInternals()->TakeServicesProvidedByEmbedder().value());
}
-void TakeServicesProvidedByEmbedder(Dart_NativeArguments args) {
- Dart_SetIntegerReturnValue(args,
- GetInternals()->TakeServicesProvidedByEmbedder().value());
+void TakeServicesProvidedToEmbedder(Dart_NativeArguments args) {
+ Dart_SetIntegerReturnValue(
+ args, GetInternals()->TakeServicesProvidedToEmbedder().value());
}
const DartBuiltin::Natives kNativeFunctions[] = {
- {"renderTreeAsText", RenderTreeAsText, 0},
- {"contentAsText", ContentAsText, 0},
- {"notifyTestComplete", NotifyTestComplete, 1},
- {"takeShellProxyHandle", TakeShellProxyHandle, 0},
- {"takeServicesProvidedToEmbedder", TakeServicesProvidedToEmbedder, 0},
- {"takeServicesProvidedByEmbedder", TakeServicesProvidedByEmbedder, 0},
+ {"contentAsText", ContentAsText, 0},
+ {"notifyTestComplete", NotifyTestComplete, 1},
+ {"renderTreeAsText", RenderTreeAsText, 0},
+ {"takeShellProxyHandle", TakeShellProxyHandle, 0},
+ {"takeServicesProvidedByEmbedder", TakeServicesProvidedByEmbedder, 0},
+ {"takeServicesProvidedToEmbedder", TakeServicesProvidedToEmbedder, 0},
};
const DartBuiltin& GetBuiltin() {
@@ -86,12 +86,12 @@ const uint8_t* Symbolizer(Dart_NativeFunction native_function) {
const char kLibraryName[] = "dart:sky.internals";
const char kLibrarySource[] = R"DART(
-String renderTreeAsText() native "renderTreeAsText";
String contentAsText() native "contentAsText";
void notifyTestComplete(String test_result) native "notifyTestComplete";
+String renderTreeAsText() native "renderTreeAsText";
int takeShellProxyHandle() native "takeShellProxyHandle";
-int takeServicesProvidedToEmbedder() native "takeServicesProvidedToEmbedder";
int takeServicesProvidedByEmbedder() native "takeServicesProvidedByEmbedder";
+int takeServicesProvidedToEmbedder() native "takeServicesProvidedToEmbedder";
)DART";
} // namespace
@@ -172,20 +172,6 @@ void Internals::ConnectToApplication(
}
}
-mojo::Handle Internals::ConnectToService(
- const std::string& application_url, const std::string& interface_name) {
- if (!document_view_)
- return mojo::Handle();
-
- mojo::ServiceProviderPtr service_provider;
- ConnectToApplication(application_url, mojo::GetProxy(&service_provider),
- nullptr);
-
- mojo::MessagePipe pipe;
- service_provider->ConnectToService(interface_name, pipe.handle1.Pass());
- return pipe.handle0.release();
-}
-
void Internals::pauseAnimations(double pauseTime) {
if (pauseTime < 0)
return;
diff --git a/viewer/internals.h b/viewer/internals.h
index be421addb37..af120a2758a 100644
--- a/viewer/internals.h
+++ b/viewer/internals.h
@@ -35,9 +35,6 @@ class Internals : public base::SupportsUserData::Data,
mojo::Handle TakeServicesProvidedToEmbedder();
mojo::Handle TakeServicesProvidedByEmbedder();
- mojo::Handle ConnectToService(
- const std::string& application_url, const std::string& interface_name);
-
void pauseAnimations(double pauseTime);
private: