OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/navigator_connect/service_port_provider.h" | 5 #include "content/child/navigator_connect/service_port_provider.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 const std::vector<TransferredMessagePort> ports) { | 102 const std::vector<TransferredMessagePort> ports) { |
103 GetServicePortServicePtr()->PostMessageToPort( | 103 GetServicePortServicePtr()->PostMessageToPort( |
104 port_id, mojo::String::From(message), | 104 port_id, mojo::String::From(message), |
105 mojo::Array<MojoTransferredMessagePortPtr>::From(ports)); | 105 mojo::Array<MojoTransferredMessagePortPtr>::From(ports)); |
106 } | 106 } |
107 | 107 |
108 void ServicePortProvider::OnConnectResult( | 108 void ServicePortProvider::OnConnectResult( |
109 scoped_ptr<blink::WebServicePortConnectCallbacks> callbacks, | 109 scoped_ptr<blink::WebServicePortConnectCallbacks> callbacks, |
110 ServicePortConnectResult result, | 110 ServicePortConnectResult result, |
111 int32_t port_id) { | 111 int32_t port_id) { |
112 if (result == SERVICE_PORT_CONNECT_RESULT_ACCEPT) { | 112 if (result == ServicePortConnectResult::ACCEPT) { |
113 callbacks->onSuccess(port_id); | 113 callbacks->onSuccess(port_id); |
114 } else { | 114 } else { |
115 callbacks->onError(); | 115 callbacks->onError(); |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 ServicePortServicePtr& ServicePortProvider::GetServicePortServicePtr() { | 119 ServicePortServicePtr& ServicePortProvider::GetServicePortServicePtr() { |
120 if (!service_port_service_.get()) { | 120 if (!service_port_service_.get()) { |
121 mojo::InterfaceRequest<ServicePortService> request = | 121 mojo::InterfaceRequest<ServicePortService> request = |
122 mojo::GetProxy(&service_port_service_); | 122 mojo::GetProxy(&service_port_service_); |
123 main_loop_->PostTask(FROM_HERE, base::Bind(&ConnectToServiceOnMainThread, | 123 main_loop_->PostTask(FROM_HERE, base::Bind(&ConnectToServiceOnMainThread, |
124 base::Passed(&request))); | 124 base::Passed(&request))); |
125 | 125 |
126 // Setup channel for browser to post events back to this class. | 126 // Setup channel for browser to post events back to this class. |
127 ServicePortServiceClientPtr client_ptr; | 127 ServicePortServiceClientPtr client_ptr; |
128 binding_.Bind(GetProxy(&client_ptr)); | 128 binding_.Bind(GetProxy(&client_ptr)); |
129 service_port_service_->SetClient(std::move(client_ptr)); | 129 service_port_service_->SetClient(std::move(client_ptr)); |
130 } | 130 } |
131 return service_port_service_; | 131 return service_port_service_; |
132 } | 132 } |
133 | 133 |
134 } // namespace content | 134 } // namespace content |
OLD | NEW |