OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.externalnav; | 5 package org.chromium.chrome.browser.externalnav; |
6 | 6 |
7 import org.chromium.chrome.browser.Tab; | 7 import org.chromium.chrome.browser.Tab; |
8 import org.chromium.chrome.browser.tab.TabRedirectHandler; | 8 import org.chromium.chrome.browser.tab.TabRedirectHandler; |
9 import org.chromium.chrome.browser.tab.TransitionPageHelper; | 9 import org.chromium.chrome.browser.tab.TransitionPageHelper; |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 private final TransitionPageHelper mTransitionPageHelper; | 37 private final TransitionPageHelper mTransitionPageHelper; |
38 | 38 |
39 private final Tab mTab; | 39 private final Tab mTab; |
40 | 40 |
41 /** Whether the intent should force a new tab to open. */ | 41 /** Whether the intent should force a new tab to open. */ |
42 private final boolean mOpenInNewTab; | 42 private final boolean mOpenInNewTab; |
43 | 43 |
44 /** Whether this navigation happens in background tab. */ | 44 /** Whether this navigation happens in background tab. */ |
45 private final boolean mIsBackgroundTabNavigation; | 45 private final boolean mIsBackgroundTabNavigation; |
46 | 46 |
| 47 /** Whether this navigation happens in main frame. */ |
| 48 private final boolean mIsMainFrame; |
| 49 |
47 private ExternalNavigationParams(String url, boolean isIncognito, String ref
errerUrl, | 50 private ExternalNavigationParams(String url, boolean isIncognito, String ref
errerUrl, |
48 int pageTransition, boolean isRedirect, boolean appMustBeInForegroun
d, | 51 int pageTransition, boolean isRedirect, boolean appMustBeInForegroun
d, |
49 TabRedirectHandler redirectHandler, TransitionPageHelper transitionP
ageHelper, Tab tab, | 52 TabRedirectHandler redirectHandler, TransitionPageHelper transitionP
ageHelper, Tab tab, |
50 boolean openInNewTab, boolean isBackgroundTabNavigation) { | 53 boolean openInNewTab, boolean isBackgroundTabNavigation, boolean isM
ainFrame) { |
51 mUrl = url; | 54 mUrl = url; |
52 mIsIncognito = isIncognito; | 55 mIsIncognito = isIncognito; |
53 mPageTransition = pageTransition; | 56 mPageTransition = pageTransition; |
54 mReferrerUrl = referrerUrl; | 57 mReferrerUrl = referrerUrl; |
55 mIsRedirect = isRedirect; | 58 mIsRedirect = isRedirect; |
56 mApplicationMustBeInForeground = appMustBeInForeground; | 59 mApplicationMustBeInForeground = appMustBeInForeground; |
57 mRedirectHandler = redirectHandler; | 60 mRedirectHandler = redirectHandler; |
58 mTransitionPageHelper = transitionPageHelper; | 61 mTransitionPageHelper = transitionPageHelper; |
59 mTab = tab; | 62 mTab = tab; |
60 mOpenInNewTab = openInNewTab; | 63 mOpenInNewTab = openInNewTab; |
61 mIsBackgroundTabNavigation = isBackgroundTabNavigation; | 64 mIsBackgroundTabNavigation = isBackgroundTabNavigation; |
| 65 mIsMainFrame = isMainFrame; |
62 } | 66 } |
63 | 67 |
64 /** @return The URL to potentially open externally. */ | 68 /** @return The URL to potentially open externally. */ |
65 public String getUrl() { | 69 public String getUrl() { |
66 return mUrl; | 70 return mUrl; |
67 } | 71 } |
68 | 72 |
69 /** @return Whether we are currently in incognito mode. */ | 73 /** @return Whether we are currently in incognito mode. */ |
70 public boolean isIncognito() { | 74 public boolean isIncognito() { |
71 return mIsIncognito; | 75 return mIsIncognito; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 */ | 116 */ |
113 public boolean isOpenInNewTab() { | 117 public boolean isOpenInNewTab() { |
114 return mOpenInNewTab; | 118 return mOpenInNewTab; |
115 } | 119 } |
116 | 120 |
117 /** @return Whether this navigation happens in background tab. */ | 121 /** @return Whether this navigation happens in background tab. */ |
118 public boolean isBackgroundTabNavigation() { | 122 public boolean isBackgroundTabNavigation() { |
119 return mIsBackgroundTabNavigation; | 123 return mIsBackgroundTabNavigation; |
120 } | 124 } |
121 | 125 |
| 126 /** @return Whether this navigation happens in main frame. */ |
| 127 public boolean isMainFrame() { |
| 128 return mIsMainFrame; |
| 129 } |
| 130 |
122 /** The builder for {@link ExternalNavigationParams} objects. */ | 131 /** The builder for {@link ExternalNavigationParams} objects. */ |
123 public static class Builder { | 132 public static class Builder { |
124 /** The URL which we are navigating to. */ | 133 /** The URL which we are navigating to. */ |
125 private String mUrl; | 134 private String mUrl; |
126 | 135 |
127 /** Whether we are currently in an incognito context. */ | 136 /** Whether we are currently in an incognito context. */ |
128 private boolean mIsIncognito; | 137 private boolean mIsIncognito; |
129 | 138 |
130 /** The referrer URL for the current navigation. */ | 139 /** The referrer URL for the current navigation. */ |
131 private String mReferrerUrl; | 140 private String mReferrerUrl; |
(...skipping 14 matching lines...) Expand all Loading... |
146 private TransitionPageHelper mTransitionPageHelper; | 155 private TransitionPageHelper mTransitionPageHelper; |
147 | 156 |
148 private Tab mTab; | 157 private Tab mTab; |
149 | 158 |
150 /** Whether the intent should force a new tab to open. */ | 159 /** Whether the intent should force a new tab to open. */ |
151 private boolean mOpenInNewTab; | 160 private boolean mOpenInNewTab; |
152 | 161 |
153 /** Whether this navigation happens in background tab. */ | 162 /** Whether this navigation happens in background tab. */ |
154 private boolean mIsBackgroundTabNavigation; | 163 private boolean mIsBackgroundTabNavigation; |
155 | 164 |
| 165 /** Whether this navigation happens in main frame. */ |
| 166 private boolean mIsMainFrame; |
| 167 |
156 public Builder(String url, boolean isIncognito) { | 168 public Builder(String url, boolean isIncognito) { |
157 mUrl = url; | 169 mUrl = url; |
158 mIsIncognito = isIncognito; | 170 mIsIncognito = isIncognito; |
159 } | 171 } |
160 | 172 |
161 public Builder(String url, boolean isIncognito, String referrer, int pag
eTransition, | 173 public Builder(String url, boolean isIncognito, String referrer, int pag
eTransition, |
162 boolean isRedirect) { | 174 boolean isRedirect) { |
163 mUrl = url; | 175 mUrl = url; |
164 mIsIncognito = isIncognito; | 176 mIsIncognito = isIncognito; |
165 mReferrerUrl = referrer; | 177 mReferrerUrl = referrer; |
(...skipping 30 matching lines...) Expand all Loading... |
196 mOpenInNewTab = v; | 208 mOpenInNewTab = v; |
197 return this; | 209 return this; |
198 } | 210 } |
199 | 211 |
200 /** Sets whether this navigation happens in background tab. */ | 212 /** Sets whether this navigation happens in background tab. */ |
201 public Builder setIsBackgroundTabNavigation(boolean v) { | 213 public Builder setIsBackgroundTabNavigation(boolean v) { |
202 mIsBackgroundTabNavigation = v; | 214 mIsBackgroundTabNavigation = v; |
203 return this; | 215 return this; |
204 } | 216 } |
205 | 217 |
| 218 /** Sets whether this navigation happens in main frame. */ |
| 219 public Builder setIsMainFrame(boolean v) { |
| 220 mIsMainFrame = v; |
| 221 return this; |
| 222 } |
| 223 |
206 /** @return A fully constructed {@link ExternalNavigationParams} object.
*/ | 224 /** @return A fully constructed {@link ExternalNavigationParams} object.
*/ |
207 public ExternalNavigationParams build() { | 225 public ExternalNavigationParams build() { |
208 return new ExternalNavigationParams(mUrl, mIsIncognito, mReferrerUrl
, mPageTransition, | 226 return new ExternalNavigationParams(mUrl, mIsIncognito, mReferrerUrl
, mPageTransition, |
209 mIsRedirect, mApplicationMustBeInForeground, mRedirectHandle
r, | 227 mIsRedirect, mApplicationMustBeInForeground, mRedirectHandle
r, |
210 mTransitionPageHelper, mTab, mOpenInNewTab, mIsBackgroundTab
Navigation); | 228 mTransitionPageHelper, mTab, mOpenInNewTab, mIsBackgroundTab
Navigation, |
| 229 mIsMainFrame); |
211 } | 230 } |
212 } | 231 } |
213 } | 232 } |
OLD | NEW |