| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <python2.7/Python.h> | 5 #include <python2.7/Python.h> |
| 6 #include <dlfcn.h> | 6 #include <dlfcn.h> |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 GURL url(app->url()); | 55 GURL url(app->url()); |
| 56 if (url.has_query()) { | 56 if (url.has_query()) { |
| 57 std::vector<std::string> query_parameters; | 57 std::vector<std::string> query_parameters; |
| 58 Tokenize(url.query(), "&", &query_parameters); | 58 Tokenize(url.query(), "&", &query_parameters); |
| 59 debug_ = std::find(query_parameters.begin(), query_parameters.end(), | 59 debug_ = std::find(query_parameters.begin(), query_parameters.end(), |
| 60 "debug=true") != query_parameters.end(); | 60 "debug=true") != query_parameters.end(); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Overridden from ApplicationDelegate: | 64 // Overridden from ApplicationDelegate: |
| 65 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 65 bool ConfigureIncomingConnection(ApplicationConnection* connection, const std:
:string& url) override { |
| 66 connection->AddService(&content_handler_factory_); | 66 connection->AddService(&content_handler_factory_); |
| 67 return true; | 67 return true; |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Extracts the target application into a temporary directory. This directory | 70 // Extracts the target application into a temporary directory. This directory |
| 71 // is deleted at the end of the life of the PythonContentHandler object. | 71 // is deleted at the end of the life of the PythonContentHandler object. |
| 72 std::unique_ptr<base::ScopedTempDir> ExtractApplication( | 72 std::unique_ptr<base::ScopedTempDir> ExtractApplication( |
| 73 URLResponsePtr response) { | 73 URLResponsePtr response) { |
| 74 std::unique_ptr<base::ScopedTempDir> temp_dir(new base::ScopedTempDir); | 74 std::unique_ptr<base::ScopedTempDir> temp_dir(new base::ScopedTempDir); |
| 75 CHECK(temp_dir->CreateUniqueTempDir()); | 75 CHECK(temp_dir->CreateUniqueTempDir()); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 } // namespace content_handler | 226 } // namespace content_handler |
| 227 } // namespace python | 227 } // namespace python |
| 228 } // namespace services | 228 } // namespace services |
| 229 | 229 |
| 230 MojoResult MojoMain(MojoHandle shell_handle) { | 230 MojoResult MojoMain(MojoHandle shell_handle) { |
| 231 mojo::ApplicationRunnerChromium runner( | 231 mojo::ApplicationRunnerChromium runner( |
| 232 new services::python::content_handler::PythonContentHandler()); | 232 new services::python::content_handler::PythonContentHandler()); |
| 233 return runner.Run(shell_handle); | 233 return runner.Run(shell_handle); |
| 234 } | 234 } |
| OLD | NEW |