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

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

Issue 2898593002: WebView: choose loud vs. quiet interstitial (Closed)
Patch Set: Rebase, fix merge conflicts 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 eff9592f07db01ecd2f28483d440de7716d82d9c..f947060dad1e6866d7028536b807fcf8d09fab3a 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -2954,10 +2954,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 (extendsOutOfWindow()) {
+ return ErrorUiType.QUIET_GIANT;
+ } else if (canShowBigInterstitial()) {
+ return ErrorUiType.LOUD;
+ } 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
@@ -2966,11 +2978,7 @@ public class AwContents implements SmartClipProvider {
* @return true if the WebView should display the large interstitial
*/
@VisibleForTesting
- @CalledByNative
protected boolean canShowBigInterstitial() {
- if (!canShowInterstitial()) return false;
- if (extendsOutOfWindow()) return false;
-
double percentOfScreenHeight =
(double) mContainerView.getHeight() / mContainerView.getRootView().getHeight();

Powered by Google App Engine
This is Rietveld 408576698