Iman Saboori | 12579792 | 2022-11-15 03:35:34 | [diff] [blame] | 1 | // Copyright 2022 The Chromium Authors |
| 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 CONTENT_BROWSER_PRELOADING_PRECONNECTOR_H_ |
| 6 | #define CONTENT_BROWSER_PRELOADING_PRECONNECTOR_H_ |
| 7 | |
| 8 | #include "content/common/content_export.h" |
| 9 | #include "content/public/browser/anchor_element_preconnect_delegate.h" |
| 10 | #include "url/gurl.h" |
| 11 | |
| 12 | namespace content { |
| 13 | |
| 14 | class RenderFrameHost; |
| 15 | |
| 16 | // Handles heuristics based preconnects. |
| 17 | // TODO(isaboori): Implement the preconnect logic directly in content/browser |
| 18 | // and remove the delegate. |
| 19 | class CONTENT_EXPORT Preconnector { |
| 20 | public: |
| 21 | Preconnector() = delete; |
Johann | a9fe85f | 2023-01-17 10:15:43 | [diff] [blame] | 22 | explicit Preconnector(RenderFrameHost& render_frame_host); |
Iman Saboori | 12579792 | 2022-11-15 03:35:34 | [diff] [blame] | 23 | ~Preconnector(); |
| 24 | |
| 25 | void MaybePreconnect(const GURL& url); |
| 26 | |
| 27 | private: |
| 28 | std::unique_ptr<AnchorElementPreconnectDelegate> preconnect_delegate_; |
| 29 | }; |
| 30 | |
| 31 | } // namespace content |
| 32 | |
| 33 | #endif // CONTENT_BROWSER_PRELOADING_PRECONNECTOR_H_ |