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" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 // Overridden from ApplicationDelegate: | 115 // Overridden from ApplicationDelegate: |
116 bool ConfigureIncomingConnection( | 116 bool ConfigureIncomingConnection( |
117 mojo::ApplicationConnection* connection) override { | 117 mojo::ApplicationConnection* connection) override { |
118 connection->AddService(&content_handler_factory_); | 118 connection->AddService(&content_handler_factory_); |
119 return true; | 119 return true; |
120 } | 120 } |
121 | 121 |
122 // Overridden from ContentHandlerFactory::ManagedDelegate: | 122 // Overridden from ContentHandlerFactory::Delegate: |
123 void RunApplication( | 123 void RunApplication( |
124 mojo::InterfaceRequest<mojo::Application> application_request, | 124 mojo::InterfaceRequest<mojo::Application> application_request, |
125 mojo::URLResponsePtr response) override { | 125 mojo::URLResponsePtr response) override { |
126 // Needed to use Mojo interfaces on this thread. | 126 // Needed to use Mojo interfaces on this thread. |
127 base::MessageLoop loop(mojo::common::MessagePumpMojo::Create()); | 127 base::MessageLoop loop(mojo::common::MessagePumpMojo::Create()); |
128 | 128 |
129 // Acquire the nexe. | 129 // Acquire the nexe. |
130 base::ScopedFILE nexe_fp = | 130 base::ScopedFILE nexe_fp = |
131 mojo::common::BlockingCopyToTempFile(response->body.Pass()); | 131 mojo::common::BlockingCopyToTempFile(response->body.Pass()); |
132 if (!nexe_fp) { | 132 if (!nexe_fp) { |
(...skipping 27 matching lines...) Expand all Loading... |
160 }; | 160 }; |
161 | 161 |
162 } // namespace content_handler | 162 } // namespace content_handler |
163 } // namespace nacl | 163 } // namespace nacl |
164 | 164 |
165 MojoResult MojoMain(MojoHandle application_request) { | 165 MojoResult MojoMain(MojoHandle application_request) { |
166 mojo::ApplicationRunnerChromium runner( | 166 mojo::ApplicationRunnerChromium runner( |
167 new nacl::content_handler::NaClContentHandler()); | 167 new nacl::content_handler::NaClContentHandler()); |
168 return runner.Run(application_request); | 168 return runner.Run(application_request); |
169 } | 169 } |
OLD | NEW |