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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 assert rootWindow != null; | 64 assert rootWindow != null; |
65 mNativeContentViewRenderView = nativeInit(rootWindow.getNativePointer())
; | 65 mNativeContentViewRenderView = nativeInit(rootWindow.getNativePointer())
; |
66 assert mNativeContentViewRenderView != 0; | 66 assert mNativeContentViewRenderView != 0; |
67 mSurfaceCallback = new SurfaceHolder.Callback() { | 67 mSurfaceCallback = new SurfaceHolder.Callback() { |
68 @Override | 68 @Override |
69 public void surfaceChanged(SurfaceHolder holder, int format, int wid
th, int height) { | 69 public void surfaceChanged(SurfaceHolder holder, int format, int wid
th, int height) { |
70 assert mNativeContentViewRenderView != 0; | 70 assert mNativeContentViewRenderView != 0; |
71 nativeSurfaceChanged(mNativeContentViewRenderView, | 71 nativeSurfaceChanged(mNativeContentViewRenderView, |
72 format, width, height, holder.getSurface()); | 72 format, width, height, holder.getSurface()); |
73 if (mContentViewCore != null) { | 73 if (mContentViewCore != null) { |
74 mContentViewCore.onPhysicalBackingSizeChanged( | 74 mContentViewCore.getViewDelegate().onPhysicalBackingSizeChan
ged( |
75 width, height); | 75 width, height); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 @Override | 79 @Override |
80 public void surfaceCreated(SurfaceHolder holder) { | 80 public void surfaceCreated(SurfaceHolder holder) { |
81 assert mNativeContentViewRenderView != 0; | 81 assert mNativeContentViewRenderView != 0; |
82 nativeSurfaceCreated(mNativeContentViewRenderView); | 82 nativeSurfaceCreated(mNativeContentViewRenderView); |
83 | 83 |
84 onReadyToRender(); | 84 onReadyToRender(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 mSurfaceView.getHolder().removeCallback(mSurfaceCallback); | 121 mSurfaceView.getHolder().removeCallback(mSurfaceCallback); |
122 nativeDestroy(mNativeContentViewRenderView); | 122 nativeDestroy(mNativeContentViewRenderView); |
123 mNativeContentViewRenderView = 0; | 123 mNativeContentViewRenderView = 0; |
124 } | 124 } |
125 | 125 |
126 public void setCurrentContentViewCore(ContentViewCore contentViewCore) { | 126 public void setCurrentContentViewCore(ContentViewCore contentViewCore) { |
127 assert mNativeContentViewRenderView != 0; | 127 assert mNativeContentViewRenderView != 0; |
128 mContentViewCore = contentViewCore; | 128 mContentViewCore = contentViewCore; |
129 | 129 |
130 if (mContentViewCore != null) { | 130 if (mContentViewCore != null) { |
131 mContentViewCore.onPhysicalBackingSizeChanged(getWidth(), getHeight(
)); | 131 mContentViewCore.getViewDelegate().onPhysicalBackingSizeChanged( |
| 132 getWidth(), getHeight()); |
132 nativeSetCurrentWebContents( | 133 nativeSetCurrentWebContents( |
133 mNativeContentViewRenderView, mContentViewCore.getWebContent
s()); | 134 mNativeContentViewRenderView, mContentViewCore.getWebContent
s()); |
134 } else { | 135 } else { |
135 nativeSetCurrentWebContents(mNativeContentViewRenderView, null); | 136 nativeSetCurrentWebContents(mNativeContentViewRenderView, null); |
136 } | 137 } |
137 } | 138 } |
138 | 139 |
139 /** | 140 /** |
140 * This method should be subclassed to provide actions to be performed once
the view is ready to | 141 * This method should be subclassed to provide actions to be performed once
the view is ready to |
141 * render. | 142 * render. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 private native void nativeDestroy(long nativeContentViewRenderView); | 186 private native void nativeDestroy(long nativeContentViewRenderView); |
186 private native void nativeSetCurrentWebContents( | 187 private native void nativeSetCurrentWebContents( |
187 long nativeContentViewRenderView, WebContents webContents); | 188 long nativeContentViewRenderView, WebContents webContents); |
188 private native void nativeSurfaceCreated(long nativeContentViewRenderView); | 189 private native void nativeSurfaceCreated(long nativeContentViewRenderView); |
189 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView)
; | 190 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView)
; |
190 private native void nativeSurfaceChanged(long nativeContentViewRenderView, | 191 private native void nativeSurfaceChanged(long nativeContentViewRenderView, |
191 int format, int width, int height, Surface surface); | 192 int format, int width, int height, Surface surface); |
192 private native void nativeSetOverlayVideoMode(long nativeContentViewRenderVi
ew, | 193 private native void nativeSetOverlayVideoMode(long nativeContentViewRenderVi
ew, |
193 boolean enabled); | 194 boolean enabled); |
194 } | 195 } |
OLD | NEW |