Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <cstdlib> | |
|
jamesr
2015/08/17 21:38:22
we generally use the <blahblah.h> headers instead
gautham
2015/08/18 01:54:22
Removed file.
| |
| 6 | |
| 7 #include "mojo/common/binding_set.h" | |
| 8 #include "mojo/public/c/system/main.h" | |
| 9 #include "mojo/public/cpp/application/application_connection.h" | |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | |
| 11 #include "mojo/public/cpp/application/application_runner.h" | |
| 12 #include "mojo/public/cpp/application/interface_factory.h" | |
| 13 #include "mojo/services/vanadium/security/public/interfaces/principal.mojom.h" | |
| 14 | |
| 15 namespace mojo { | |
|
jamesr
2015/08/17 21:38:22
no "mojo". namespace should match directory struct
gautham
2015/08/18 01:54:22
Removed file.
| |
| 16 namespace services { | |
| 17 namespace vanadium { | |
| 18 namespace security { | |
| 19 | |
| 20 // This is a native Mojo application which implements |PrincipalService| | |
| 21 // interface for Linux. | |
|
jamesr
2015/08/17 21:38:22
what about this is Linux-specific?
gautham
2015/08/18 01:54:22
Removed file.
| |
| 22 class PrincipalServiceImpl : public ApplicationDelegate, | |
| 23 public PrincipalService, | |
| 24 public InterfaceFactory<PrincipalService> { | |
| 25 public: | |
| 26 PrincipalServiceImpl() { | |
| 27 CertificatePtr cert(Certificate::New()); | |
| 28 cert->extension = "default"; | |
| 29 default_blessing_.chain.push_back(cert.Pass()); | |
| 30 } | |
| 31 | |
| 32 void Login(const LoginCallback& callback) override { | |
| 33 callback.Run(default_blessing_.Clone()); | |
| 34 } | |
| 35 | |
| 36 void Logout() override { | |
| 37 } | |
| 38 | |
| 39 void Sign(mojo::Array<uint8_t> message, | |
| 40 const SignCallback& callback) override { | |
| 41 } | |
| 42 | |
| 43 void GetUserBlessing(AppInstanceNamePtr app, | |
| 44 const GetUserBlessingCallback& callback) override { | |
| 45 callback.Run(default_blessing_.Clone()); | |
| 46 } | |
| 47 | |
| 48 // |ApplicationDelegate| override. | |
| 49 bool ConfigureIncomingConnection( | |
| 50 mojo::ApplicationConnection* connection) override { | |
| 51 connection->AddService<mojo::PrincipalService>(this); | |
|
jamesr
2015/08/17 21:38:22
you don't need to spell out the template parameter
gautham
2015/08/18 01:54:22
Removed file.
| |
| 52 return true; | |
| 53 } | |
| 54 | |
| 55 // |InterfaceFactory<PrincipalService>| implementation. | |
| 56 void Create(mojo::ApplicationConnection* connection, | |
| 57 mojo::InterfaceRequest<mojo::PrincipalService> request) override { | |
| 58 binding_.AddBinding(this, request.Pass()); | |
| 59 } | |
| 60 | |
| 61 private: | |
| 62 mojo::BindingSet<mojo::PrincipalService> binding_; | |
|
jamesr
2015/08/17 21:38:22
this means every connection to the PrincipalServic
gautham
2015/08/18 01:54:22
Removed file.
| |
| 63 mojo::Blessing default_blessing_; | |
| 64 }; | |
| 65 | |
| 66 } // namespace security | |
| 67 } // namespace vanadium | |
| 68 } // namespace services | |
| 69 } // namespace mojo | |
| 70 | |
| 71 MojoResult MojoMain(MojoHandle application_request) { | |
| 72 mojo::ApplicationRunner runner( | |
| 73 new mojo::services::vanadium::security::PrincipalServiceImpl()); | |
| 74 return runner.Run(application_request); | |
| 75 } | |
| OLD | NEW |