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

Unified Diff: mojo/shell/external_application_registrar_connection.cc

Issue 775343004: Move //mojo/shell to //shell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
Index: mojo/shell/external_application_registrar_connection.cc
diff --git a/mojo/shell/external_application_registrar_connection.cc b/mojo/shell/external_application_registrar_connection.cc
deleted file mode 100644
index 59519364b9117dc6252320001df5df587aca744d..0000000000000000000000000000000000000000
--- a/mojo/shell/external_application_registrar_connection.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2014 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/external_application_registrar_connection.h"
-
-#include "base/bind.h"
-#include "base/files/file_path.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "mojo/edk/embedder/channel_init.h"
-#include "mojo/public/cpp/bindings/error_handler.h"
-#include "mojo/public/interfaces/application/application.mojom.h"
-#include "mojo/public/interfaces/application/shell.mojom.h"
-#include "mojo/shell/domain_socket/net_errors.h"
-#include "mojo/shell/domain_socket/socket_descriptor.h"
-#include "mojo/shell/domain_socket/unix_domain_client_socket_posix.h"
-#include "mojo/shell/external_application_registrar.mojom.h"
-#include "url/gurl.h"
-
-namespace mojo {
-namespace shell {
-
-ExternalApplicationRegistrarConnection::ExternalApplicationRegistrarConnection(
- const base::FilePath& socket_path)
- : client_socket_(new UnixDomainClientSocket(socket_path.value(), false)) {
-}
-
-ExternalApplicationRegistrarConnection::
- ~ExternalApplicationRegistrarConnection() {
- channel_init_.WillDestroySoon();
-}
-
-void ExternalApplicationRegistrarConnection::OnConnectionError() {
- channel_init_.WillDestroySoon();
-}
-
-void ExternalApplicationRegistrarConnection::Connect(
- const CompletionCallback& callback) {
- DCHECK(client_socket_) << "Single use only.";
- int rv = client_socket_->Connect(
- base::Bind(&ExternalApplicationRegistrarConnection::OnConnect,
- base::Unretained(this),
- callback));
- if (rv != net::ERR_IO_PENDING) {
- DVLOG(1) << "Connect returning immediately: " << net::ErrorToString(rv);
- OnConnect(callback, rv);
- return;
- }
- DVLOG(1) << "Waiting for connection.";
-}
-
-void ExternalApplicationRegistrarConnection::Register(
- const GURL& app_url,
- base::Callback<void(ShellPtr)> register_complete_callback) {
- DCHECK(!client_socket_);
- registrar_->Register(String::From(app_url), register_complete_callback);
-}
-
-void ExternalApplicationRegistrarConnection::OnConnect(
- CompletionCallback callback,
- int rv) {
- DVLOG(1) << "OnConnect called: " << net::ErrorToString(rv);
- if (rv != net::OK) {
- callback.Run(rv);
- return;
- }
-
- mojo::ScopedMessagePipeHandle ptr_message_pipe_handle =
- channel_init_.Init(client_socket_->ReleaseConnectedSocket(),
- base::MessageLoopProxy::current());
- CHECK(ptr_message_pipe_handle.is_valid());
- client_socket_.reset(); // This is dead now, ensure it can't be reused.
-
- registrar_.Bind(ptr_message_pipe_handle.Pass());
- callback.Run(rv);
-}
-
-} // namespace shell
-} // namespace mojo
« no previous file with comments | « mojo/shell/external_application_registrar_connection.h ('k') | mojo/shell/external_application_test_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698