OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_NETWORK_HINTS_BROWSER_NETWORK_HINTS_MESSAGE_FILTER_H_ | |
6 #define COMPONENTS_NETWORK_HINTS_BROWSER_NETWORK_HINTS_MESSAGE_FILTER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "components/network_hints/public/interfaces/network_hints.mojom.h" | |
10 #include "mojo/public/cpp/bindings/binding_set.h" | |
11 | |
12 namespace net { | |
13 class HostResolver; | |
14 } | |
15 | |
16 namespace network_hints { | |
17 struct LookupRequest; | |
18 | |
19 // Simple browser-side handler for DNS prefetch requests. | |
20 // Passes prefetch requests to the provided net::HostResolver. | |
21 // Each renderer process requires its own filter. | |
22 class NetworkHintsImpl : public network_hints::mojom::NetworkHints { | |
23 public: | |
24 explicit NetworkHintsImpl(net::HostResolver* host_resolver); | |
25 ~NetworkHintsImpl() override; | |
26 | |
27 void Bind(mojo::InterfaceRequest<mojom::NetworkHints> request); | |
28 | |
29 private: | |
30 // network_hints::mojom::NetworkHints implementation: | |
31 void DNSPrefetch(const LookupRequest& lookup_request) override; | |
32 void Preconnect(const GURL& url, | |
33 bool allow_credentials, | |
34 int32_t count) override {} | |
35 | |
36 net::HostResolver* host_resolver_; | |
37 | |
38 mojo::BindingSet<mojom::NetworkHints> bindings_; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(NetworkHintsImpl); | |
41 }; | |
42 | |
43 } // namespace network_hints | |
44 | |
45 #endif // COMPONENTS_NETWORK_HINTS_BROWSER_NETWORK_HINTS_MESSAGE_FILTER_H_ | |
OLD | NEW |