| 1 | // Copyright (c) 2013 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 | package org.chromium.components.navigation_interception; |
| 6 | |
| 7 | import org.chromium.base.CalledByNative; |
| 8 | |
| 9 | public class NavigationParams { |
| 10 | // Target url of the navigation. |
| 11 | public final String url; |
| 12 | // True if the the navigation method is "POST". |
| 13 | public final boolean isPost; |
| 14 | // True if the navigation was initiated by the user. |
| 15 | public final boolean hasUserGesture; |
| 16 | // Page transition type (e.g. link / typed). |
| 17 | public final int pageTransitionType; |
| 18 | // Is the navigation a redirect (in which case url is the "target" address). |
| 19 | public final boolean isRedirect; |
| 20 | |
| 21 | public NavigationParams(String url, boolean isPost, boolean hasUserGesture, |
| 22 | int pageTransitionType, boolean isRedirect) { |
| 23 | this.url = url; |
| 24 | this.isPost = isPost; |
| 25 | this.hasUserGesture = hasUserGesture; |
| 26 | this.pageTransitionType = pageTransitionType; |
| 27 | this.isRedirect = isRedirect; |
| 28 | } |
| 29 | |
| 30 | @CalledByNative |
| 31 | public static NavigationParams create(String url, boolean isPost, boolean hasUserGesture, |
| 32 | int pageTransitionType, boolean isRedirect) { |
| 33 | return new NavigationParams(url, isPost, hasUserGesture, pageTransitionType, |
| 34 | isRedirect); |
| 35 | } |
| 36 | } |