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 <dlfcn.h> | 5 #include <dlfcn.h> |
6 #include <python2.7/Python.h> | 6 #include <python2.7/Python.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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 public: | 206 public: |
207 PythonContentHandlerApp() | 207 PythonContentHandlerApp() |
208 : content_handler_(false), | 208 : content_handler_(false), |
209 debug_content_handler_(true), | 209 debug_content_handler_(true), |
210 content_handler_factory_(&content_handler_), | 210 content_handler_factory_(&content_handler_), |
211 debug_content_handler_factory_(&debug_content_handler_) {} | 211 debug_content_handler_factory_(&debug_content_handler_) {} |
212 | 212 |
213 private: | 213 private: |
214 // Overridden from ApplicationDelegate: | 214 // Overridden from ApplicationDelegate: |
215 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 215 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
216 if (IsDebug(connection->GetConnectionURL())) | 216 if (IsDebug(connection->GetServiceProviderImpl() |
| 217 .connection_context() |
| 218 .connection_url)) |
217 connection->AddService(&debug_content_handler_factory_); | 219 connection->AddService(&debug_content_handler_factory_); |
218 else | 220 else |
219 connection->AddService(&content_handler_factory_); | 221 connection->AddService(&content_handler_factory_); |
220 return true; | 222 return true; |
221 } | 223 } |
222 | 224 |
223 bool IsDebug(const std::string& requestedUrl) { | 225 bool IsDebug(const std::string& requestedUrl) { |
224 GURL url(requestedUrl); | 226 GURL url(requestedUrl); |
225 if (url.has_query()) { | 227 if (url.has_query()) { |
226 std::vector<std::string> query_parameters = base::SplitString( | 228 std::vector<std::string> query_parameters = base::SplitString( |
(...skipping 14 matching lines...) Expand all Loading... |
241 | 243 |
242 } // namespace content_handler | 244 } // namespace content_handler |
243 } // namespace python | 245 } // namespace python |
244 } // namespace services | 246 } // namespace services |
245 | 247 |
246 MojoResult MojoMain(MojoHandle application_request) { | 248 MojoResult MojoMain(MojoHandle application_request) { |
247 mojo::ApplicationRunnerChromium runner( | 249 mojo::ApplicationRunnerChromium runner( |
248 new services::python::content_handler::PythonContentHandlerApp()); | 250 new services::python::content_handler::PythonContentHandlerApp()); |
249 return runner.Run(application_request); | 251 return runner.Run(application_request); |
250 } | 252 } |
OLD | NEW |