| 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 "content/browser/mojo/mojo_app_connection_impl.h" | 5 #include "content/browser/mojo/mojo_app_connection_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "content/browser/mojo/mojo_shell_context.h" | 11 #include "content/browser/mojo/mojo_shell_context.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 const char kBrowserMojoAppUrl[] = "system:content_browser"; | 15 const char kBrowserMojoAppUrl[] = "system:content_browser"; |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 void OnGotInstanceID(mojo::shell::mojom::ConnectResult result, | 18 void OnGotInstanceID(shell::mojom::ConnectResult result, |
| 19 const std::string& user_id, uint32_t remote_id) {} | 19 const std::string& user_id, |
| 20 uint32_t remote_id) {} |
| 20 } // namespace | 21 } // namespace |
| 21 | 22 |
| 22 // static | 23 // static |
| 23 std::unique_ptr<MojoAppConnection> MojoAppConnection::Create( | 24 std::unique_ptr<MojoAppConnection> MojoAppConnection::Create( |
| 24 const std::string& user_id, | 25 const std::string& user_id, |
| 25 const std::string& name, | 26 const std::string& name, |
| 26 const std::string& requestor_name) { | 27 const std::string& requestor_name) { |
| 27 return std::unique_ptr<MojoAppConnection>( | 28 return std::unique_ptr<MojoAppConnection>( |
| 28 new MojoAppConnectionImpl(user_id, name, requestor_name)); | 29 new MojoAppConnectionImpl(user_id, name, requestor_name)); |
| 29 } | 30 } |
| 30 | 31 |
| 31 MojoAppConnectionImpl::MojoAppConnectionImpl( | 32 MojoAppConnectionImpl::MojoAppConnectionImpl( |
| 32 const std::string& user_id, | 33 const std::string& user_id, |
| 33 const std::string& name, | 34 const std::string& name, |
| 34 const std::string& requestor_name) { | 35 const std::string& requestor_name) { |
| 35 MojoShellContext::ConnectToApplication( | 36 MojoShellContext::ConnectToApplication( |
| 36 user_id, name, requestor_name, mojo::GetProxy(&interfaces_), | 37 user_id, name, requestor_name, mojo::GetProxy(&interfaces_), |
| 37 mojo::shell::mojom::InterfaceProviderPtr(), base::Bind(&OnGotInstanceID)); | 38 shell::mojom::InterfaceProviderPtr(), base::Bind(&OnGotInstanceID)); |
| 38 } | 39 } |
| 39 | 40 |
| 40 MojoAppConnectionImpl::~MojoAppConnectionImpl() { | 41 MojoAppConnectionImpl::~MojoAppConnectionImpl() { |
| 41 } | 42 } |
| 42 | 43 |
| 43 void MojoAppConnectionImpl::GetInterface( | 44 void MojoAppConnectionImpl::GetInterface( |
| 44 const std::string& interface_name, | 45 const std::string& interface_name, |
| 45 mojo::ScopedMessagePipeHandle handle) { | 46 mojo::ScopedMessagePipeHandle handle) { |
| 46 interfaces_->GetInterface(interface_name, std::move(handle)); | 47 interfaces_->GetInterface(interface_name, std::move(handle)); |
| 47 } | 48 } |
| 48 | 49 |
| 49 } // namespace content | 50 } // namespace content |
| OLD | NEW |