| 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/navigator_connect/service_port_service_impl.h" | 5 #include "content/browser/navigator_connect/service_port_service_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/browser/message_port_message_filter.h" | 9 #include "content/browser/message_port_message_filter.h" |
| 10 #include "content/browser/message_port_service.h" | 10 #include "content/browser/message_port_service.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void ServicePortServiceImpl::SetClient(ServicePortServiceClientPtr client) { | 84 void ServicePortServiceImpl::SetClient(ServicePortServiceClientPtr client) { |
| 85 DCHECK(!client_.get()); | 85 DCHECK(!client_.get()); |
| 86 // TODO(mek): Set ErrorHandler to listen for errors. | 86 // TODO(mek): Set ErrorHandler to listen for errors. |
| 87 client_ = std::move(client); | 87 client_ = std::move(client); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void ServicePortServiceImpl::Connect(const mojo::String& target_url, | 90 void ServicePortServiceImpl::Connect(const mojo::String& target_url, |
| 91 const mojo::String& origin, | 91 const mojo::String& origin, |
| 92 const ConnectCallback& callback) { | 92 const ConnectCallback& callback) { |
| 93 navigator_connect_context_->Connect( | 93 navigator_connect_context_->Connect( |
| 94 GURL(target_url), GURL(origin), this, | 94 GURL(target_url.get()), GURL(origin.get()), this, |
| 95 base::Bind(&ServicePortServiceImpl::OnConnectResult, | 95 base::Bind(&ServicePortServiceImpl::OnConnectResult, |
| 96 weak_ptr_factory_.GetWeakPtr(), callback)); | 96 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void ServicePortServiceImpl::PostMessageToPort( | 99 void ServicePortServiceImpl::PostMessageToPort( |
| 100 int32_t port_id, | 100 int32_t port_id, |
| 101 const mojo::String& message, | 101 const mojo::String& message, |
| 102 mojo::Array<MojoTransferredMessagePortPtr> ports) { | 102 mojo::Array<MojoTransferredMessagePortPtr> ports) { |
| 103 // TODO(mek): Similar to http://crbug.com/490222 this code should make sure | 103 // TODO(mek): Similar to http://crbug.com/490222 this code should make sure |
| 104 // port_id belongs to the process this IPC was received from. | 104 // port_id belongs to the process this IPC was received from. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 123 | 123 |
| 124 void ServicePortServiceImpl::OnConnectResult(const ConnectCallback& callback, | 124 void ServicePortServiceImpl::OnConnectResult(const ConnectCallback& callback, |
| 125 int message_port_id, | 125 int message_port_id, |
| 126 bool success) { | 126 bool success) { |
| 127 callback.Run(success ? SERVICE_PORT_CONNECT_RESULT_ACCEPT | 127 callback.Run(success ? SERVICE_PORT_CONNECT_RESULT_ACCEPT |
| 128 : SERVICE_PORT_CONNECT_RESULT_REJECT, | 128 : SERVICE_PORT_CONNECT_RESULT_REJECT, |
| 129 message_port_id); | 129 message_port_id); |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace content | 132 } // namespace content |
| OLD | NEW |