OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.Color; | 8 import android.graphics.Color; |
9 import android.graphics.PixelFormat; | 9 import android.graphics.PixelFormat; |
10 import android.view.Surface; | 10 import android.view.Surface; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 /** | 183 /** |
184 * Enter or leave overlay video mode. | 184 * Enter or leave overlay video mode. |
185 * @param enabled Whether overlay mode is enabled. | 185 * @param enabled Whether overlay mode is enabled. |
186 */ | 186 */ |
187 public void setOverlayVideoMode(boolean enabled) { | 187 public void setOverlayVideoMode(boolean enabled) { |
188 int format = enabled ? PixelFormat.TRANSLUCENT : PixelFormat.OPAQUE; | 188 int format = enabled ? PixelFormat.TRANSLUCENT : PixelFormat.OPAQUE; |
189 mSurfaceView.getHolder().setFormat(format); | 189 mSurfaceView.getHolder().setFormat(format); |
190 nativeSetOverlayVideoMode(mNativeContentViewRenderView, enabled); | 190 nativeSetOverlayVideoMode(mNativeContentViewRenderView, enabled); |
191 } | 191 } |
192 | 192 |
193 /** | |
194 * Set the native layer tree helper for this {@link ContentViewRenderView}. | |
195 * @param layerTreeBuildHelperNativePtr Native pointer to the layer tree bui
ld helper. | |
196 */ | |
197 public void setLayerTreeBuildHelper(long layerTreeBuildHelperNativePtr) { | |
198 nativeSetLayerTreeBuildHelper(mNativeContentViewRenderView, layerTreeBui
ldHelperNativePtr); | |
199 } | |
200 | |
201 @CalledByNative | 193 @CalledByNative |
202 protected void onCompositorLayout() { | 194 protected void onCompositorLayout() { |
203 } | 195 } |
204 | 196 |
205 @CalledByNative | 197 @CalledByNative |
206 private void onSwapBuffersCompleted() { | 198 private void onSwapBuffersCompleted() { |
207 if (mSurfaceView.getBackground() != null) { | 199 if (mSurfaceView.getBackground() != null) { |
208 post(new Runnable() { | 200 post(new Runnable() { |
209 @Override public void run() { | 201 @Override public void run() { |
210 mSurfaceView.setBackgroundResource(0); | 202 mSurfaceView.setBackgroundResource(0); |
211 } | 203 } |
212 }); | 204 }); |
213 } | 205 } |
214 } | 206 } |
215 | 207 |
216 /** | 208 /** |
217 * @return Native pointer for the UI resource provider taken from the compos
itor. | 209 * @return Native pointer for the UI resource provider taken from the compos
itor. |
218 */ | 210 */ |
219 public long getUIResourceProvider() { | 211 public long getUIResourceProvider() { |
220 return nativeGetUIResourceProvider(mNativeContentViewRenderView); | 212 return nativeGetUIResourceProvider(mNativeContentViewRenderView); |
221 } | 213 } |
222 | 214 |
223 private native long nativeInit(long rootWindowNativePointer); | 215 private native long nativeInit(long rootWindowNativePointer); |
224 private native long nativeGetUIResourceProvider(long nativeContentViewRender
View); | 216 private native long nativeGetUIResourceProvider(long nativeContentViewRender
View); |
225 private native void nativeDestroy(long nativeContentViewRenderView); | 217 private native void nativeDestroy(long nativeContentViewRenderView); |
226 private native void nativeSetCurrentContentViewCore(long nativeContentViewRe
nderView, | 218 private native void nativeSetCurrentContentViewCore(long nativeContentViewRe
nderView, |
227 long nativeContentViewCore); | 219 long nativeContentViewCore); |
228 private native void nativeSetLayerTreeBuildHelper(long nativeContentViewRend
erView, | |
229 long buildHelperNativePtr); | |
230 private native void nativeSurfaceCreated(long nativeContentViewRenderView); | 220 private native void nativeSurfaceCreated(long nativeContentViewRenderView); |
231 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView)
; | 221 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView)
; |
232 private native void nativeSurfaceChanged(long nativeContentViewRenderView, | 222 private native void nativeSurfaceChanged(long nativeContentViewRenderView, |
233 int format, int width, int height, Surface surface); | 223 int format, int width, int height, Surface surface); |
234 private native void nativeSetOverlayVideoMode(long nativeContentViewRenderVi
ew, | 224 private native void nativeSetOverlayVideoMode(long nativeContentViewRenderVi
ew, |
235 boolean enabled); | 225 boolean enabled); |
236 private native void nativeSetNeedsComposite(long nativeContentViewRenderView
); | 226 private native void nativeSetNeedsComposite(long nativeContentViewRenderView
); |
237 } | 227 } |
OLD | NEW |