| 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 <memory> | |
| 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/public/cpp/system/macros.h" | |
| 14 #include "mojo/services/authentication/interfaces/authentication.mojom.h" | |
| 15 | |
| 16 namespace authentication { | |
| 17 namespace { | |
| 18 | |
| 19 class DummyAuthenticationApplication | |
| 20 : public mojo::ApplicationDelegate, | |
| 21 public mojo::InterfaceFactory<AuthenticationService>, | |
| 22 public AuthenticationService { | |
| 23 public: | |
| 24 DummyAuthenticationApplication() {} | |
| 25 ~DummyAuthenticationApplication() override {} | |
| 26 | |
| 27 private: | |
| 28 // ApplicationDelegate implementation. | |
| 29 void Initialize(mojo::ApplicationImpl* app) override{}; | |
| 30 bool ConfigureIncomingConnection( | |
| 31 mojo::ApplicationConnection* connection) override { | |
| 32 connection->AddService<AuthenticationService>(this); | |
| 33 return true; | |
| 34 } | |
| 35 | |
| 36 // InterfaceFactory<AuthenticationService> implementation. | |
| 37 void Create(mojo::ApplicationConnection* connection, | |
| 38 mojo::InterfaceRequest<AuthenticationService> request) override { | |
| 39 bindings_.AddBinding(this, request.Pass()); | |
| 40 } | |
| 41 | |
| 42 // AuthenticationService implementation | |
| 43 void SelectAccount(bool return_last_selected, | |
| 44 const SelectAccountCallback& callback) override { | |
| 45 callback.Run(nullptr, "Not implemented"); | |
| 46 } | |
| 47 void GetOAuth2Token(const mojo::String& username, | |
| 48 mojo::Array<mojo::String> scopes, | |
| 49 const GetOAuth2TokenCallback& callback) override { | |
| 50 callback.Run(nullptr, "Not implemented"); | |
| 51 } | |
| 52 void ClearOAuth2Token(const mojo::String& token) override {} | |
| 53 | |
| 54 mojo::BindingSet<AuthenticationService> bindings_; | |
| 55 }; | |
| 56 | |
| 57 } // namespace | |
| 58 } // namespace authentication | |
| 59 | |
| 60 MojoResult MojoMain(MojoHandle application_request) { | |
| 61 mojo::ApplicationRunner runner( | |
| 62 std::unique_ptr<authentication::DummyAuthenticationApplication>( | |
| 63 new authentication::DummyAuthenticationApplication())); | |
| 64 return runner.Run(application_request); | |
| 65 } | |
| OLD | NEW |