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

Unified Diff: examples/http_handler/http_handler.cc

Issue 2005103003: Add implementations of mojo::{Run,Terminate}[Main]Application() for "chromium". (Closed) Base URL: https://github.com/domokit/mojo.git@master
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/http_handler/http_handler.cc
diff --git a/examples/http_handler/http_handler.cc b/examples/http_handler/http_handler.cc
index af4a4cfec552736114604d7ebddffec2078351b9..95fe142e453aefbd1bdf7d3275ea74d3309b624a 100644
--- a/examples/http_handler/http_handler.cc
+++ b/examples/http_handler/http_handler.cc
@@ -3,11 +3,10 @@
// found in the LICENSE file.
#include "base/bind.h"
-#include "mojo/application/application_runner_chromium.h"
#include "mojo/public/c/system/main.h"
-#include "mojo/public/cpp/application/application_delegate.h"
-#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/application/application_impl_base.h"
#include "mojo/public/cpp/application/connect.h"
+#include "mojo/public/cpp/application/run_application.h"
#include "mojo/public/cpp/bindings/interface_ptr.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "mojo/services/http_server/cpp/http_server_util.h"
@@ -21,20 +20,20 @@ namespace examples {
// This is an example of a self-contained HTTP handler. It uses the HTTP Server
// service to handle the HTTP protocol details, and just contains the logic for
// handling its registered urls.
-class HttpHandler : public ApplicationDelegate,
+class HttpHandler : public ApplicationImplBase,
public http_server::HttpHandler {
public:
HttpHandler() : binding_(this) {}
~HttpHandler() override {}
private:
- // ApplicationDelegate:
- void Initialize(ApplicationImpl* app) override {
+ // ApplicationImplBase override:
+ void OnInitialize() override {
http_server::HttpHandlerPtr http_handler_ptr;
binding_.Bind(GetProxy(&http_handler_ptr));
http_server::HttpServerFactoryPtr http_server_factory;
- ConnectToService(app->shell(), "mojo:http_server",
+ ConnectToService(shell(), "mojo:http_server",
GetProxy(&http_server_factory));
mojo::NetAddressPtr local_address(mojo::NetAddress::New());
@@ -76,6 +75,6 @@ class HttpHandler : public ApplicationDelegate,
} // namespace mojo
MojoResult MojoMain(MojoHandle application_request) {
- mojo::ApplicationRunnerChromium runner(new mojo::examples::HttpHandler());
- return runner.Run(application_request);
+ mojo::examples::HttpHandler http_handler;
+ return mojo::RunMainApplication(application_request, &http_handler);
}

Powered by Google App Engine
This is Rietveld 408576698