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_SIMPLE_NETWORK_HINTS_HANDLER_IMPL_H_
6 #define COMPONENTS_NETWORK_HINTS_BROWSER_SIMPLE_NETWORK_HINTS_HANDLER_IMPL_H_
7 
8 #include "base/macros.h"
9 #include "components/network_hints/common/network_hints.mojom.h"
10 
11 namespace content {
12 class RenderFrameHost;
13 }
14 
15 namespace network_hints {
16 
17 // Simple browser-side handler for DNS prefetch requests.
18 // Each renderer process requires its own filter.
19 class SimpleNetworkHintsHandlerImpl : public mojom::NetworkHintsHandler {
20  public:
21   SimpleNetworkHintsHandlerImpl(int render_process_id, int render_frame_id);
22   ~SimpleNetworkHintsHandlerImpl() override;
23 
24   static void Create(
25       content::RenderFrameHost* frame_host,
26       mojo::PendingReceiver<mojom::NetworkHintsHandler> receiver);
27 
28   // mojom::NetworkHintsHandler methods:
29   void PrefetchDNS(const std::vector<std::string>& names) override;
30   void Preconnect(const GURL& url, bool allow_credentials) override;
31 
32  private:
33   const int render_process_id_;
34   const int render_frame_id_;
35 
36   DISALLOW_COPY_AND_ASSIGN(SimpleNetworkHintsHandlerImpl);
37 };
38 
39 }  // namespace network_hints
40 
41 #endif  // COMPONENTS_NETWORK_HINTS_BROWSER_SIMPLE_NETWORK_HINTS_HANDLER_IMPL_H_
42