Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2022 The Chromium Authors |
Asami Doi | 67692613 | 2022-03-17 02:44:36 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Sreeja Kamishetty | c227f7a | 2022-07-08 22:33:15 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_PRELOADING_PRERENDER_PRERENDER_NAVIGATION_UTILS_H_ |
| 6 | #define CONTENT_BROWSER_PRELOADING_PRERENDER_PRERENDER_NAVIGATION_UTILS_H_ |
Asami Doi | 67692613 | 2022-03-17 02:44:36 | [diff] [blame] | 7 | |
Robert Lin | 20d947ed | 2022-08-25 06:01:28 | [diff] [blame] | 8 | #include "url/gurl.h" |
| 9 | #include "url/origin.h" |
| 10 | |
Asami Doi | 67692613 | 2022-03-17 02:44:36 | [diff] [blame] | 11 | namespace content::prerender_navigation_utils { |
| 12 | |
Asami Doi | 2a0b507 | 2022-04-25 08:23:42 | [diff] [blame] | 13 | // Returns true if the response code is disallowed for pre-rendering (e.g 404, |
| 14 | // etc), and false otherwise. This should be called only for the response of the |
| 15 | // main frame in a prerendered page. |
Asami Doi | 67692613 | 2022-03-17 02:44:36 | [diff] [blame] | 16 | bool IsDisallowedHttpResponseCode(int response_code); |
| 17 | |
Hiroki Nakagawa | a04ae18 | 2023-03-23 06:00:45 | [diff] [blame] | 18 | // Returns true if `target_url` is in the same site as `origin`. |
Robert Lin | 20d947ed | 2022-08-25 06:01:28 | [diff] [blame] | 19 | bool IsSameSite(const GURL& target_url, const url::Origin& origin); |
| 20 | |
Hiroki Nakagawa | a04ae18 | 2023-03-23 06:00:45 | [diff] [blame] | 21 | // Returns true if `target_url` is in the same site cross origin as `origin`. |
| 22 | bool IsSameSiteCrossOrigin(const GURL& target_url, const url::Origin& origin); |
| 23 | |
| 24 | // Returns true if `target_url` is not in the same site as `origin`. |
Hiroki Nakagawa | 849e9202c | 2023-03-22 08:19:17 | [diff] [blame] | 25 | bool IsCrossSite(const GURL& target_url, const url::Origin& origin); |
| 26 | |
Asami Doi | 67692613 | 2022-03-17 02:44:36 | [diff] [blame] | 27 | } // namespace content::prerender_navigation_utils |
| 28 | |
Sreeja Kamishetty | c227f7a | 2022-07-08 22:33:15 | [diff] [blame] | 29 | #endif // CONTENT_BROWSER_PRELOADING_PRERENDER_PRERENDER_NAVIGATION_UTILS_H_ |