| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/dart/content_handler_app_service_connector.h" | 5 #include "services/dart/content_handler_app_service_connector.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "mojo/public/cpp/bindings/interface_request.h" | 8 #include "mojo/public/cpp/bindings/interface_request.h" |
| 9 #include "mojo/services/files/interfaces/files.mojom.h" | 9 #include "mojo/services/files/interfaces/files.mojom.h" |
| 10 #include "mojo/services/network/interfaces/network_service.mojom.h" | 10 #include "mojo/services/network/interfaces/network_service.mojom.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 // This callback runs on the Dart content handler message loop thread. Bound | 14 // This callback runs on the Dart content handler message loop thread. Bound |
| 15 // to |this| by a weak pointer. | 15 // to |this| by a weak pointer. |
| 16 template<typename Interface> | 16 template<typename Interface> |
| 17 void ContentHandlerAppServiceConnector::Connect( | 17 void ContentHandlerAppServiceConnector::Connect( |
| 18 std::string application_name, | 18 std::string application_name, |
| 19 mojo::InterfaceRequest<Interface> interface_request) { | 19 mojo::InterfaceRequest<Interface> interface_request) { |
| 20 mojo::ApplicationConnection* application_connection = | 20 mojo::ApplicationConnection* application_connection = |
| 21 content_handler_app_->ConnectToApplication(application_name); | 21 content_handler_app_->ConnectToApplicationDeprecated(application_name); |
| 22 if (!application_connection) | 22 if (!application_connection) |
| 23 return; | 23 return; |
| 24 mojo::ServiceProvider* sp = application_connection->GetServiceProvider(); | 24 mojo::ServiceProvider* sp = application_connection->GetServiceProvider(); |
| 25 if (!sp) | 25 if (!sp) |
| 26 return; | 26 return; |
| 27 sp->ConnectToService(Interface::Name_, | 27 sp->ConnectToService(Interface::Name_, |
| 28 interface_request.PassMessagePipe().Pass()); | 28 interface_request.PassMessagePipe().Pass()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 ContentHandlerAppServiceConnector::ContentHandlerAppServiceConnector( | 31 ContentHandlerAppServiceConnector::ContentHandlerAppServiceConnector( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return interface_ptr.PassInterfaceHandle().PassHandle().release().value(); | 68 return interface_ptr.PassInterfaceHandle().PassHandle().release().value(); |
| 69 } | 69 } |
| 70 break; | 70 break; |
| 71 default: | 71 default: |
| 72 return MOJO_HANDLE_INVALID; | 72 return MOJO_HANDLE_INVALID; |
| 73 break; | 73 break; |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace dart | 77 } // namespace dart |
| OLD | NEW |