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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentView.java

Issue 12443003: Implement out-of-band video compositing on Android: Step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.res.Configuration; 9 import android.content.res.Configuration;
10 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
11 import android.graphics.Canvas; 11 import android.graphics.Canvas;
12 import android.graphics.Rect; 12 import android.graphics.Rect;
13 import android.os.Build; 13 import android.os.Build;
14 import android.util.AttributeSet; 14 import android.util.AttributeSet;
15 import android.view.KeyEvent; 15 import android.view.KeyEvent;
16 import android.view.MotionEvent; 16 import android.view.MotionEvent;
17 import android.view.View; 17 import android.view.View;
18 import android.view.SurfaceHolder;
19 import android.view.SurfaceView;
18 import android.view.accessibility.AccessibilityEvent; 20 import android.view.accessibility.AccessibilityEvent;
19 import android.view.accessibility.AccessibilityNodeInfo; 21 import android.view.accessibility.AccessibilityNodeInfo;
20 import android.view.inputmethod.EditorInfo; 22 import android.view.inputmethod.EditorInfo;
21 import android.view.inputmethod.InputConnection; 23 import android.view.inputmethod.InputConnection;
22 import android.widget.FrameLayout; 24 import android.widget.FrameLayout;
23 25
24 import com.google.common.annotations.VisibleForTesting; 26 import com.google.common.annotations.VisibleForTesting;
25 27
26 import org.chromium.content.common.ProcessInitException; 28 import org.chromium.content.common.ProcessInitException;
27 import org.chromium.content.common.TraceEvent; 29 import org.chromium.content.common.TraceEvent;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 NativeWindow nativeWindow, AttributeSet attrs, int defStyle, int per sonality) { 98 NativeWindow nativeWindow, AttributeSet attrs, int defStyle, int per sonality) {
97 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { 99 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
98 return new ContentView(context, nativeWebContents, nativeWindow, att rs, defStyle, 100 return new ContentView(context, nativeWebContents, nativeWindow, att rs, defStyle,
99 personality); 101 personality);
100 } else { 102 } else {
101 return new JellyBeanContentView(context, nativeWebContents, nativeWi ndow, attrs, 103 return new JellyBeanContentView(context, nativeWebContents, nativeWi ndow, attrs,
102 defStyle, personality); 104 defStyle, personality);
103 } 105 }
104 } 106 }
105 107
108 private SurfaceView mExternalVideoSurfaceView;
109
106 protected ContentView(Context context, int nativeWebContents, NativeWindow n ativeWindow, 110 protected ContentView(Context context, int nativeWebContents, NativeWindow n ativeWindow,
107 AttributeSet attrs, int defStyle, int personality) { 111 AttributeSet attrs, int defStyle, int personality) {
108 super(context, attrs, defStyle); 112 super(context, attrs, defStyle);
109 113
110 mContentViewCore = new ContentViewCore(context, personality); 114 mContentViewCore = new ContentViewCore(context, personality);
111 mContentViewCore.initialize(this, this, nativeWebContents, nativeWindow, false); 115 mContentViewCore.initialize(this, this, nativeWebContents, nativeWindow, false);
116
117 mExternalVideoSurfaceView = new SurfaceView(getContext());
118 mExternalVideoSurfaceView.getHolder().addCallback(new SurfaceHolder.Call back() {
119 @Override
120 public void surfaceChanged(SurfaceHolder holder, int format, int wid th, int height) {
121 }
122
123 @Override
124 public void surfaceCreated(SurfaceHolder holder) {
125 mContentViewCore.externalVideoSurfaceCreated(holder.getSurface() );
126 }
127
128 @Override
129 public void surfaceDestroyed(SurfaceHolder holder) {
130 mContentViewCore.externalVideoSurfaceDestroyed(holder.getSurface ());
131 }
132 });
133
134 addView(mExternalVideoSurfaceView,
135 new FrameLayout.LayoutParams(
136 FrameLayout.LayoutParams.MATCH_PARENT,
137 FrameLayout.LayoutParams.MATCH_PARENT));
138 mExternalVideoSurfaceView.setZOrderMediaOverlay(false);
no sievers 2013/03/07 19:14:07 I think this should all move to the app/embedder.
wonsik 2013/03/11 12:32:44 Could you point me to a starting point to investig
no sievers 2013/03/11 17:26:28 I mean this code to create the external SurfaceVie
wonsik 2013/03/14 06:28:14 Created ExternalVideoSurfaceViewHolder to be injec
112 } 139 }
113 140
114 /** 141 /**
115 * @return The core component of the ContentView that handles JNI communicat ion. Should only be 142 * @return The core component of the ContentView that handles JNI communicat ion. Should only be
116 * used for passing to native. 143 * used for passing to native.
117 */ 144 */
118 public ContentViewCore getContentViewCore() { 145 public ContentViewCore getContentViewCore() {
119 return mContentViewCore; 146 return mContentViewCore;
120 } 147 }
121 148
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 845
819 @Override 846 @Override
820 public boolean super_awakenScrollBars(int startDelay, boolean invalidate) { 847 public boolean super_awakenScrollBars(int startDelay, boolean invalidate) {
821 return super.awakenScrollBars(startDelay, invalidate); 848 return super.awakenScrollBars(startDelay, invalidate);
822 } 849 }
823 850
824 //////////////////////////////////////////////////////////////////////////// /////////////////// 851 //////////////////////////////////////////////////////////////////////////// ///////////////////
825 // End Implementation of ContentViewCore.InternalAccessDelega te // 852 // End Implementation of ContentViewCore.InternalAccessDelega te //
826 //////////////////////////////////////////////////////////////////////////// /////////////////// 853 //////////////////////////////////////////////////////////////////////////// ///////////////////
827 } 854 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698