blob: 215f496caec51e7d54ec69106e69e5013c278de3 (
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
|
// 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/examples/surfaces_app/child_impl.h"
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/bindings/string.h"
namespace mojo {
namespace examples {
class ChildApp : public ApplicationDelegate, public InterfaceFactory<Child> {
public:
ChildApp() {}
virtual ~ChildApp() {}
virtual void Initialize(ApplicationImpl* app) OVERRIDE {
surfaces_service_connection_ =
app->ConnectToApplication("mojo:mojo_surfaces_service");
}
// ApplicationDelegate implementation.
virtual bool ConfigureIncomingConnection(
ApplicationConnection* connection) OVERRIDE {
connection->AddService(this);
return true;
}
// InterfaceFactory<Child> implementation.
virtual void Create(ApplicationConnection* connection,
InterfaceRequest<Child> request) OVERRIDE {
BindToRequest(new ChildImpl(surfaces_service_connection_), &request);
}
private:
ApplicationConnection* surfaces_service_connection_;
DISALLOW_COPY_AND_ASSIGN(ChildApp);
};
} // namespace examples
// static
ApplicationDelegate* ApplicationDelegate::Create() {
return new examples::ChildApp();
}
} // namespace mojo
|