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

Unified Diff: mojo/shell/public/cpp/lib/connector_impl.cc

Issue 1877753003: Move mojo\shell to services\shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@62scan
Patch Set: . Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/public/cpp/lib/connector_impl.h ('k') | mojo/shell/public/cpp/lib/identity.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/public/cpp/lib/connector_impl.cc
diff --git a/mojo/shell/public/cpp/lib/connector_impl.cc b/mojo/shell/public/cpp/lib/connector_impl.cc
deleted file mode 100644
index 3b16a0cd6216f80e6b6951459b86c26e8af5ce85..0000000000000000000000000000000000000000
--- a/mojo/shell/public/cpp/lib/connector_impl.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/shell/public/cpp/lib/connector_impl.h"
-
-#include "mojo/shell/public/cpp/identity.h"
-#include "mojo/shell/public/cpp/lib/connection_impl.h"
-
-namespace mojo {
-
-Connector::ConnectParams::ConnectParams(const Identity& target)
- : target_(target) {}
-Connector::ConnectParams::ConnectParams(const std::string& name)
- : target_(name, shell::mojom::kInheritUserID) {}
-Connector::ConnectParams::~ConnectParams() {}
-
-ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtrInfo unbound_state)
- : unbound_state_(std::move(unbound_state)) {}
-ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtr connector)
- : connector_(std::move(connector)) {
- thread_checker_.reset(new base::ThreadChecker);
-}
-ConnectorImpl::~ConnectorImpl() {}
-
-scoped_ptr<Connection> ConnectorImpl::Connect(const std::string& name) {
- ConnectParams params(name);
- return Connect(&params);
-}
-
-scoped_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) {
- // Bind this object to the current thread the first time it is used to
- // connect.
- if (!connector_.is_bound()) {
- if (!unbound_state_.is_valid()) {
- // It's possible to get here when the link to the shell has been severed
- // (and so the connector pipe has been closed) but the app has chosen not
- // to quit.
- return nullptr;
- }
- connector_.Bind(std::move(unbound_state_));
- thread_checker_.reset(new base::ThreadChecker);
- }
- DCHECK(thread_checker_->CalledOnValidThread());
-
- DCHECK(params);
- // We allow all interfaces on outgoing connections since we are presumably in
- // a position to know who we're talking to.
- CapabilityRequest request;
- request.interfaces.insert("*");
- shell::mojom::InterfaceProviderPtr local_interfaces;
- shell::mojom::InterfaceProviderRequest local_request =
- GetProxy(&local_interfaces);
- shell::mojom::InterfaceProviderPtr remote_interfaces;
- shell::mojom::InterfaceProviderRequest remote_request =
- GetProxy(&remote_interfaces);
- scoped_ptr<internal::ConnectionImpl> registry(new internal::ConnectionImpl(
- params->target().name(), params->target(),
- shell::mojom::kInvalidInstanceID, std::move(remote_interfaces),
- std::move(local_request), request, Connection::State::PENDING));
-
- shell::mojom::ShellClientPtr shell_client;
- shell::mojom::PIDReceiverRequest pid_receiver_request;
- params->TakeClientProcessConnection(&shell_client, &pid_receiver_request);
- shell::mojom::ClientProcessConnectionPtr client_process_connection;
- if (shell_client.is_bound() && pid_receiver_request.is_pending()) {
- client_process_connection = shell::mojom::ClientProcessConnection::New();
- client_process_connection->shell_client =
- shell_client.PassInterface().PassHandle();
- client_process_connection->pid_receiver_request =
- pid_receiver_request.PassMessagePipe();
- } else if (shell_client.is_bound() || pid_receiver_request.is_pending()) {
- NOTREACHED() << "If one of shell_client or pid_receiver_request is valid, "
- << "both must be valid.";
- return std::move(registry);
- }
- connector_->Connect(
- shell::mojom::Identity::From(params->target()),
- std::move(remote_request), std::move(local_interfaces),
- std::move(client_process_connection), registry->GetConnectCallback());
- return std::move(registry);
-}
-
-scoped_ptr<Connector> ConnectorImpl::Clone() {
- shell::mojom::ConnectorPtr connector;
- connector_->Clone(GetProxy(&connector));
- return make_scoped_ptr(
- new ConnectorImpl(connector.PassInterface()));
-}
-
-} // namespace mojo
« no previous file with comments | « mojo/shell/public/cpp/lib/connector_impl.h ('k') | mojo/shell/public/cpp/lib/identity.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698