Monet: Roll mojo_sdk to 3762c8c0b74b48b00786a42fca8f7db7f761935f.

This is the latest mojo_sdk, and should be up to date with mojo.git at
b7dbc87691e8f9ddb85e2ae367293dace441776d.

Also update:
* //mojo/{application,common,services/{public,tracing}} (from mojo.git)
* //third_party/mojo/MOJO_VERSION
* //mojo/data_pipe_utils/BUILD.gn
* various things in //mojo/services/network, to use new
  mojo::ConnectToService() and avoid the old
  ApplicationImpl::ConnectToApplication(), etc.

(All things mojo from mojo.git at
b7dbc87691e8f9ddb85e2ae367293dace441776d, except for the fix for
//mojo/data_pipe_utils/BUILD.gn which landed at
//12c8df4e201fdcd096f2ab4608008cd35f072d05.)

TBR=jamesr@chromium.org,vardhan@google.com

Review URL: https://codereview.chromium.org/1954263003 .
diff --git a/DEPS b/DEPS
index 4087bfa..1f60d5b 100644
--- a/DEPS
+++ b/DEPS
@@ -23,7 +23,7 @@
   'boringssl_revision': 'a7997f12be358e58aeb2345bb8b88a9d53240024',
   'buildtools_revision': '222bd42ce39d1bd8f08fe089b066f49c469e1cdf',
   'mojo_devtools_revision': '176889fd2e17f988727847a03b00c158af8a6c52',
-  'mojo_sdk_revision': '88ed73337a362aec488d070424e39c55ecdfa55c',
+  'mojo_sdk_revision': '3762c8c0b74b48b00786a42fca8f7db7f761935f',
 }
 
 # Only these hosts are allowed for dependencies in this DEPS file.
diff --git a/mojo/application/application_runner_chromium.cc b/mojo/application/application_runner_chromium.cc
index bfe9d49..b528034 100644
--- a/mojo/application/application_runner_chromium.cc
+++ b/mojo/application/application_runner_chromium.cc
@@ -58,7 +58,7 @@
       loop.reset(new base::MessageLoop(message_loop_type_));
 
     ApplicationImpl impl(delegate_.get(),
-                         MakeRequest<Application>(MakeScopedHandle(
+                         InterfaceRequest<Application>(MakeScopedHandle(
                              MessagePipeHandle(application_request_handle))));
     loop->Run();
   }
diff --git a/mojo/application/content_handler_factory.cc b/mojo/application/content_handler_factory.cc
index 5388315..a8c3b92 100644
--- a/mojo/application/content_handler_factory.cc
+++ b/mojo/application/content_handler_factory.cc
@@ -17,7 +17,6 @@
 #include "mojo/public/cpp/application/application_connection.h"
 #include "mojo/public/cpp/application/application_delegate.h"
 #include "mojo/public/cpp/application/application_impl.h"
-#include "mojo/public/cpp/application/interface_factory_impl.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/services/content_handler/interfaces/content_handler.mojom.h"
 
diff --git a/mojo/common/BUILD.gn b/mojo/common/BUILD.gn
index 085be39..c9375d2 100644
--- a/mojo/common/BUILD.gn
+++ b/mojo/common/BUILD.gn
@@ -69,6 +69,7 @@
     "//base",
     "//third_party/mojo/src/mojo/public/cpp/application",
     "//third_party/mojo/src/mojo/public/cpp/bindings",
+    "//third_party/mojo/src/mojo/public/interfaces/application",
     "//mojo/services/tracing/interfaces",
   ]
 }
diff --git a/mojo/common/dart/.packages b/mojo/common/dart/.packages
deleted file mode 100644
index a3efb37..0000000
--- a/mojo/common/dart/.packages
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated by pub on 2015-09-17 10:44:16.446.
-common:lib/
diff --git a/mojo/common/dart/packages/common b/mojo/common/dart/packages/common
deleted file mode 120000
index dc598c5..0000000
--- a/mojo/common/dart/packages/common
+++ /dev/null
@@ -1 +0,0 @@
-../lib
\ No newline at end of file
diff --git a/mojo/common/tracing_impl.cc b/mojo/common/tracing_impl.cc
index a93e3d8..93f6e55 100644
--- a/mojo/common/tracing_impl.cc
+++ b/mojo/common/tracing_impl.cc
@@ -5,8 +5,12 @@
 #include "mojo/common/tracing_impl.h"
 
 #include "base/trace_event/trace_event_impl.h"
-#include "mojo/public/cpp/application/application_connection.h"
 #include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/application/connect.h"
+#include "mojo/public/cpp/bindings/interface_handle.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/services/tracing/interfaces/trace_provider_registry.mojom.h"
+#include "mojo/services/tracing/interfaces/tracing.mojom.h"
 
 namespace mojo {
 
@@ -15,8 +19,12 @@
 TracingImpl::~TracingImpl() {}
 
 void TracingImpl::Initialize(ApplicationImpl* app) {
-  ApplicationConnection* connection = app->ConnectToApplication("mojo:tracing");
-  connection->AddService(this);
+  tracing::TraceProviderRegistryPtr registry;
+  ConnectToService(app->shell(), "mojo:tracing", GetProxy(&registry));
+
+  mojo::InterfaceHandle<tracing::TraceProvider> provider;
+  provider_impl_.Bind(GetProxy(&provider));
+  registry->RegisterTraceProvider(provider.Pass());
 
 #ifdef NDEBUG
   if (app->HasArg("--early-tracing")) {
@@ -27,9 +35,4 @@
 #endif
 }
 
-void TracingImpl::Create(ApplicationConnection* connection,
-                         InterfaceRequest<tracing::TraceProvider> request) {
-  provider_impl_.Bind(request.Pass());
-}
-
 }  // namespace mojo
diff --git a/mojo/common/tracing_impl.h b/mojo/common/tracing_impl.h
index 4fa2699..d3f93c6 100644
--- a/mojo/common/tracing_impl.h
+++ b/mojo/common/tracing_impl.h
@@ -7,27 +7,21 @@
 
 #include "base/macros.h"
 #include "mojo/common/trace_provider_impl.h"
-#include "mojo/public/cpp/application/interface_factory.h"
-#include "mojo/services/tracing/interfaces/tracing.mojom.h"
 
 namespace mojo {
 
 class ApplicationImpl;
 
-class TracingImpl : public InterfaceFactory<tracing::TraceProvider> {
+class TracingImpl {
  public:
   TracingImpl();
-  ~TracingImpl() override;
+  ~TracingImpl();
 
   // This connects to the tracing service and registers ourselves to provide
   // tracing data on demand.
   void Initialize(ApplicationImpl* app);
 
  private:
-  // InterfaceFactory<tracing::TraceProvider> implementation.
-  void Create(ApplicationConnection* connection,
-              InterfaceRequest<tracing::TraceProvider> request) override;
-
   TraceProviderImpl provider_impl_;
 
   DISALLOW_COPY_AND_ASSIGN(TracingImpl);
diff --git a/mojo/data_pipe_utils/BUILD.gn b/mojo/data_pipe_utils/BUILD.gn
index ccff7d4..35dd8dc 100644
--- a/mojo/data_pipe_utils/BUILD.gn
+++ b/mojo/data_pipe_utils/BUILD.gn
@@ -20,6 +20,9 @@
     "//base",
     "//mojo/message_pump",
     "//third_party/mojo/src/mojo/public/cpp/environment:environment",
+  ]
+
+  public_deps = [
     "//third_party/mojo/src/mojo/public/cpp/system",
   ]
 }
@@ -35,6 +38,5 @@
     ":data_pipe_utils",
     "//base",
     "//testing/gtest",
-    "//third_party/mojo/src/mojo/public/cpp/system",
   ]
 }
diff --git a/mojo/services/network/host_resolver_apptest.cc b/mojo/services/network/host_resolver_apptest.cc
index 54f44de..c6ddd6d 100644
--- a/mojo/services/network/host_resolver_apptest.cc
+++ b/mojo/services/network/host_resolver_apptest.cc
@@ -13,9 +13,9 @@
 #include "mojo/services/network/interfaces/host_resolver.mojom.h"
 #include "net/base/net_errors.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/mojo/src/mojo/public/cpp/application/application_connection.h"
 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h"
 #include "third_party/mojo/src/mojo/public/cpp/application/application_test_base.h"
+#include "third_party/mojo/src/mojo/public/cpp/application/connect.h"
 #include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
 
 namespace mojo {
@@ -74,9 +74,8 @@
   void SetUp() override {
     ApplicationTestBase::SetUp();
 
-    ApplicationConnection* connection =
-        application_impl()->ConnectToApplication("mojo:network_service");
-    connection->ConnectToService(&network_service_);
+    ConnectToService(application_impl()->shell(), "mojo:network_service",
+                     GetProxy(&network_service_));
   }
 
   NetworkServicePtr network_service_;
diff --git a/mojo/services/network/http_server_apptest.cc b/mojo/services/network/http_server_apptest.cc
index 38f9e86..ccc49ac 100644
--- a/mojo/services/network/http_server_apptest.cc
+++ b/mojo/services/network/http_server_apptest.cc
@@ -27,9 +27,9 @@
 #include "net/http/http_util.h"
 #include "net/socket/tcp_client_socket.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/mojo/src/mojo/public/cpp/application/application_connection.h"
 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h"
 #include "third_party/mojo/src/mojo/public/cpp/application/application_test_base.h"
+#include "third_party/mojo/src/mojo/public/cpp/application/connect.h"
 
 namespace mojo {
 namespace {
@@ -553,9 +553,8 @@
   void SetUp() override {
     ApplicationTestBase::SetUp();
 
-    ApplicationConnection* connection =
-        application_impl()->ConnectToApplication("mojo:network_service");
-    connection->ConnectToService(&network_service_);
+    ConnectToService(application_impl()->shell(), "mojo:network_service",
+                     GetProxy(&network_service_));
   }
 
   void CreateHttpServer(InterfaceHandle<HttpServerDelegate> delegate,
diff --git a/mojo/services/network/udp_socket_apptest.cc b/mojo/services/network/udp_socket_apptest.cc
index 62f3cdd..f7fe6c3 100644
--- a/mojo/services/network/udp_socket_apptest.cc
+++ b/mojo/services/network/udp_socket_apptest.cc
@@ -10,9 +10,9 @@
 #include "mojo/services/network/udp_socket_wrapper.h"
 #include "net/base/net_errors.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/mojo/src/mojo/public/cpp/application/application_connection.h"
 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h"
 #include "third_party/mojo/src/mojo/public/cpp/application/application_test_base.h"
+#include "third_party/mojo/src/mojo/public/cpp/application/connect.h"
 #include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h"
 
 namespace mojo {
@@ -322,9 +322,8 @@
   void SetUp() override {
     ApplicationTestBase::SetUp();
 
-    ApplicationConnection* connection =
-        application_impl()->ConnectToApplication("mojo:network_service");
-    connection->ConnectToService(&network_service_);
+    ConnectToService(application_impl()->shell(), "mojo:network_service",
+                     GetProxy(&network_service_));
 
     network_service_->CreateUDPSocket(GetProxy(&socket_));
   }
diff --git a/mojo/services/network/url_loader_interceptor_apptest.cc b/mojo/services/network/url_loader_interceptor_apptest.cc
index aaca1fa..099d5b2 100644
--- a/mojo/services/network/url_loader_interceptor_apptest.cc
+++ b/mojo/services/network/url_loader_interceptor_apptest.cc
@@ -4,9 +4,9 @@
 
 #include "base/macros.h"
 #include "base/run_loop.h"
-#include "mojo/public/cpp/application/application_connection.h"
 #include "mojo/public/cpp/application/application_impl.h"
 #include "mojo/public/cpp/application/application_test_base.h"
+#include "mojo/public/cpp/application/connect.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "mojo/services/network/interfaces/network_service.mojom.h"
@@ -188,9 +188,8 @@
   void SetUp() override {
     ApplicationTestBase::SetUp();
 
-    ApplicationConnection* connection =
-        application_impl()->ConnectToApplication("mojo:network_service");
-    connection->ConnectToService(&network_service_);
+    ConnectToService(application_impl()->shell(), "mojo:network_service",
+                     GetProxy(&network_service_));
   }
 
   URLResponsePtr GetResponse(const std::string& url) {
diff --git a/mojo/services/public/build/config/BUILD.gn b/mojo/services/public/build/config/BUILD.gn
index c6b13b6..21629ab 100644
--- a/mojo/services/public/build/config/BUILD.gn
+++ b/mojo/services/public/build/config/BUILD.gn
@@ -1,19 +1,14 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
+# Copyright 2014 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.
 
-# The absolute path to the directory containing the Mojo services produced
-# out of Chromium.
+# The absolute path to the directory containing the Mojo services.
 mojo_services_root = get_path_info("../../..", "abspath")
 
-# NOTE: This config name must be in sync with the name of the config used by
-# services that developed out of the Mojo repo so that Chromium's services'
-# BUILD.gn files can work seamlessly in Chromium and when pulled into Mojo or a
-# client repo.
 config("mojo_services") {
   include_dirs = [
-    # Include paths in Chromium Mojo services' client-side code are specified
-    # relative to the directory holding the services' client-side code.
+    # Include paths in Mojo services' client-side code are specified relative
+    # to the directory holding the services' client-side code.
     mojo_services_root,
 
     # The same goes for files generated from mojoms.
diff --git a/mojo/services/tracing/interfaces/BUILD.gn b/mojo/services/tracing/interfaces/BUILD.gn
index 8d7ab59..18af9da 100644
--- a/mojo/services/tracing/interfaces/BUILD.gn
+++ b/mojo/services/tracing/interfaces/BUILD.gn
@@ -7,6 +7,9 @@
 
 mojom("interfaces") {
   sources = [
+    "trace_provider_registry.mojom",
     "tracing.mojom",
   ]
+
+  import_dirs = [ get_path_info("../../", "abspath") ]
 }
diff --git a/mojo/services/tracing/interfaces/trace_provider_registry.mojom b/mojo/services/tracing/interfaces/trace_provider_registry.mojom
new file mode 100644
index 0000000..64a96d7
--- /dev/null
+++ b/mojo/services/tracing/interfaces/trace_provider_registry.mojom
@@ -0,0 +1,17 @@
+// Copyright 2016 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.
+
+// This file contains the top-level interface (provided by the tracing
+// application's ServiceProvider) used by things that want to register
+// themselves to participate in tracing.
+
+[DartPackage="mojo_services"]
+module tracing;
+
+import "tracing/interfaces/tracing.mojom";
+
+[ServiceName="tracing.TraceProviderRegistry"]
+interface TraceProviderRegistry {
+  RegisterTraceProvider(TraceProvider trace_provider);
+};
diff --git a/mojo/services/tracing/interfaces/tracing.mojom b/mojo/services/tracing/interfaces/tracing.mojom
index b2300e0..558bec3 100644
--- a/mojo/services/tracing/interfaces/tracing.mojom
+++ b/mojo/services/tracing/interfaces/tracing.mojom
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+// TODO(vtl): This file should be split into trace_provider.mojom (containing
+// TraceProvider and TraceRecorder) and trace_collector.mojom.
+
 [DartPackage="mojo_services"]
 module tracing;
 
diff --git a/third_party/mojo/MOJO_VERSION b/third_party/mojo/MOJO_VERSION
index 52aec1c..8c19079 100644
--- a/third_party/mojo/MOJO_VERSION
+++ b/third_party/mojo/MOJO_VERSION
@@ -1 +1 @@
-d26dd21f9bf81fca64a5c1c6d50837c41ae2d87c
+b7dbc87691e8f9ddb85e2ae367293dace441776d