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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "mojo/common/binding_set.h" | 8 #include "mojo/common/binding_set.h" |
9 #include "mojo/public/cpp/bindings/interface_request.h" | 9 #include "mojo/public/cpp/bindings/interface_request.h" |
10 #include "mojo/public/cpp/bindings/strong_binding.h" | 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
11 #include "mojo/services/http_server/interfaces/http_request.mojom.h" | 11 #include "mojo/services/http_server/interfaces/http_request.mojom.h" |
12 #include "mojo/services/http_server/interfaces/http_response.mojom.h" | 12 #include "mojo/services/http_server/interfaces/http_response.mojom.h" |
13 #include "mojo/services/http_server/interfaces/http_server.mojom.h" | 13 #include "mojo/services/http_server/interfaces/http_server.mojom.h" |
14 #include "mojo/services/network/interfaces/net_address.mojom.h" | 14 #include "mojo/services/network/interfaces/net_address.mojom.h" |
15 #include "mojo/services/network/interfaces/network_service.mojom.h" | 15 #include "mojo/services/network/interfaces/network_service.mojom.h" |
16 #include "third_party/re2/re2/re2.h" | 16 #include "third_party/re2/re2/re2.h" |
17 | 17 |
18 namespace mojo { | 18 namespace mojo { |
19 class ApplicationImpl; | 19 class Shell; |
20 } // namespace mojo | 20 } // namespace mojo |
21 | 21 |
22 namespace http_server { | 22 namespace http_server { |
23 | 23 |
24 class Connection; | 24 class Connection; |
25 class HttpServerFactoryImpl; | 25 class HttpServerFactoryImpl; |
26 | 26 |
27 class HttpServerImpl : public HttpServer { | 27 class HttpServerImpl : public HttpServer { |
28 public: | 28 public: |
29 HttpServerImpl(mojo::ApplicationImpl* app, | 29 // TODO(vtl): Possibly this should take an |
| 30 // |InterfaceHandle<ApplicationConnector>| instead of a |Shell*|. |
| 31 HttpServerImpl(mojo::Shell* shell, |
30 HttpServerFactoryImpl* factory, | 32 HttpServerFactoryImpl* factory, |
31 mojo::NetAddressPtr requested_local_address); | 33 mojo::NetAddressPtr requested_local_address); |
32 ~HttpServerImpl() override; | 34 ~HttpServerImpl() override; |
33 | 35 |
34 void AddBinding(mojo::InterfaceRequest<HttpServer> request); | 36 void AddBinding(mojo::InterfaceRequest<HttpServer> request); |
35 | 37 |
36 // HttpServer: | 38 // HttpServer: |
37 void SetHandler(const mojo::String& path, | 39 void SetHandler(const mojo::String& path, |
38 mojo::InterfaceHandle<HttpHandler> http_handler, | 40 mojo::InterfaceHandle<HttpHandler> http_handler, |
39 const mojo::Callback<void(bool)>& callback) override; | 41 const mojo::Callback<void(bool)>& callback) override; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 89 |
88 // TODO(vtl): Maybe this should be an std::set or unordered_set, which would | 90 // TODO(vtl): Maybe this should be an std::set or unordered_set, which would |
89 // simplify OnHandlerConnectionError(). | 91 // simplify OnHandlerConnectionError(). |
90 ScopedVector<Handler> handlers_; | 92 ScopedVector<Handler> handlers_; |
91 | 93 |
92 base::WeakPtrFactory<HttpServerImpl> weak_ptr_factory_; | 94 base::WeakPtrFactory<HttpServerImpl> weak_ptr_factory_; |
93 DISALLOW_COPY_AND_ASSIGN(HttpServerImpl); | 95 DISALLOW_COPY_AND_ASSIGN(HttpServerImpl); |
94 }; | 96 }; |
95 | 97 |
96 } // namespace http_server | 98 } // namespace http_server |
OLD | NEW |