blob: edf0ad28370b497401d63df11a1c7d9bc627d155 (
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
|
// Copyright 2015 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_PUBLIC_TEST_TEST_MOJO_APP_H_
#define CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_
#include "base/macros.h"
#include "content/public/test/test_mojo_service.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/shell/public/cpp/interface_factory.h"
#include "mojo/shell/public/cpp/shell_client.h"
#include "url/gurl.h"
namespace content {
extern const char kTestMojoAppUrl[];
// Simple Mojo app which provides a TestMojoService impl. The app terminates
// itself after its TestService fulfills a single DoSomething call.
class TestMojoApp : public mojo::ShellClient,
public mojo::InterfaceFactory<TestMojoService>,
public TestMojoService {
public:
TestMojoApp();
~TestMojoApp() override;
private:
// mojo::ShellClient:
void Initialize(mojo::Shell* shell, const std::string& url,
uint32_t id, uint32_t user_id) override;
bool AcceptConnection(mojo::Connection* connection) override;
// mojo::InterfaceFactory<TestMojoService>:
void Create(mojo::Connection* connection,
mojo::InterfaceRequest<TestMojoService> request) override;
// TestMojoService:
void DoSomething(const DoSomethingCallback& callback) override;
void GetRequestorURL(const GetRequestorURLCallback& callback) override;
mojo::Binding<TestMojoService> service_binding_;
// Not owned.
mojo::Shell* shell_;
// The URL of the app connecting to us.
GURL requestor_url_;
DISALLOW_COPY_AND_ASSIGN(TestMojoApp);
};
} // namespace
#endif // CONTENT_PUBLIC_TEST_TEST_MOJO_APP_H_
|