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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 mojo::files::Error error = mojo::files::Error::INTERNAL; | 43 mojo::files::Error error = mojo::files::Error::INTERNAL; |
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::ServiceProviderImpl* service_provider_impl) override { |
54 connection->GetServiceProviderImpl().AddService<mojo::ContentHandler>( | 54 service_provider_impl->AddService<mojo::ContentHandler>( |
55 content_handler_factory_.GetInterfaceRequestHandler()); | 55 content_handler_factory_.GetInterfaceRequestHandler()); |
56 return true; | 56 return true; |
57 } | 57 } |
58 | 58 |
59 int AccessFileFromCache(std::string& digest) { | 59 int AccessFileFromCache(std::string& digest) { |
60 mojo::files::Error error = mojo::files::Error::INTERNAL; | 60 mojo::files::Error error = mojo::files::Error::INTERNAL; |
61 mojo::files::FilePtr nexe_cache_file; | 61 mojo::files::FilePtr nexe_cache_file; |
62 CHECK(nexe_cache_directory_->OpenFile(digest, GetProxy(&nexe_cache_file), | 62 CHECK(nexe_cache_directory_->OpenFile(digest, GetProxy(&nexe_cache_file), |
63 mojo::files::kOpenFlagRead, &error)); | 63 mojo::files::kOpenFlagRead, &error)); |
64 if (mojo::files::Error::OK == error) | 64 if (mojo::files::Error::OK == error) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 }; | 159 }; |
160 | 160 |
161 } // namespace content_handler | 161 } // namespace content_handler |
162 } // namespace nacl | 162 } // namespace nacl |
163 | 163 |
164 MojoResult MojoMain(MojoHandle application_request) { | 164 MojoResult MojoMain(MojoHandle application_request) { |
165 mojo::ApplicationRunnerChromium runner( | 165 mojo::ApplicationRunnerChromium runner( |
166 new nacl::content_handler::PexeContentHandler()); | 166 new nacl::content_handler::PexeContentHandler()); |
167 return runner.Run(application_request); | 167 return runner.Run(application_request); |
168 } | 168 } |
OLD | NEW |