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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 private: | 44 private: |
45 std::string *user_; | 45 std::string *user_; |
46 }; | 46 }; |
47 | 47 |
48 class BankApp : public mojo::ApplicationDelegate, | 48 class BankApp : public mojo::ApplicationDelegate, |
49 public mojo::InterfaceFactory<Bank> { | 49 public mojo::InterfaceFactory<Bank> { |
50 public: | 50 public: |
51 BankApp() { | 51 BankApp() { |
52 } | 52 } |
53 void Initialize(mojo::ApplicationImpl* app) override { | 53 void Initialize(mojo::ApplicationImpl* app) override { |
54 app->ConnectToService("mojo:principal_service", &login_service_); | 54 app->ConnectToServiceDeprecated("mojo:principal_service", &login_service_); |
55 } | 55 } |
56 | 56 |
57 // From ApplicationDelegate | 57 // From ApplicationDelegate |
58 bool ConfigureIncomingConnection( | 58 bool ConfigureIncomingConnection( |
59 mojo::ApplicationConnection* connection) override { | 59 mojo::ApplicationConnection* connection) override { |
60 std::string url = connection->GetRemoteApplicationURL(); | 60 std::string url = connection->GetRemoteApplicationURL(); |
61 if (url.length() > 0) { | 61 if (url.length() > 0) { |
62 vanadium::AppInstanceNamePtr app(vanadium::AppInstanceName::New()); | 62 vanadium::AppInstanceNamePtr app(vanadium::AppInstanceName::New()); |
63 app->url = url; | 63 app->url = url; |
64 std::string user; | 64 std::string user; |
(...skipping 26 matching lines...) Expand all Loading... |
91 vanadium::PrincipalServicePtr login_service_; | 91 vanadium::PrincipalServicePtr login_service_; |
92 }; | 92 }; |
93 | 93 |
94 } // namespace examples | 94 } // namespace examples |
95 | 95 |
96 MojoResult MojoMain(MojoHandle application_request) { | 96 MojoResult MojoMain(MojoHandle application_request) { |
97 mojo::ApplicationRunner runner( | 97 mojo::ApplicationRunner runner( |
98 std::unique_ptr<examples::BankApp>(new examples::BankApp())); | 98 std::unique_ptr<examples::BankApp>(new examples::BankApp())); |
99 return runner.Run(application_request); | 99 return runner.Run(application_request); |
100 } | 100 } |
OLD | NEW |