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_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 45 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
46 request->url = url.spec(); | 46 request->url = url.spec(); |
47 request->method = "GET"; | 47 request->method = "GET"; |
48 request->auto_follow_redirects = true; | 48 request->auto_follow_redirects = true; |
49 | 49 |
50 // Handle the callback synchonously. | 50 // Handle the callback synchonously. |
51 mojo::URLResponsePtr response; | 51 mojo::URLResponsePtr response; |
52 url_loader->Start(request.Pass(), [&response](mojo::URLResponsePtr r) { | 52 url_loader->Start(request.Pass(), [&response](mojo::URLResponsePtr r) { |
53 response = r.Pass(); | 53 response = r.Pass(); |
54 }); | 54 }); |
55 url_loader.WaitForIncomingMethodCall(); | 55 url_loader.WaitForIncomingResponse(); |
56 if (response.is_null()) { | 56 if (response.is_null()) { |
57 LOG(FATAL) << "something went horribly wrong (missed a callback?)"; | 57 LOG(FATAL) << "something went horribly wrong (missed a callback?)"; |
58 } | 58 } |
59 | 59 |
60 if (response->error) { | 60 if (response->error) { |
61 LOG(ERROR) << "could not load " << url.spec() << " (" | 61 LOG(ERROR) << "could not load " << url.spec() << " (" |
62 << response->error->code << ") " | 62 << response->error->code << ") " |
63 << response->error->description.get().c_str(); | 63 << response->error->description.get().c_str(); |
64 return false; | 64 return false; |
65 } | 65 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 }; | 172 }; |
173 | 173 |
174 } // namespace content_handler | 174 } // namespace content_handler |
175 } // namespace nacl | 175 } // namespace nacl |
176 | 176 |
177 MojoResult MojoMain(MojoHandle application_request) { | 177 MojoResult MojoMain(MojoHandle application_request) { |
178 mojo::ApplicationRunnerChromium runner( | 178 mojo::ApplicationRunnerChromium runner( |
179 new nacl::content_handler::NaClContentHandler()); | 179 new nacl::content_handler::NaClContentHandler()); |
180 return runner.Run(application_request); | 180 return runner.Run(application_request); |
181 } | 181 } |
OLD | NEW |