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

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

Issue 19693016: Hooking up setBackgroundColor from AwContents to render process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ity. Created 7 years, 5 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/AwContentsClient.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
index 7de19e55eeb38679b780ae37c9ca14c5a65e7038..fe42ad3a80dba7e5a7af63349c446c34fd68cf1d 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
@@ -52,6 +52,12 @@ public abstract class AwContentsClient {
private double mDIPScale;
+ // Last background color reported from the renderer. Holds the sentinal value INVALID_COLOR
+ // if not valid.
+ private int mCachedRendererBackgroundColor = INVALID_COLOR;
+
+ private static final int INVALID_COLOR = 0;
+
class AwWebContentsObserver extends WebContentsObserverAndroid {
public AwWebContentsObserver(ContentViewCore contentViewCore) {
super(contentViewCore);
@@ -90,6 +96,12 @@ public abstract class AwContentsClient {
}
private class AwContentViewClient extends ContentViewClient {
+ @Override
+ public void onBackgroundColorChanged(int color) {
+ // Avoid storing the sentinal INVALID_COLOR (note that both 0 and 1 are both
+ // fully transparent so this transpose makes no visible difference).
+ mCachedRendererBackgroundColor = color == INVALID_COLOR ? 1 : color;
+ }
@Override
public void onScaleChanged(float oldScale, float newScale) {
@@ -174,6 +186,15 @@ public abstract class AwContentsClient {
return mContentViewClient;
}
+ final int getCachedRendererBackgroundColor() {
+ assert isCachedRendererBackgroundColorValid();
+ return mCachedRendererBackgroundColor;
+ }
+
+ final boolean isCachedRendererBackgroundColorValid() {
+ return mCachedRendererBackgroundColor != INVALID_COLOR;
+ }
+
//--------------------------------------------------------------------------------------------
// WebView specific methods that map directly to WebViewClient / WebChromeClient
//--------------------------------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698