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

Unified Diff: content/child/blink_platform_impl.cc

Issue 2460723003: Enable connection to Mojo services from Blink (Closed)
Patch Set: Self-review Created 4 years, 1 month 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
Index: content/child/blink_platform_impl.cc
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index 86e22ad565885130419ba1724b03bd6c7af239e0..3c2f69e98db5131f29ef078d6d1847769c274b4f 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -48,7 +48,10 @@
#include "content/child/web_url_request_util.h"
#include "content/child/worker_thread_registry.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/service_manager_connection.h"
#include "net/base/net_errors.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
#include "third_party/WebKit/public/platform/WebData.h"
#include "third_party/WebKit/public/platform/WebFloatPoint.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
@@ -71,11 +74,6 @@ using blink::scheduler::WebThreadImplForWorkerScheduler;
namespace content {
-namespace {
-
-
-} // namespace
-
static int ToMessageID(WebLocalizedString::Name name) {
switch (name) {
case WebLocalizedString::AXAMPMFieldText:
@@ -813,6 +811,29 @@ bool BlinkPlatformImpl::databaseSetFileSize(
return false;
}
+service_manager::mojom::blink::ConnectorPtr
+BlinkPlatformImpl::serviceConnector() {
Ken Rockot(use gerrit already) 2016/11/28 20:24:01 nit: maybe it should be called createServiceConnec
blundell 2016/12/15 17:04:51 Done (changed to bindServiceConnector).
+ service_manager::mojom::blink::ConnectorPtr blink_ptr;
+ if (!ChildThreadImpl::current())
+ return blink_ptr;
+
+ service_manager::mojom::ConnectorPtr chromium_ptr;
+ ChildThreadImpl::current()
+ ->GetServiceManagerConnection()
esprehn 2016/12/02 02:23:14 Is there a reason we can't just return the GetServ
blundell 2016/12/05 17:06:02 ServiceManagerConnection is a //content type that
+ ->GetConnector()
+ ->BindRequest(mojo::GetProxy(&chromium_ptr));
+
+ // Pass the pipe from |chromium_ptr| to |blink_ptr|.
+ service_manager::mojom::ConnectorPtrInfo chromium_ptr_info =
+ chromium_ptr.PassInterface();
+ DCHECK(chromium_ptr_info.is_valid());
+ blink_ptr.Bind(service_manager::mojom::blink::ConnectorPtrInfo(
+ chromium_ptr_info.PassHandle(), chromium_ptr_info.version()));
+ DCHECK(blink_ptr.is_bound());
+
+ return blink_ptr;
+}
+
blink::WebString BlinkPlatformImpl::signedPublicKeyAndChallengeString(
unsigned key_size_index,
const blink::WebString& challenge,

Powered by Google App Engine
This is Rietveld 408576698