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

Unified Diff: services/authentication/main.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: services/authentication/main.cc
diff --git a/services/authentication/main.cc b/services/authentication/main.cc
index dd77d3500da09903d63f7d9017d1736f79c93e0a..331d3066b58a6dc0f56426d876f5560aa2f70e6f 100644
--- a/services/authentication/main.cc
+++ b/services/authentication/main.cc
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mojo/application/application_runner_chromium.h"
#include "mojo/common/binding_set.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/application/service_provider_impl.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/system/macros.h"
@@ -17,20 +16,18 @@
namespace authentication {
-class GoogleAccountManagerApp : public mojo::ApplicationDelegate {
+class GoogleAccountManagerApp : public mojo::ApplicationImplBase {
public:
GoogleAccountManagerApp() {}
~GoogleAccountManagerApp() override {}
- void Initialize(mojo::ApplicationImpl* app) override {
- mojo::ConnectToService(app->shell(), "mojo:network_service",
+ void OnInitialize() override {
+ mojo::ConnectToService(shell(), "mojo:network_service",
GetProxy(&network_service_));
- mojo::ConnectToService(app->shell(), "mojo:files", GetProxy(&files_));
-
- app_url_ = app->url();
+ mojo::ConnectToService(shell(), "mojo:files", GetProxy(&files_));
}
- bool ConfigureIncomingConnection(
+ bool OnAcceptConnection(
mojo::ServiceProviderImpl* service_provider_impl) override {
service_provider_impl->AddService<AuthenticationService>(
[this](const mojo::ConnectionContext& connection_context,
@@ -44,7 +41,7 @@ class GoogleAccountManagerApp : public mojo::ApplicationDelegate {
LOG(FATAL) << "Unable to initialize accounts DB";
}
new authentication::GoogleAuthenticationServiceImpl(
- request.Pass(), app_url_, network_service_, directory);
+ request.Pass(), url(), network_service_, directory);
});
return true;
}
@@ -52,7 +49,6 @@ class GoogleAccountManagerApp : public mojo::ApplicationDelegate {
private:
mojo::NetworkServicePtr network_service_;
mojo::files::FilesPtr files_;
- std::string app_url_;
DISALLOW_COPY_AND_ASSIGN(GoogleAccountManagerApp);
};
@@ -60,7 +56,7 @@ class GoogleAccountManagerApp : public mojo::ApplicationDelegate {
} // namespace authentication
MojoResult MojoMain(MojoHandle application_request) {
- mojo::ApplicationRunnerChromium runner(
- new authentication::GoogleAccountManagerApp());
- return runner.Run(application_request);
+ authentication::GoogleAccountManagerApp google_account_manager_app;
+ return mojo::RunMainApplication(application_request,
+ &google_account_manager_app);
}

Powered by Google App Engine
This is Rietveld 408576698