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

Side by Side Diff: mojo/shell/external_application_registrar_connection.h

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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_
6 #define MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_
7
8 #include "base/callback_forward.h"
9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "mojo/common/common_type_converters.h"
12 #include "mojo/edk/embedder/channel_init.h"
13 #include "mojo/public/cpp/bindings/error_handler.h"
14 #include "mojo/public/interfaces/application/application.mojom.h"
15 #include "mojo/public/interfaces/application/shell.mojom.h"
16 #include "mojo/shell/domain_socket/socket_descriptor.h"
17 #include "mojo/shell/domain_socket/unix_domain_client_socket_posix.h"
18 #include "mojo/shell/external_application_registrar.mojom.h"
19 #include "url/gurl.h"
20
21 namespace mojo {
22 namespace shell {
23
24 // Externally-running applications can use this class to discover and register
25 // with a running mojo_shell instance.
26 // MUST be run on an IO thread
27 class ExternalApplicationRegistrarConnection : public ErrorHandler {
28 public:
29 // Configures client_socket_ to point at socket_path.
30 explicit ExternalApplicationRegistrarConnection(
31 const base::FilePath& socket_path);
32 ~ExternalApplicationRegistrarConnection() override;
33
34 // Implementation of ErrorHandler
35 void OnConnectionError() override;
36
37 // Connects client_socket_ and binds it to registrar_.
38 // Status code is passed to callback upon success or failure.
39 // May return either synchronously or asynchronously, depending on the
40 // status of the underlying socket.
41 void Connect(const CompletionCallback& callback);
42
43 // Registers this app with the shell at the provided URL.
44 void Register(const GURL& app_url,
45 base::Callback<void(ShellPtr)> register_complete_callback);
46
47 private:
48 // Handles the result of Connect(). If it was successful, promotes the socket
49 // to a MessagePipe and binds it to registrar_.
50 // Hands rv to callback regardless.
51 void OnConnect(CompletionCallback callback, int rv);
52
53 scoped_ptr<UnixDomainClientSocket> client_socket_;
54 mojo::embedder::ChannelInit channel_init_;
55 ExternalApplicationRegistrarPtr registrar_;
56 };
57
58 } // namespace shell
59 } // namespace mojo
60
61 #endif // MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_
OLDNEW
« no previous file with comments | « mojo/shell/external_application_registrar.mojom ('k') | mojo/shell/external_application_registrar_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698