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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "examples/bank_app/bank.mojom.h" | 7 #include "examples/bank_app/bank.mojom.h" |
8 #include "mojo/common/binding_set.h" | 8 #include "mojo/common/binding_set.h" |
9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 if (user.empty()) { | 75 if (user.empty()) { |
76 MOJO_LOG(INFO) << "Rejecting customer without a user identity"; | 76 MOJO_LOG(INFO) << "Rejecting customer without a user identity"; |
77 return false; | 77 return false; |
78 } | 78 } |
79 MOJO_LOG(INFO) << "Customer " << user << " accessing bank"; | 79 MOJO_LOG(INFO) << "Customer " << user << " accessing bank"; |
80 } | 80 } |
81 connection->AddService(this); | 81 connection->AddService(this); |
82 return true; | 82 return true; |
83 } | 83 } |
84 | 84 |
85 void Create(mojo::ApplicationConnection* connection, | 85 void Create(const mojo::ConnectionContext& connection_context, |
86 mojo::InterfaceRequest<Bank> request) override { | 86 mojo::InterfaceRequest<Bank> request) override { |
87 bindings_.AddBinding(&bank_impl_, request.Pass()); | 87 bindings_.AddBinding(&bank_impl_, request.Pass()); |
88 } | 88 } |
89 | 89 |
90 private: | 90 private: |
91 BankImpl bank_impl_; | 91 BankImpl bank_impl_; |
92 mojo::BindingSet<Bank> bindings_; | 92 mojo::BindingSet<Bank> bindings_; |
93 vanadium::PrincipalServicePtr login_service_; | 93 vanadium::PrincipalServicePtr login_service_; |
94 }; | 94 }; |
95 | 95 |
96 } // namespace examples | 96 } // namespace examples |
97 | 97 |
98 MojoResult MojoMain(MojoHandle application_request) { | 98 MojoResult MojoMain(MojoHandle application_request) { |
99 mojo::ApplicationRunner runner( | 99 mojo::ApplicationRunner runner( |
100 std::unique_ptr<examples::BankApp>(new examples::BankApp())); | 100 std::unique_ptr<examples::BankApp>(new examples::BankApp())); |
101 return runner.Run(application_request); | 101 return runner.Run(application_request); |
102 } | 102 } |
OLD | NEW |