Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: examples/bank_app/bank.cc

Issue 1975253002: ApplicationConnection devolution, part 2.1. (Closed) Base URL: https://github.com/domokit/mojo.git@work792-x-work791_service_registry_spimpl
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: examples/bank_app/bank.cc
diff --git a/examples/bank_app/bank.cc b/examples/bank_app/bank.cc
index 4593b13abafd040ced193526fc65991706e0da47..ea70adc2d9f70d2225690e73abeeee3f0f8b1c3f 100644
--- a/examples/bank_app/bank.cc
+++ b/examples/bank_app/bank.cc
@@ -12,7 +12,6 @@
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/application_runner.h"
#include "mojo/public/cpp/application/connect.h"
-#include "mojo/public/cpp/application/interface_factory.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/utility/run_loop.h"
#include "mojo/services/vanadium/security/interfaces/principal.mojom.h"
@@ -46,8 +45,7 @@ class BankUser {
std::string *user_;
};
-class BankApp : public mojo::ApplicationDelegate,
- public mojo::InterfaceFactory<Bank> {
+class BankApp : public mojo::ApplicationDelegate {
public:
BankApp() {}
@@ -79,15 +77,14 @@ class BankApp : public mojo::ApplicationDelegate,
}
MOJO_LOG(INFO) << "Customer " << user << " accessing bank";
}
- connection->AddService(this);
+ connection->GetServiceProviderImpl().AddService<Bank>(
+ [this](const mojo::ConnectionContext& connection_context,
+ mojo::InterfaceRequest<Bank> bank_request) {
+ bindings_.AddBinding(&bank_impl_, bank_request.Pass());
+ });
return true;
}
- void Create(const mojo::ConnectionContext& connection_context,
- mojo::InterfaceRequest<Bank> request) override {
- bindings_.AddBinding(&bank_impl_, request.Pass());
- }
-
private:
BankImpl bank_impl_;
mojo::BindingSet<Bank> bindings_;
« no previous file with comments | « examples/apptest/example_service_application.cc ('k') | examples/content_handler_demo/content_handler_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698