| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "mojo/public/cpp/bindings/binding_set.h" | 8 #include "mojo/public/cpp/bindings/binding_set.h" |
| 9 #include "services/shell/public/cpp/connection.h" | 9 #include "services/shell/public/cpp/connection.h" |
| 10 #include "services/shell/public/cpp/connector.h" | 10 #include "services/shell/public/cpp/connector.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const shell::Identity& identity, | 31 const shell::Identity& identity, |
| 32 uint32_t id) override { | 32 uint32_t id) override { |
| 33 identity_ = identity; | 33 identity_ = identity; |
| 34 } | 34 } |
| 35 bool OnConnect(shell::Connection* connection) override { | 35 bool OnConnect(shell::Connection* connection) override { |
| 36 connection->AddInterface<ConnectTestService>(this); | 36 connection->AddInterface<ConnectTestService>(this); |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // shell::InterfaceFactory<ConnectTestService>: | 40 // shell::InterfaceFactory<ConnectTestService>: |
| 41 void Create(shell::Connection* connection, | 41 void Create(const shell::Identity& remote_identity, |
| 42 ConnectTestServiceRequest request) override { | 42 ConnectTestServiceRequest request) override { |
| 43 bindings_.AddBinding(this, std::move(request)); | 43 bindings_.AddBinding(this, std::move(request)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 // ConnectTestService: | 46 // ConnectTestService: |
| 47 void GetTitle(const GetTitleCallback& callback) override { | 47 void GetTitle(const GetTitleCallback& callback) override { |
| 48 callback.Run("connect_test_exe"); | 48 callback.Run("connect_test_exe"); |
| 49 } | 49 } |
| 50 void GetInstance(const GetInstanceCallback& callback) override { | 50 void GetInstance(const GetInstanceCallback& callback) override { |
| 51 callback.Run(identity_.instance()); | 51 callback.Run(identity_.instance()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 shell::Identity identity_; | 54 shell::Identity identity_; |
| 55 mojo::BindingSet<ConnectTestService> bindings_; | 55 mojo::BindingSet<ConnectTestService> bindings_; |
| 56 | 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(Target); | 57 DISALLOW_COPY_AND_ASSIGN(Target); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 int main(int argc, char** argv) { | 62 int main(int argc, char** argv) { |
| 63 base::AtExitManager at_exit; | 63 base::AtExitManager at_exit; |
| 64 base::CommandLine::Init(argc, argv); | 64 base::CommandLine::Init(argc, argv); |
| 65 | 65 |
| 66 shell::InitializeLogging(); | 66 shell::InitializeLogging(); |
| 67 | 67 |
| 68 Target target; | 68 Target target; |
| 69 return shell::TestNativeMain(&target); | 69 return shell::TestNativeMain(&target); |
| 70 } | 70 } |
| OLD | NEW |