Index: chrome/android/java/src/org/chromium/chrome/browser/widget/ViewResourceFrameLayout.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/ViewResourceFrameLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/ViewResourceFrameLayout.java |
index e891d9159f8343a843b9c99c7cfb1b590c845790..4617a35d856d110de3bbc374f9fd71eea150b14b 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/ViewResourceFrameLayout.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/ViewResourceFrameLayout.java |
@@ -19,6 +19,7 @@ import org.chromium.ui.resources.dynamics.ViewResourceAdapter; |
*/ |
public class ViewResourceFrameLayout extends FrameLayout { |
private ViewResourceAdapter mResourceAdapter; |
+ private boolean mInitializedForCapture = true; |
/** |
* Constructs a ViewResourceFrameLayout. |
@@ -32,13 +33,6 @@ public class ViewResourceFrameLayout extends FrameLayout { |
super(context, attrs); |
} |
- @Override |
- protected void onFinishInflate() { |
- super.onFinishInflate(); |
- |
- mResourceAdapter = createResourceAdapter(); |
- } |
- |
/** |
* @return A {@link ViewResourceAdapter} instance. This can be overridden for custom behavior. |
*/ |
@@ -50,20 +44,29 @@ public class ViewResourceFrameLayout extends FrameLayout { |
* @return The {@link ViewResourceAdapter} that exposes this {@link View} as a CC resource. |
*/ |
public ViewResourceAdapter getResourceAdapter() { |
+ if (mResourceAdapter == null) mResourceAdapter = createResourceAdapter(); |
return mResourceAdapter; |
} |
/** |
- * @return Whether the control container is ready for capturing snapshots. |
+ * @return Whether the control container is ready for capturing snapshots. True by default. |
+ */ |
+ protected boolean isInitializedForCapture() { |
+ return mInitializedForCapture; |
+ } |
+ |
+ /** |
+ * Update whether the control container is ready to have the bitmap representation of |
+ * itself be captured. This value is true by default. |
*/ |
- protected boolean isReadyForCapture() { |
- return true; |
+ public void setInitializedForCapture(boolean ready) { |
+ mInitializedForCapture = ready; |
} |
@Override |
public ViewParent invalidateChildInParent(int[] location, Rect dirty) { |
ViewParent retVal = super.invalidateChildInParent(location, dirty); |
- if (isReadyForCapture()) mResourceAdapter.invalidate(dirty); |
+ if (isInitializedForCapture()) mResourceAdapter.invalidate(dirty); |
return retVal; |
} |
} |