| 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 "services/http_server/http_server_impl.h" | 5 #include "services/http_server/http_server_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "mojo/public/cpp/application/application_impl.h" | 11 #include "mojo/public/cpp/application/application_impl.h" |
| 12 #include "mojo/public/cpp/application/connect.h" |
| 12 #include "mojo/public/cpp/system/data_pipe.h" | 13 #include "mojo/public/cpp/system/data_pipe.h" |
| 13 #include "mojo/services/http_server/cpp/http_server_util.h" | 14 #include "mojo/services/http_server/cpp/http_server_util.h" |
| 14 #include "services/http_server/connection.h" | 15 #include "services/http_server/connection.h" |
| 15 #include "services/http_server/http_server_factory_impl.h" | 16 #include "services/http_server/http_server_factory_impl.h" |
| 16 | 17 |
| 17 namespace http_server { | 18 namespace http_server { |
| 18 | 19 |
| 19 HttpServerImpl::HttpServerImpl(mojo::ApplicationImpl* app, | 20 HttpServerImpl::HttpServerImpl(mojo::ApplicationImpl* app, |
| 20 HttpServerFactoryImpl* factory, | 21 HttpServerFactoryImpl* factory, |
| 21 mojo::NetAddressPtr requested_local_address) | 22 mojo::NetAddressPtr requested_local_address) |
| 22 : factory_(factory), | 23 : factory_(factory), |
| 23 requested_local_address_(requested_local_address.Pass()), | 24 requested_local_address_(requested_local_address.Pass()), |
| 24 assigned_port_(0), | 25 assigned_port_(0), |
| 25 weak_ptr_factory_(this) { | 26 weak_ptr_factory_(this) { |
| 26 app->ConnectToServiceDeprecated("mojo:network_service", &network_service_); | 27 mojo::ConnectToService(app->shell(), "mojo:network_service", |
| 28 GetProxy(&network_service_)); |
| 27 Start(); | 29 Start(); |
| 28 } | 30 } |
| 29 | 31 |
| 30 HttpServerImpl::~HttpServerImpl() { | 32 HttpServerImpl::~HttpServerImpl() { |
| 31 } | 33 } |
| 32 | 34 |
| 33 void HttpServerImpl::AddBinding(mojo::InterfaceRequest<HttpServer> request) { | 35 void HttpServerImpl::AddBinding(mojo::InterfaceRequest<HttpServer> request) { |
| 34 bindings_.AddBinding(this, request.Pass()); | 36 bindings_.AddBinding(this, request.Pass()); |
| 35 } | 37 } |
| 36 | 38 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 165 |
| 164 HttpServerImpl::Handler::Handler(const std::string& pattern, | 166 HttpServerImpl::Handler::Handler(const std::string& pattern, |
| 165 HttpHandlerPtr http_handler) | 167 HttpHandlerPtr http_handler) |
| 166 : pattern(new RE2(pattern.c_str())), http_handler(http_handler.Pass()) { | 168 : pattern(new RE2(pattern.c_str())), http_handler(http_handler.Pass()) { |
| 167 } | 169 } |
| 168 | 170 |
| 169 HttpServerImpl::Handler::~Handler() { | 171 HttpServerImpl::Handler::~Handler() { |
| 170 } | 172 } |
| 171 | 173 |
| 172 } // namespace http_server | 174 } // namespace http_server |
| OLD | NEW |