OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/application/application_runner_chromium.h" | 5 #include "mojo/application/application_runner_chromium.h" |
6 #include "mojo/common/binding_set.h" | 6 #include "mojo/common/binding_set.h" |
7 #include "mojo/public/c/system/main.h" | 7 #include "mojo/public/c/system/main.h" |
8 #include "mojo/public/cpp/application/application_connection.h" | 8 #include "mojo/public/cpp/application/application_connection.h" |
9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 void Initialize(mojo::ApplicationImpl* app) override { | 25 void Initialize(mojo::ApplicationImpl* app) override { |
26 mojo::ConnectToService(app->shell(), "mojo:network_service", | 26 mojo::ConnectToService(app->shell(), "mojo:network_service", |
27 GetProxy(&network_service_)); | 27 GetProxy(&network_service_)); |
28 mojo::ConnectToService(app->shell(), "mojo:files", GetProxy(&files_)); | 28 mojo::ConnectToService(app->shell(), "mojo:files", GetProxy(&files_)); |
29 | 29 |
30 app_url_ = app->url(); | 30 app_url_ = app->url(); |
31 } | 31 } |
32 | 32 |
33 bool ConfigureIncomingConnection( | 33 bool ConfigureIncomingConnection( |
34 mojo::ApplicationConnection* connection) override { | 34 mojo::ServiceProviderImpl* service_provider_impl) override { |
35 connection->GetServiceProviderImpl().AddService<AuthenticationService>( | 35 service_provider_impl->AddService<AuthenticationService>( |
36 [this](const mojo::ConnectionContext& connection_context, | 36 [this](const mojo::ConnectionContext& connection_context, |
37 mojo::InterfaceRequest<AuthenticationService> request) { | 37 mojo::InterfaceRequest<AuthenticationService> request) { |
38 mojo::files::Error error = mojo::files::Error::INTERNAL; | 38 mojo::files::Error error = mojo::files::Error::INTERNAL; |
39 mojo::files::DirectoryPtr directory; | 39 mojo::files::DirectoryPtr directory; |
40 files_->OpenFileSystem("app_persistent_cache", GetProxy(&directory), | 40 files_->OpenFileSystem("app_persistent_cache", GetProxy(&directory), |
41 [&error](mojo::files::Error e) { error = e; }); | 41 [&error](mojo::files::Error e) { error = e; }); |
42 CHECK(files_.WaitForIncomingResponse()); | 42 CHECK(files_.WaitForIncomingResponse()); |
43 if (mojo::files::Error::OK != error) { | 43 if (mojo::files::Error::OK != error) { |
44 LOG(FATAL) << "Unable to initialize accounts DB"; | 44 LOG(FATAL) << "Unable to initialize accounts DB"; |
45 } | 45 } |
(...skipping 11 matching lines...) Expand all Loading... |
57 DISALLOW_COPY_AND_ASSIGN(GoogleAccountManagerApp); | 57 DISALLOW_COPY_AND_ASSIGN(GoogleAccountManagerApp); |
58 }; | 58 }; |
59 | 59 |
60 } // namespace authentication | 60 } // namespace authentication |
61 | 61 |
62 MojoResult MojoMain(MojoHandle application_request) { | 62 MojoResult MojoMain(MojoHandle application_request) { |
63 mojo::ApplicationRunnerChromium runner( | 63 mojo::ApplicationRunnerChromium runner( |
64 new authentication::GoogleAccountManagerApp()); | 64 new authentication::GoogleAccountManagerApp()); |
65 return runner.Run(application_request); | 65 return runner.Run(application_request); |
66 } | 66 } |
OLD | NEW |