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_RENDERER_WEB_PRESCIENT_NETWORKING_IMPL_H_ 6 #define COMPONENTS_NETWORK_HINTS_RENDERER_WEB_PRESCIENT_NETWORKING_IMPL_H_ 7 8 #include "base/macros.h" 9 #include "components/network_hints/common/network_hints.mojom.h" 10 #include "components/network_hints/renderer/renderer_dns_prefetch.h" 11 #include "mojo/public/cpp/bindings/remote.h" 12 #include "third_party/blink/public/platform/web_prescient_networking.h" 13 14 namespace content { 15 class RenderFrame; 16 } 17 18 namespace network_hints { 19 20 // The main entry point from blink for sending DNS prefetch requests to the 21 // network stack. 22 class WebPrescientNetworkingImpl : public blink::WebPrescientNetworking { 23 public: 24 explicit WebPrescientNetworkingImpl(content::RenderFrame* render_frame); 25 ~WebPrescientNetworkingImpl() override; 26 27 // blink::WebPrescientNetworking methods: 28 void PrefetchDNS(const blink::WebString& hostname) override; 29 void Preconnect(const blink::WebURL& url, bool allow_credentials) override; 30 31 private: 32 mojo::Remote<mojom::NetworkHintsHandler> handler_; 33 RendererDnsPrefetch dns_prefetch_; 34 35 DISALLOW_COPY_AND_ASSIGN(WebPrescientNetworkingImpl); 36 }; 37 38 } // namespace network_hints 39 40 #endif // COMPONENTS_NETWORK_HINTS_RENDERER_WEB_PRESCIENT_NETWORKING_IMPL_H_ 41