 Chromium Code Reviews
 Chromium Code Reviews Issue 2035183002:
  Upstream: Launch WebAPK without showing intent picker when user taps link in WebAPK scope  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2035183002:
  Upstream: Launch WebAPK without showing intent picker when user taps link in WebAPK scope  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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.Tab; | 7 import org.chromium.chrome.browser.tab.Tab; | 
| 8 import org.chromium.chrome.browser.tab.TabRedirectHandler; | 8 import org.chromium.chrome.browser.tab.TabRedirectHandler; | 
| 9 | 9 | 
| 10 /** | 10 /** | 
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 | 36 | 
| 37 /** Whether the intent should force a new tab to open. */ | 37 /** Whether the intent should force a new tab to open. */ | 
| 38 private final boolean mOpenInNewTab; | 38 private final boolean mOpenInNewTab; | 
| 39 | 39 | 
| 40 /** Whether this navigation happens in background tab. */ | 40 /** Whether this navigation happens in background tab. */ | 
| 41 private final boolean mIsBackgroundTabNavigation; | 41 private final boolean mIsBackgroundTabNavigation; | 
| 42 | 42 | 
| 43 /** Whether this navigation happens in main frame. */ | 43 /** Whether this navigation happens in main frame. */ | 
| 44 private final boolean mIsMainFrame; | 44 private final boolean mIsMainFrame; | 
| 45 | 45 | 
| 46 /** Whether this navigation happens in a WebAPK. */ | 46 /** | 
| 47 private final boolean mIsWebApk; | 47 * The package name of the WebAPK that the navigation happens in. Null if th e navigation is not | 
| 48 * happening in a WebAPK. | |
| 49 */ | |
| 50 private final String mWebApkPackageName; | |
| 48 | 51 | 
| 49 /** Whether this navigation is launched by user gesture. */ | 52 /** Whether this navigation is launched by user gesture. */ | 
| 50 private final boolean mHasUserGesture; | 53 private final boolean mHasUserGesture; | 
| 51 | 54 | 
| 52 /** | 55 /** | 
| 53 * Whether the current tab should be closed when an URL load was overridden and an | 56 * Whether the current tab should be closed when an URL load was overridden and an | 
| 54 * intent launched. | 57 * intent launched. | 
| 55 */ | 58 */ | 
| 56 private final boolean mShouldCloseContentsOnOverrideUrlLoadingAndLaunchInten t; | 59 private final boolean mShouldCloseContentsOnOverrideUrlLoadingAndLaunchInten t; | 
| 57 | 60 | 
| 58 private ExternalNavigationParams(String url, boolean isIncognito, String ref errerUrl, | 61 private ExternalNavigationParams(String url, boolean isIncognito, String ref errerUrl, | 
| 59 int pageTransition, boolean isRedirect, boolean appMustBeInForegroun d, | 62 int pageTransition, boolean isRedirect, boolean appMustBeInForegroun d, | 
| 60 TabRedirectHandler redirectHandler, Tab tab, boolean openInNewTab, | 63 TabRedirectHandler redirectHandler, Tab tab, boolean openInNewTab, | 
| 61 boolean isBackgroundTabNavigation, boolean isMainFrame, boolean isWe bApk, | 64 boolean isBackgroundTabNavigation, boolean isMainFrame, String webAp kPackageName, | 
| 62 boolean hasUserGesture, | 65 boolean hasUserGesture, | 
| 63 boolean shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent) { | 66 boolean shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent) { | 
| 64 mUrl = url; | 67 mUrl = url; | 
| 65 mIsIncognito = isIncognito; | 68 mIsIncognito = isIncognito; | 
| 66 mPageTransition = pageTransition; | 69 mPageTransition = pageTransition; | 
| 67 mReferrerUrl = referrerUrl; | 70 mReferrerUrl = referrerUrl; | 
| 68 mIsRedirect = isRedirect; | 71 mIsRedirect = isRedirect; | 
| 69 mApplicationMustBeInForeground = appMustBeInForeground; | 72 mApplicationMustBeInForeground = appMustBeInForeground; | 
| 70 mRedirectHandler = redirectHandler; | 73 mRedirectHandler = redirectHandler; | 
| 71 mTab = tab; | 74 mTab = tab; | 
| 72 mOpenInNewTab = openInNewTab; | 75 mOpenInNewTab = openInNewTab; | 
| 73 mIsBackgroundTabNavigation = isBackgroundTabNavigation; | 76 mIsBackgroundTabNavigation = isBackgroundTabNavigation; | 
| 74 mIsMainFrame = isMainFrame; | 77 mIsMainFrame = isMainFrame; | 
| 75 mIsWebApk = isWebApk; | 78 mWebApkPackageName = webApkPackageName; | 
| 76 mHasUserGesture = hasUserGesture; | 79 mHasUserGesture = hasUserGesture; | 
| 77 mShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent = | 80 mShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent = | 
| 78 shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent; | 81 shouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent; | 
| 79 } | 82 } | 
| 80 | 83 | 
| 81 /** @return The URL to potentially open externally. */ | 84 /** @return The URL to potentially open externally. */ | 
| 82 public String getUrl() { | 85 public String getUrl() { | 
| 83 return mUrl; | 86 return mUrl; | 
| 84 } | 87 } | 
| 85 | 88 | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 /** @return Whether this navigation happens in background tab. */ | 132 /** @return Whether this navigation happens in background tab. */ | 
| 130 public boolean isBackgroundTabNavigation() { | 133 public boolean isBackgroundTabNavigation() { | 
| 131 return mIsBackgroundTabNavigation; | 134 return mIsBackgroundTabNavigation; | 
| 132 } | 135 } | 
| 133 | 136 | 
| 134 /** @return Whether this navigation happens in main frame. */ | 137 /** @return Whether this navigation happens in main frame. */ | 
| 135 public boolean isMainFrame() { | 138 public boolean isMainFrame() { | 
| 136 return mIsMainFrame; | 139 return mIsMainFrame; | 
| 137 } | 140 } | 
| 138 | 141 | 
| 139 /** @return Whether this navigation happens in a WebAPK. */ | 142 /** | 
| 140 public boolean isWebApk() { | 143 * @return Package name of the WebAPK that the navigation happens in. Null i f the navigation is | 
| 141 return mIsWebApk; | 144 * not happening in a WebAPK. | 
| 
Xi Han
2016/06/07 19:16:47
Please align "not happening" with "Package name".
 | |
| 145 */ | |
| 146 public String webApkPackageName() { | |
| 147 return mWebApkPackageName; | |
| 142 } | 148 } | 
| 143 | 149 | 
| 144 /** @return Whether this navigation is launched by user gesture. */ | 150 /** @return Whether this navigation is launched by user gesture. */ | 
| 145 public boolean hasUserGesture() { | 151 public boolean hasUserGesture() { | 
| 146 return mHasUserGesture; | 152 return mHasUserGesture; | 
| 147 } | 153 } | 
| 148 | 154 | 
| 149 /** | 155 /** | 
| 150 * @return Whether the current tab should be closed when an URL load was ove rridden and an | 156 * @return Whether the current tab should be closed when an URL load was ove rridden and an | 
| 151 * intent launched. | 157 * intent launched. | 
| (...skipping 29 matching lines...) Expand all Loading... | |
| 181 | 187 | 
| 182 /** Whether the intent should force a new tab to open. */ | 188 /** Whether the intent should force a new tab to open. */ | 
| 183 private boolean mOpenInNewTab; | 189 private boolean mOpenInNewTab; | 
| 184 | 190 | 
| 185 /** Whether this navigation happens in background tab. */ | 191 /** Whether this navigation happens in background tab. */ | 
| 186 private boolean mIsBackgroundTabNavigation; | 192 private boolean mIsBackgroundTabNavigation; | 
| 187 | 193 | 
| 188 /** Whether this navigation happens in main frame. */ | 194 /** Whether this navigation happens in main frame. */ | 
| 189 private boolean mIsMainFrame; | 195 private boolean mIsMainFrame; | 
| 190 | 196 | 
| 191 /** Whether this navigation happens in a WebAPK. */ | 197 /** | 
| 192 private boolean mIsWebApk; | 198 * The package name of the WebAPK that the navigation happens in. Null i f the navigation is | 
| 199 * not happening in a WebAPK. | |
| 200 */ | |
| 201 private String mWebApkPackageName; | |
| 193 | 202 | 
| 194 /** Whether this navigation is launched by user gesture. */ | 203 /** Whether this navigation is launched by user gesture. */ | 
| 195 private boolean mHasUserGesture; | 204 private boolean mHasUserGesture; | 
| 196 | 205 | 
| 197 /** | 206 /** | 
| 198 * Whether the current tab should be closed when an URL load was overrid den and an | 207 * Whether the current tab should be closed when an URL load was overrid den and an | 
| 199 * intent launched. | 208 * intent launched. | 
| 200 */ | 209 */ | 
| 201 private boolean mShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent; | 210 private boolean mShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent; | 
| 202 | 211 | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 mIsBackgroundTabNavigation = v; | 252 mIsBackgroundTabNavigation = v; | 
| 244 return this; | 253 return this; | 
| 245 } | 254 } | 
| 246 | 255 | 
| 247 /** Sets whether this navigation happens in main frame. */ | 256 /** Sets whether this navigation happens in main frame. */ | 
| 248 public Builder setIsMainFrame(boolean v) { | 257 public Builder setIsMainFrame(boolean v) { | 
| 249 mIsMainFrame = v; | 258 mIsMainFrame = v; | 
| 250 return this; | 259 return this; | 
| 251 } | 260 } | 
| 252 | 261 | 
| 253 /** Sets whether this navigation happens in a WebAPK. */ | 262 /** | 
| 254 public Builder setIsWebApk(boolean v) { | 263 * Sets the package name of the WebAPK that the navigation happens in. N ull if the | 
| 255 mIsWebApk = v; | 264 * navigation is not happening in a WebAPK. | 
| 265 */ | |
| 266 public Builder setWebApkPackageName(String v) { | |
| 267 mWebApkPackageName = v; | |
| 256 return this; | 268 return this; | 
| 257 } | 269 } | 
| 258 | 270 | 
| 259 /** Sets whether this navigation happens in main frame. */ | 271 /** Sets whether this navigation happens in main frame. */ | 
| 260 public Builder setHasUserGesture(boolean v) { | 272 public Builder setHasUserGesture(boolean v) { | 
| 261 mHasUserGesture = v; | 273 mHasUserGesture = v; | 
| 262 return this; | 274 return this; | 
| 263 } | 275 } | 
| 264 | 276 | 
| 265 /** Sets whether the current tab should be closed when an URL load was o verridden and an | 277 /** Sets whether the current tab should be closed when an URL load was o verridden and an | 
| 266 * intent launched. | 278 * intent launched. | 
| 267 */ | 279 */ | 
| 268 public Builder setShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent (boolean v) { | 280 public Builder setShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent (boolean v) { | 
| 269 mShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent = v; | 281 mShouldCloseContentsOnOverrideUrlLoadingAndLaunchIntent = v; | 
| 270 return this; | 282 return this; | 
| 271 } | 283 } | 
| 272 | 284 | 
| 273 /** @return A fully constructed {@link ExternalNavigationParams} object. */ | 285 /** @return A fully constructed {@link ExternalNavigationParams} object. */ | 
| 274 public ExternalNavigationParams build() { | 286 public ExternalNavigationParams build() { | 
| 275 return new ExternalNavigationParams(mUrl, mIsIncognito, mReferrerUrl , mPageTransition, | 287 return new ExternalNavigationParams(mUrl, mIsIncognito, mReferrerUrl , mPageTransition, | 
| 276 mIsRedirect, mApplicationMustBeInForeground, mRedirectHandle r, mTab, | 288 mIsRedirect, mApplicationMustBeInForeground, mRedirectHandle r, mTab, | 
| 277 mOpenInNewTab, mIsBackgroundTabNavigation, mIsMainFrame, mIs WebApk, | 289 mOpenInNewTab, mIsBackgroundTabNavigation, mIsMainFrame, mWe bApkPackageName, | 
| 278 mHasUserGesture, mShouldCloseContentsOnOverrideUrlLoadingAnd LaunchIntent); | 290 mHasUserGesture, mShouldCloseContentsOnOverrideUrlLoadingAnd LaunchIntent); | 
| 279 } | 291 } | 
| 280 } | 292 } | 
| 281 } | 293 } | 
| OLD | NEW |