| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <fcntl.h> | 5 #include <fcntl.h> |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "mojo/application/application_runner_chromium.h" | 10 #include "mojo/application/application_runner_chromium.h" |
| 11 #include "mojo/application/content_handler_factory.h" | 11 #include "mojo/application/content_handler_factory.h" |
| 12 #include "mojo/data_pipe_utils/data_pipe_utils.h" | 12 #include "mojo/data_pipe_utils/data_pipe_utils.h" |
| 13 #include "mojo/file_utils/file_util.h" | 13 #include "mojo/file_utils/file_util.h" |
| 14 #include "mojo/message_pump/message_pump_mojo.h" | 14 #include "mojo/message_pump/message_pump_mojo.h" |
| 15 #include "mojo/nacl/nonsfi/file_util.h" | 15 #include "mojo/nacl/nonsfi/file_util.h" |
| 16 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" | 16 #include "mojo/nacl/nonsfi/nexe_launcher_nonsfi.h" |
| 17 #include "mojo/public/c/system/main.h" | 17 #include "mojo/public/c/system/main.h" |
| 18 #include "mojo/public/cpp/application/application_impl.h" | 18 #include "mojo/public/cpp/application/application_impl.h" |
| 19 #include "mojo/public/cpp/application/connect.h" |
| 19 #include "mojo/public/cpp/bindings/array.h" | 20 #include "mojo/public/cpp/bindings/array.h" |
| 20 #include "mojo/services/files/interfaces/files.mojom.h" | 21 #include "mojo/services/files/interfaces/files.mojom.h" |
| 21 #include "services/nacl/nonsfi/pnacl_compile.mojom.h" | 22 #include "services/nacl/nonsfi/pnacl_compile.mojom.h" |
| 22 #include "services/nacl/nonsfi/pnacl_link.mojom.h" | 23 #include "services/nacl/nonsfi/pnacl_link.mojom.h" |
| 23 | 24 |
| 24 namespace nacl { | 25 namespace nacl { |
| 25 namespace content_handler { | 26 namespace content_handler { |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 class CompilerUI { | 29 class CompilerUI { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } // namespace anonymous | 72 } // namespace anonymous |
| 72 | 73 |
| 73 class PexeContentHandler : public mojo::ApplicationDelegate, | 74 class PexeContentHandler : public mojo::ApplicationDelegate, |
| 74 public mojo::ContentHandlerFactory::Delegate { | 75 public mojo::ContentHandlerFactory::Delegate { |
| 75 public: | 76 public: |
| 76 PexeContentHandler() : content_handler_factory_(this) {} | 77 PexeContentHandler() : content_handler_factory_(this) {} |
| 77 | 78 |
| 78 private: | 79 private: |
| 79 // Overridden from ApplicationDelegate: | 80 // Overridden from ApplicationDelegate: |
| 80 void Initialize(mojo::ApplicationImpl* app) override { | 81 void Initialize(mojo::ApplicationImpl* app) override { |
| 81 app->ConnectToServiceDeprecated("mojo:pnacl_compile", &compiler_init_); | 82 mojo::ConnectToService(app->shell(), "mojo:pnacl_compile", |
| 82 app->ConnectToServiceDeprecated("mojo:pnacl_link", &linker_init_); | 83 GetProxy(&compiler_init_)); |
| 83 app->ConnectToServiceDeprecated("mojo:files", &files_); | 84 mojo::ConnectToService(app->shell(), "mojo:pnacl_link", |
| 85 GetProxy(&linker_init_)); |
| 86 mojo::ConnectToService(app->shell(), "mojo:files", GetProxy(&files_)); |
| 84 mojo::files::Error error = mojo::files::Error::INTERNAL; | 87 mojo::files::Error error = mojo::files::Error::INTERNAL; |
| 85 files_->OpenFileSystem("app_persistent_cache", | 88 files_->OpenFileSystem("app_persistent_cache", |
| 86 GetProxy(&nexe_cache_directory), | 89 GetProxy(&nexe_cache_directory), |
| 87 [&error](mojo::files::Error e) { error = e; }); | 90 [&error](mojo::files::Error e) { error = e; }); |
| 88 CHECK(files_.WaitForIncomingResponse()); | 91 CHECK(files_.WaitForIncomingResponse()); |
| 89 CHECK_EQ(mojo::files::Error::OK, error); | 92 CHECK_EQ(mojo::files::Error::OK, error); |
| 90 } | 93 } |
| 91 | 94 |
| 92 // Overridden from ApplicationDelegate: | 95 // Overridden from ApplicationDelegate: |
| 93 bool ConfigureIncomingConnection( | 96 bool ConfigureIncomingConnection( |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 }; | 213 }; |
| 211 | 214 |
| 212 } // namespace content_handler | 215 } // namespace content_handler |
| 213 } // namespace nacl | 216 } // namespace nacl |
| 214 | 217 |
| 215 MojoResult MojoMain(MojoHandle application_request) { | 218 MojoResult MojoMain(MojoHandle application_request) { |
| 216 mojo::ApplicationRunnerChromium runner( | 219 mojo::ApplicationRunnerChromium runner( |
| 217 new nacl::content_handler::PexeContentHandler()); | 220 new nacl::content_handler::PexeContentHandler()); |
| 218 return runner.Run(application_request); | 221 return runner.Run(application_request); |
| 219 } | 222 } |
| OLD | NEW |