| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 app_url_ = app->url(); | 33 app_url_ = app->url(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool ConfigureIncomingConnection( | 36 bool ConfigureIncomingConnection( |
| 37 mojo::ApplicationConnection* connection) override { | 37 mojo::ApplicationConnection* connection) override { |
| 38 connection->AddService<AuthenticationService>(this); | 38 connection->AddService<AuthenticationService>(this); |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void Create(mojo::ApplicationConnection* connection, | 42 void Create(const mojo::ConnectionContext& connection_context, |
| 43 mojo::InterfaceRequest<AuthenticationService> request) override { | 43 mojo::InterfaceRequest<AuthenticationService> request) override { |
| 44 mojo::files::Error error = mojo::files::Error::INTERNAL; | 44 mojo::files::Error error = mojo::files::Error::INTERNAL; |
| 45 mojo::files::DirectoryPtr directory; | 45 mojo::files::DirectoryPtr directory; |
| 46 files_->OpenFileSystem("app_persistent_cache", GetProxy(&directory), | 46 files_->OpenFileSystem("app_persistent_cache", GetProxy(&directory), |
| 47 [&error](mojo::files::Error e) { error = e; }); | 47 [&error](mojo::files::Error e) { error = e; }); |
| 48 CHECK(files_.WaitForIncomingResponse()); | 48 CHECK(files_.WaitForIncomingResponse()); |
| 49 if (mojo::files::Error::OK != error) { | 49 if (mojo::files::Error::OK != error) { |
| 50 LOG(FATAL) << "Unable to initialize accounts DB"; | 50 LOG(FATAL) << "Unable to initialize accounts DB"; |
| 51 } | 51 } |
| 52 new authentication::GoogleAuthenticationServiceImpl( | 52 new authentication::GoogleAuthenticationServiceImpl( |
| 53 request.Pass(), app_url_, network_service_, directory); | 53 request.Pass(), app_url_, network_service_, directory); |
| 54 } | 54 } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 mojo::NetworkServicePtr network_service_; | 57 mojo::NetworkServicePtr network_service_; |
| 58 mojo::files::FilesPtr files_; | 58 mojo::files::FilesPtr files_; |
| 59 std::string app_url_; | 59 std::string app_url_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(GoogleAccountManagerApp); | 61 DISALLOW_COPY_AND_ASSIGN(GoogleAccountManagerApp); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace authentication | 64 } // namespace authentication |
| 65 | 65 |
| 66 MojoResult MojoMain(MojoHandle application_request) { | 66 MojoResult MojoMain(MojoHandle application_request) { |
| 67 mojo::ApplicationRunnerChromium runner( | 67 mojo::ApplicationRunnerChromium runner( |
| 68 new authentication::GoogleAccountManagerApp()); | 68 new authentication::GoogleAccountManagerApp()); |
| 69 return runner.Run(application_request); | 69 return runner.Run(application_request); |
| 70 } | 70 } |
| OLD | NEW |