| 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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 #include "base/files/scoped_file.h" | 6 #include "base/files/scoped_file.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "mojo/application/application_runner_chromium.h" | 9 #include "mojo/application/application_runner_chromium.h" |
| 10 #include "mojo/application/content_handler_factory.h" | 10 #include "mojo/application/content_handler_factory.h" |
| 11 #include "mojo/data_pipe_utils/data_pipe_utils.h" | 11 #include "mojo/data_pipe_utils/data_pipe_utils.h" |
| 12 #include "mojo/message_pump/message_pump_mojo.h" | 12 #include "mojo/message_pump/message_pump_mojo.h" |
| 13 #include "mojo/nacl/sfi/nacl_bindings/monacl_sel_main.h" | 13 #include "mojo/nacl/sfi/nacl_bindings/monacl_sel_main.h" |
| 14 #include "mojo/public/c/system/main.h" | 14 #include "mojo/public/c/system/main.h" |
| 15 #include "mojo/public/cpp/application/application_connection.h" | 15 #include "mojo/public/cpp/application/application_connection.h" |
| 16 #include "mojo/public/cpp/application/application_delegate.h" | 16 #include "mojo/public/cpp/application/application_delegate.h" |
| 17 #include "mojo/public/cpp/application/application_impl.h" | 17 #include "mojo/public/cpp/application/application_impl.h" |
| 18 #include "mojo/public/cpp/application/connect.h" |
| 18 #include "mojo/services/network/interfaces/network_service.mojom.h" | 19 #include "mojo/services/network/interfaces/network_service.mojom.h" |
| 19 #include "mojo/services/network/interfaces/url_loader.mojom.h" | 20 #include "mojo/services/network/interfaces/url_loader.mojom.h" |
| 20 #include "native_client/src/public/nacl_desc.h" | 21 #include "native_client/src/public/nacl_desc.h" |
| 21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 22 | 23 |
| 23 namespace nacl { | 24 namespace nacl { |
| 24 namespace content_handler { | 25 namespace content_handler { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 base::ScopedFILE TempFileForURL(mojo::URLLoaderPtr& url_loader, | 28 base::ScopedFILE TempFileForURL(mojo::URLLoaderPtr& url_loader, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 public mojo::ContentHandlerFactory::Delegate { | 75 public mojo::ContentHandlerFactory::Delegate { |
| 75 public: | 76 public: |
| 76 NaClContentHandler() : content_handler_factory_(this) {} | 77 NaClContentHandler() : 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 url_ = GURL(app->url()); | 82 url_ = GURL(app->url()); |
| 82 | 83 |
| 83 mojo::NetworkServicePtr network_service; | 84 mojo::NetworkServicePtr network_service; |
| 84 app->ConnectToServiceDeprecated("mojo:network_service", &network_service); | 85 mojo::ConnectToService(app->shell(), "mojo:network_service", |
| 86 GetProxy(&network_service)); |
| 85 | 87 |
| 86 network_service->CreateURLLoader(GetProxy(&url_loader_)); | 88 network_service->CreateURLLoader(GetProxy(&url_loader_)); |
| 87 } | 89 } |
| 88 | 90 |
| 89 void LoadIRT(mojo::URLLoaderPtr& url_loader) { | 91 void LoadIRT(mojo::URLLoaderPtr& url_loader) { |
| 90 // TODO(ncbray): support other architectures. | 92 // TODO(ncbray): support other architectures. |
| 91 GURL irt_url; | 93 GURL irt_url; |
| 92 #if defined(ARCH_CPU_X86_64) | 94 #if defined(ARCH_CPU_X86_64) |
| 93 irt_url = url_.Resolve("irt_x64/irt_mojo.nexe"); | 95 irt_url = url_.Resolve("irt_x64/irt_mojo.nexe"); |
| 94 #else | 96 #else |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 }; | 148 }; |
| 147 | 149 |
| 148 } // namespace content_handler | 150 } // namespace content_handler |
| 149 } // namespace nacl | 151 } // namespace nacl |
| 150 | 152 |
| 151 MojoResult MojoMain(MojoHandle application_request) { | 153 MojoResult MojoMain(MojoHandle application_request) { |
| 152 mojo::ApplicationRunnerChromium runner( | 154 mojo::ApplicationRunnerChromium runner( |
| 153 new nacl::content_handler::NaClContentHandler()); | 155 new nacl::content_handler::NaClContentHandler()); |
| 154 return runner.Run(application_request); | 156 return runner.Run(application_request); |
| 155 } | 157 } |
| OLD | NEW |