diff options
author | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-21 20:37:09 +0000 |
---|---|---|
committer | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-21 20:37:09 +0000 |
commit | 0209e3937bc2703b36c95cf95edfa121755a4866 (patch) | |
tree | 55fb0ee845370df62c8e8d76f5d0b5f3184cf491 /ui | |
parent | 1a1c33a2aa3753b481bbe1c2f2521367f316337e (diff) | |
download | chromium_src-0209e3937bc2703b36c95cf95edfa121755a4866.zip chromium_src-0209e3937bc2703b36c95cf95edfa121755a4866.tar.gz chromium_src-0209e3937bc2703b36c95cf95edfa121755a4866.tar.bz2 |
android: Implement screenshots for Content Shell and Chromium Test Shell
This patch implements screenshots for the Android Content Shell. It
requires a few improvements to how screenshots work on Android.
Most importantly, WindowAndroid.grabSnapshot now takes a screenshot of
the root activity view instead of the content view. This is needed
because, unlike in Chrome, Content Shell's navigation controls are real
Android Views. As before, we need to calculate their geometry in order
to crop them out of the screenshot. In Chrome, the browser compositor
would do this for us, but with Content Shell we need to query the
information from the Android framework.
Switching the base screenshot to capture the entire activity establishes
a common coordinate system (View.getLocationInWindow) in which we can
communicate the position of the content. This patch changes ContentView
to report this information to ContentViewCore, which passes it on to
WindowAndroid.
We also change telemetry's screenshot backend to always assume Content
Shell is new enough to support screenshots (if it exposes the right
API). This is because the Content Shell doesn't report a meaningful
branch number to telemetry.
BUG=285932
TEST=content/test/gpu/run_gpu_test --browser=android-content-shell pixel
Review URL: https://codereview.chromium.org/28843002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229902 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/android/java/src/org/chromium/ui/WindowAndroid.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ui/android/java/src/org/chromium/ui/WindowAndroid.java b/ui/android/java/src/org/chromium/ui/WindowAndroid.java index 0707eaf..7c8141b 100644 --- a/ui/android/java/src/org/chromium/ui/WindowAndroid.java +++ b/ui/android/java/src/org/chromium/ui/WindowAndroid.java @@ -225,12 +225,10 @@ public class WindowAndroid { @CalledByNative public byte[] grabSnapshot(int windowX, int windowY, int width, int height) { try { - // Take a screenshot of the content view. This generally includes UI - // controls such as the URL bar. - View contentView = mActivity.findViewById(android.R.id.content); - if (contentView == null) return null; - Bitmap bitmap = - UiUtils.generateScaledScreenshot(contentView, 0, Bitmap.Config.ARGB_8888); + // Take a screenshot of the root activity view. This generally includes UI + // controls such as the URL bar and OS windows such as the status bar. + View rootView = mActivity.findViewById(android.R.id.content).getRootView(); + Bitmap bitmap = UiUtils.generateScaledScreenshot(rootView, 0, Bitmap.Config.ARGB_8888); if (bitmap == null) return null; // Clip the result into the requested region. |