| 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/common/weak_binding_set.h" | 10 #include "mojo/common/weak_binding_set.h" |
| 11 #include "mojo/shell/public/cpp/application_connection.h" | 11 #include "mojo/shell/public/cpp/application_connection.h" |
| 12 #include "mojo/shell/public/cpp/application_delegate.h" | 12 #include "mojo/shell/public/cpp/application_delegate.h" |
| 13 #include "mojo/shell/public/cpp/application_impl.h" | |
| 14 #include "mojo/shell/public/cpp/interface_factory.h" | 13 #include "mojo/shell/public/cpp/interface_factory.h" |
| 14 #include "mojo/shell/public/cpp/shell.h" |
| 15 #include "mojo/shell/runner/child/test_native_main.h" | 15 #include "mojo/shell/runner/child/test_native_main.h" |
| 16 #include "mojo/shell/runner/child/test_native_service.mojom.h" | 16 #include "mojo/shell/runner/child/test_native_service.mojom.h" |
| 17 #include "mojo/shell/runner/init.h" | 17 #include "mojo/shell/runner/init.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class TargetApplicationDelegate | 21 class TargetApplicationDelegate |
| 22 : public mojo::ApplicationDelegate, | 22 : public mojo::ApplicationDelegate, |
| 23 public mojo::shell::test::TestNativeService, | 23 public mojo::shell::test::TestNativeService, |
| 24 public mojo::InterfaceFactory<mojo::shell::test::TestNativeService> { | 24 public mojo::InterfaceFactory<mojo::shell::test::TestNativeService> { |
| 25 public: | 25 public: |
| 26 TargetApplicationDelegate() {} | 26 TargetApplicationDelegate() {} |
| 27 ~TargetApplicationDelegate() override {} | 27 ~TargetApplicationDelegate() override {} |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 // mojo::ApplicationDelegate: | 30 // mojo::ApplicationDelegate: |
| 31 void Initialize(mojo::ApplicationImpl* app) override {} | 31 void Initialize(mojo::Shell* shell, const std::string& url, |
| 32 uint32_t id) override {} |
| 32 bool AcceptConnection( | 33 bool AcceptConnection( |
| 33 mojo::ApplicationConnection* connection) override { | 34 mojo::ApplicationConnection* connection) override { |
| 34 connection->AddService<mojo::shell::test::TestNativeService>(this); | 35 connection->AddService<mojo::shell::test::TestNativeService>(this); |
| 35 return true; | 36 return true; |
| 36 } | 37 } |
| 37 | 38 |
| 38 // mojo::shell::test::TestNativeService: | 39 // mojo::shell::test::TestNativeService: |
| 39 void Invert(bool from_driver, const InvertCallback& callback) override { | 40 void Invert(bool from_driver, const InvertCallback& callback) override { |
| 40 callback.Run(!from_driver); | 41 callback.Run(!from_driver); |
| 41 } | 42 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 | 57 |
| 57 int main(int argc, char** argv) { | 58 int main(int argc, char** argv) { |
| 58 base::AtExitManager at_exit; | 59 base::AtExitManager at_exit; |
| 59 base::CommandLine::Init(argc, argv); | 60 base::CommandLine::Init(argc, argv); |
| 60 | 61 |
| 61 mojo::shell::InitializeLogging(); | 62 mojo::shell::InitializeLogging(); |
| 62 | 63 |
| 63 TargetApplicationDelegate delegate; | 64 TargetApplicationDelegate delegate; |
| 64 return mojo::shell::TestNativeMain(&delegate); | 65 return mojo::shell::TestNativeMain(&delegate); |
| 65 } | 66 } |
| OLD | NEW |