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

Side by Side Diff: services/shell/public/cpp/lib/connection_impl.h

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 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
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 SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
7
8 #include <stdint.h>
9
10 #include <set>
11 #include <string>
12
13 #include "base/callback.h"
14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "services/shell/public/cpp/capabilities.h"
16 #include "services/shell/public/cpp/connection.h"
17 #include "services/shell/public/cpp/identity.h"
18 #include "services/shell/public/interfaces/connector.mojom.h"
19 #include "services/shell/public/interfaces/interface_provider.mojom.h"
20
21 namespace shell {
22 namespace internal {
23
24 // A ConnectionImpl represents each half of a connection between two
25 // applications, allowing customization of which interfaces are published to the
26 // other.
27 class ConnectionImpl : public Connection {
28 public:
29 ConnectionImpl();
30 ConnectionImpl(const Identity& remote, State initial_state);
31 ~ConnectionImpl() override;
32
33 // Sets the remote provider, transferring ownership to the ConnectionImpl.
34 void SetRemoteInterfaces(
35 std::unique_ptr<InterfaceProvider> remote_interfaces);
36
37 // Sets the remote provider, without transferring ownership.
38 void set_remote_interfaces(InterfaceProvider* remote_interfaces) {
39 remote_interfaces_ = remote_interfaces;
40 }
41
42 shell::mojom::Connector::ConnectCallback GetConnectCallback();
43
44 private:
45 // Connection:
46 const Identity& GetRemoteIdentity() const override;
47 void SetConnectionLostClosure(const base::Closure& handler) override;
48 shell::mojom::ConnectResult GetResult() const override;
49 bool IsPending() const override;
50 void AddConnectionCompletedClosure(const base::Closure& callback) override;
51 InterfaceProvider* GetRemoteInterfaces() override;
52 base::WeakPtr<Connection> GetWeakPtr() override;
53
54 void OnConnectionCompleted(shell::mojom::ConnectResult result,
55 const std::string& target_user_id);
56
57 Identity remote_;
58
59 State state_;
60 shell::mojom::ConnectResult result_ = shell::mojom::ConnectResult::SUCCEEDED;
61 std::vector<base::Closure> connection_completed_callbacks_;
62
63 InterfaceProvider* remote_interfaces_ = nullptr;
64
65 std::unique_ptr<InterfaceProvider> remote_interfaces_owner_;
66
67 base::WeakPtrFactory<ConnectionImpl> weak_factory_;
68
69 DISALLOW_COPY_AND_ASSIGN(ConnectionImpl);
70 };
71
72 } // namespace internal
73 } // namespace shell
74
75 #endif // SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
OLDNEW
« no previous file with comments | « services/shell/public/cpp/lib/capabilities.cc ('k') | services/shell/public/cpp/lib/connection_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698