Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2094)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 2898593002: WebView: choose loud vs. quiet interstitial (Closed)
Patch Set: Rename test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index ac2cb98c0c82a15ed565ba82aa13a72128d7f4ad..c63e1c460be741338b57c9f37180d6224c2f8f19 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -59,6 +59,7 @@ import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.components.navigation_interception.InterceptNavigationDelegate;
import org.chromium.components.navigation_interception.NavigationParams;
+import org.chromium.components.safe_browsing.ErrorUiType;
import org.chromium.content.browser.AppWebMessagePort;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.ContentViewStatics;
@@ -2945,10 +2946,22 @@ public class AwContents implements SmartClipProvider {
* @return true if the WebView is visible
*/
@VisibleForTesting
+ @CalledByNative
protected boolean canShowInterstitial() {
return mIsAttachedToWindow && mIsViewVisible;
}
+ @CalledByNative
+ private int getErrorUiType() {
+ if (canShowBigInterstitial()) {
+ return ErrorUiType.LOUD;
+ } else if (extendsOutOfWindow()) {
+ return ErrorUiType.QUIET_GIANT;
+ } else {
+ return ErrorUiType.QUIET_SMALL;
+ }
+ }
+
/**
* Determine if it's suitable to show the interstitial for browsers and main UIs. If the WebView
* is close to full-screen, we assume the app is using it as the main UI, so we show the same
@@ -2957,7 +2970,6 @@ public class AwContents implements SmartClipProvider {
* @return true if the WebView should display the large interstitial
*/
@VisibleForTesting
- @CalledByNative
protected boolean canShowBigInterstitial() {
if (!canShowInterstitial()) return false;
sgurun-gerrit only 2017/05/23 17:09:15 I don't think this check is necessary. the caller
Nate Fischer 2017/05/23 20:01:06 I don't think we can add DCHECKs in Java, so I jus
sgurun-gerrit only 2017/05/23 20:19:23 just drop, no need.
Nate Fischer 2017/05/23 20:21:19 Ok, SGTM. That's what I did in PS#9
if (extendsOutOfWindow()) return false;
sgurun-gerrit only 2017/05/23 17:09:15 same as above.
Nate Fischer 2017/05/23 20:01:06 Done.

Powered by Google App Engine
This is Rietveld 408576698