| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 files_->OpenFileSystem("app_persistent_cache", | 44 files_->OpenFileSystem("app_persistent_cache", |
| 45 GetSynchronousProxy(&nexe_cache_directory_), | 45 GetSynchronousProxy(&nexe_cache_directory_), |
| 46 [&error](mojo::files::Error e) { error = e; }); | 46 [&error](mojo::files::Error e) { error = e; }); |
| 47 CHECK(files_.WaitForIncomingResponse()); | 47 CHECK(files_.WaitForIncomingResponse()); |
| 48 CHECK_EQ(mojo::files::Error::OK, error); | 48 CHECK_EQ(mojo::files::Error::OK, error); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Overridden from ApplicationDelegate: | 51 // Overridden from ApplicationDelegate: |
| 52 bool ConfigureIncomingConnection( | 52 bool ConfigureIncomingConnection( |
| 53 mojo::ApplicationConnection* connection) override { | 53 mojo::ApplicationConnection* connection) override { |
| 54 connection->AddService(&content_handler_factory_); | 54 connection->GetServiceProviderImpl().AddService<mojo::ContentHandler>( |
| 55 content_handler_factory_.GetInterfaceRequestHandler()); |
| 55 return true; | 56 return true; |
| 56 } | 57 } |
| 57 | 58 |
| 58 int AccessFileFromCache(std::string& digest) { | 59 int AccessFileFromCache(std::string& digest) { |
| 59 mojo::files::Error error = mojo::files::Error::INTERNAL; | 60 mojo::files::Error error = mojo::files::Error::INTERNAL; |
| 60 mojo::files::FilePtr nexe_cache_file; | 61 mojo::files::FilePtr nexe_cache_file; |
| 61 CHECK(nexe_cache_directory_->OpenFile(digest, GetProxy(&nexe_cache_file), | 62 CHECK(nexe_cache_directory_->OpenFile(digest, GetProxy(&nexe_cache_file), |
| 62 mojo::files::kOpenFlagRead, &error)); | 63 mojo::files::kOpenFlagRead, &error)); |
| 63 if (mojo::files::Error::OK == error) | 64 if (mojo::files::Error::OK == error) |
| 64 // Copy the mojo cached file into an open temporary file. | 65 // Copy the mojo cached file into an open temporary file. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 }; | 159 }; |
| 159 | 160 |
| 160 } // namespace content_handler | 161 } // namespace content_handler |
| 161 } // namespace nacl | 162 } // namespace nacl |
| 162 | 163 |
| 163 MojoResult MojoMain(MojoHandle application_request) { | 164 MojoResult MojoMain(MojoHandle application_request) { |
| 164 mojo::ApplicationRunnerChromium runner( | 165 mojo::ApplicationRunnerChromium runner( |
| 165 new nacl::content_handler::PexeContentHandler()); | 166 new nacl::content_handler::PexeContentHandler()); |
| 166 return runner.Run(application_request); | 167 return runner.Run(application_request); |
| 167 } | 168 } |
| OLD | NEW |