Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: mojo/shell/public/cpp/lib/connector_impl.cc

Issue 1776513003: Allow client process information to be passed via Connector::Connect(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/shell/public/cpp/connector.h ('k') | mojo/shell/public/interfaces/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "mojo/shell/public/cpp/lib/connector_impl.h" 5 #include "mojo/shell/public/cpp/lib/connector_impl.h"
6 6
7 #include "mojo/shell/public/cpp/identity.h" 7 #include "mojo/shell/public/cpp/identity.h"
8 #include "mojo/shell/public/cpp/lib/connection_impl.h" 8 #include "mojo/shell/public/cpp/lib/connection_impl.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 shell::mojom::InterfaceProviderPtr local_interfaces; 54 shell::mojom::InterfaceProviderPtr local_interfaces;
55 shell::mojom::InterfaceProviderRequest local_request = 55 shell::mojom::InterfaceProviderRequest local_request =
56 GetProxy(&local_interfaces); 56 GetProxy(&local_interfaces);
57 shell::mojom::InterfaceProviderPtr remote_interfaces; 57 shell::mojom::InterfaceProviderPtr remote_interfaces;
58 shell::mojom::InterfaceProviderRequest remote_request = 58 shell::mojom::InterfaceProviderRequest remote_request =
59 GetProxy(&remote_interfaces); 59 GetProxy(&remote_interfaces);
60 scoped_ptr<internal::ConnectionImpl> registry(new internal::ConnectionImpl( 60 scoped_ptr<internal::ConnectionImpl> registry(new internal::ConnectionImpl(
61 params->target().name(), params->target(), 61 params->target().name(), params->target(),
62 shell::mojom::kInvalidInstanceID, std::move(remote_interfaces), 62 shell::mojom::kInvalidInstanceID, std::move(remote_interfaces),
63 std::move(local_request), allowed, Connection::State::PENDING)); 63 std::move(local_request), allowed, Connection::State::PENDING));
64
65 shell::mojom::ShellClientFactoryPtr shell_client_factory;
66 shell::mojom::PIDReceiverRequest pid_receiver_request;
67 params->TakeClientProcessConnection(&shell_client_factory,
68 &pid_receiver_request);
69 shell::mojom::ClientProcessConnectionPtr client_process_connection;
70 if (shell_client_factory.is_bound() && pid_receiver_request.is_pending()) {
71 client_process_connection = shell::mojom::ClientProcessConnection::New();
72 client_process_connection->shell_client_factory =
73 shell_client_factory.PassInterface().PassHandle();
74 client_process_connection->pid_receiver_request =
75 pid_receiver_request.PassMessagePipe();
76 } else if (shell_client_factory.is_bound() ||
77 pid_receiver_request.is_pending()) {
78 NOTREACHED() << "If one of shell_client_factory or pid_receiver_request is"
79 << "valid, both must be valid.";
80 return std::move(registry);
81 }
64 connector_->Connect( 82 connector_->Connect(
65 shell::mojom::Identity::From(params->target()), 83 shell::mojom::Identity::From(params->target()),
66 std::move(remote_request), std::move(local_interfaces), 84 std::move(remote_request), std::move(local_interfaces),
67 registry->GetConnectCallback()); 85 std::move(client_process_connection), registry->GetConnectCallback());
68 return std::move(registry); 86 return std::move(registry);
69 } 87 }
70 88
71 scoped_ptr<Connector> ConnectorImpl::Clone() { 89 scoped_ptr<Connector> ConnectorImpl::Clone() {
72 shell::mojom::ConnectorPtr connector; 90 shell::mojom::ConnectorPtr connector;
73 connector_->Clone(GetProxy(&connector)); 91 connector_->Clone(GetProxy(&connector));
74 return make_scoped_ptr( 92 return make_scoped_ptr(
75 new ConnectorImpl(connector.PassInterface())); 93 new ConnectorImpl(connector.PassInterface()));
76 } 94 }
77 95
78 } // namespace mojo 96 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/connector.h ('k') | mojo/shell/public/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698