blob: b20cd0ad4cb67e410ac21fa20f9b93872646b7ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// 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.
#ifndef CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
#define CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
#include <memory>
#include <vector>
#include "base/macros.h"
#include "content/public/common/mojo_shell_connection.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "services/shell/public/cpp/shell_client.h"
#include "services/shell/public/cpp/shell_connection.h"
#include "services/shell/public/interfaces/shell_client_factory.mojom.h"
namespace content {
class EmbeddedApplicationRunner;
class MojoShellConnectionImpl
: public MojoShellConnection,
public shell::ShellClient,
public shell::InterfaceFactory<shell::mojom::ShellClientFactory>,
public shell::mojom::ShellClientFactory {
public:
explicit MojoShellConnectionImpl(shell::mojom::ShellClientRequest request);
~MojoShellConnectionImpl() override;
private:
// MojoShellConnection:
shell::ShellConnection* GetShellConnection() override;
shell::Connector* GetConnector() override;
const shell::Identity& GetIdentity() const override;
void SetConnectionLostClosure(const base::Closure& closure) override;
void AddEmbeddedShellClient(
std::unique_ptr<shell::ShellClient> shell_client) override;
void AddEmbeddedShellClient(shell::ShellClient* shell_client) override;
void AddEmbeddedService(const std::string& name,
const MojoApplicationInfo& info) override;
void AddShellClientRequestHandler(
const std::string& name,
const ShellClientRequestHandler& handler) override;
// shell::ShellClient:
void Initialize(shell::Connector* connector,
const shell::Identity& identity,
uint32_t id) override;
bool AcceptConnection(shell::Connection* connection) override;
shell::InterfaceRegistry* GetInterfaceRegistryForConnection() override;
shell::InterfaceProvider* GetInterfaceProviderForConnection() override;
// shell::InterfaceFactory<shell::mojom::ShellClientFactory>:
void Create(shell::Connection* connection,
shell::mojom::ShellClientFactoryRequest request) override;
// shell::mojom::ShellClientFactory:
void CreateShellClient(shell::mojom::ShellClientRequest request,
const mojo::String& name) override;
std::unique_ptr<shell::ShellConnection> shell_connection_;
mojo::BindingSet<shell::mojom::ShellClientFactory> factory_bindings_;
std::vector<shell::ShellClient*> embedded_shell_clients_;
std::vector<std::unique_ptr<shell::ShellClient>> owned_shell_clients_;
std::unordered_map<std::string, std::unique_ptr<EmbeddedApplicationRunner>>
embedded_apps_;
std::unordered_map<std::string, ShellClientRequestHandler> request_handlers_;
DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl);
};
} // namespace content
#endif // CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
|