OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "mojo/public/cpp/bindings/binding_set.h" | 10 #include "mojo/public/cpp/bindings/binding_set.h" |
11 #include "mojo/shell/public/cpp/connection.h" | 11 #include "mojo/shell/public/cpp/connection.h" |
12 #include "mojo/shell/public/cpp/interface_factory.h" | 12 #include "mojo/shell/public/cpp/interface_factory.h" |
13 #include "mojo/shell/public/cpp/shell.h" | |
14 #include "mojo/shell/public/cpp/shell_client.h" | 13 #include "mojo/shell/public/cpp/shell_client.h" |
15 #include "mojo/shell/runner/child/test_native_main.h" | 14 #include "mojo/shell/runner/child/test_native_main.h" |
16 #include "mojo/shell/runner/child/test_native_service.mojom.h" | 15 #include "mojo/shell/runner/child/test_native_service.mojom.h" |
17 #include "mojo/shell/runner/init.h" | 16 #include "mojo/shell/runner/init.h" |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 class TargetApplicationDelegate | 20 class TargetApplicationDelegate |
22 : public mojo::ShellClient, | 21 : public mojo::ShellClient, |
23 public mojo::shell::test::TestNativeService, | 22 public mojo::shell::test::TestNativeService, |
24 public mojo::InterfaceFactory<mojo::shell::test::TestNativeService> { | 23 public mojo::InterfaceFactory<mojo::shell::test::TestNativeService> { |
25 public: | 24 public: |
26 TargetApplicationDelegate() {} | 25 TargetApplicationDelegate() {} |
27 ~TargetApplicationDelegate() override {} | 26 ~TargetApplicationDelegate() override {} |
28 | 27 |
29 private: | 28 private: |
30 // mojo::ShellClient: | 29 // mojo::ShellClient: |
31 void Initialize(mojo::Shell* shell, const std::string& url, | |
32 uint32_t id, uint32_t user_id) override {} | |
33 bool AcceptConnection(mojo::Connection* connection) override { | 30 bool AcceptConnection(mojo::Connection* connection) override { |
34 connection->AddInterface<mojo::shell::test::TestNativeService>(this); | 31 connection->AddInterface<mojo::shell::test::TestNativeService>(this); |
35 return true; | 32 return true; |
36 } | 33 } |
37 | 34 |
38 // mojo::shell::test::TestNativeService: | 35 // mojo::shell::test::TestNativeService: |
39 void Invert(bool from_driver, const InvertCallback& callback) override { | 36 void Invert(bool from_driver, const InvertCallback& callback) override { |
40 callback.Run(!from_driver); | 37 callback.Run(!from_driver); |
41 } | 38 } |
42 | 39 |
(...skipping 13 matching lines...) Expand all Loading... |
56 | 53 |
57 int main(int argc, char** argv) { | 54 int main(int argc, char** argv) { |
58 base::AtExitManager at_exit; | 55 base::AtExitManager at_exit; |
59 base::CommandLine::Init(argc, argv); | 56 base::CommandLine::Init(argc, argv); |
60 | 57 |
61 mojo::shell::InitializeLogging(); | 58 mojo::shell::InitializeLogging(); |
62 | 59 |
63 TargetApplicationDelegate delegate; | 60 TargetApplicationDelegate delegate; |
64 return mojo::shell::TestNativeMain(&delegate); | 61 return mojo::shell::TestNativeMain(&delegate); |
65 } | 62 } |
OLD | NEW |