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