| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 com.android.webview.chromium; | 5 package com.android.webview.chromium; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.app.Application; | 8 import android.app.Application; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.ContextWrapper; | 10 import android.content.ContextWrapper; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 /** @see android.webkit.WebViewDelegate#isTraceTagEnabled */ | 52 /** @see android.webkit.WebViewDelegate#isTraceTagEnabled */ |
| 53 boolean isTraceTagEnabled(); | 53 boolean isTraceTagEnabled(); |
| 54 | 54 |
| 55 /** @see android.webkit.WebViewDelegate#canInvokeDrawGlFunctor */ | 55 /** @see android.webkit.WebViewDelegate#canInvokeDrawGlFunctor */ |
| 56 boolean canInvokeDrawGlFunctor(View containerView); | 56 boolean canInvokeDrawGlFunctor(View containerView); |
| 57 | 57 |
| 58 /** @see android.webkit.WebViewDelegate#invokeDrawGlFunctor */ | 58 /** @see android.webkit.WebViewDelegate#invokeDrawGlFunctor */ |
| 59 void invokeDrawGlFunctor( | 59 void invokeDrawGlFunctor( |
| 60 View containerView, long nativeDrawGLFunctor, boolean waitForCom
pletion); | 60 View containerView, long nativeDrawGLFunctor, boolean waitForCom
pletion); |
| 61 | 61 |
| 62 /** @see android.webkit.WebViewDelegate#callDrawGlFunction */ | 62 /** @see android.webkit.WebViewDelegate#callDrawGlFunction. Available AP
I level 23 and |
| 63 * below. |
| 64 */ |
| 63 void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor); | 65 void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor); |
| 64 | 66 |
| 67 /** @see android.webkit.WebViewDelegate#callDrawGlFunction. Available ab
ove API level 23 |
| 68 * only. */ |
| 69 void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor, Runnabl
e releasedRunnable); |
| 70 |
| 65 /** @see android.webkit.WebViewDelegate#detachDrawGlFunctor */ | 71 /** @see android.webkit.WebViewDelegate#detachDrawGlFunctor */ |
| 66 void detachDrawGlFunctor(View containerView, long nativeDrawGLFunctor); | 72 void detachDrawGlFunctor(View containerView, long nativeDrawGLFunctor); |
| 67 | 73 |
| 68 /** @see android.webkit.WebViewDelegate#getPackageId */ | 74 /** @see android.webkit.WebViewDelegate#getPackageId */ |
| 69 int getPackageId(Resources resources, String packageName); | 75 int getPackageId(Resources resources, String packageName); |
| 70 | 76 |
| 71 /** @see android.webkit.WebViewDelegate#getApplication */ | 77 /** @see android.webkit.WebViewDelegate#getApplication */ |
| 72 Application getApplication(); | 78 Application getApplication(); |
| 73 | 79 |
| 74 /** @see android.webkit.WebViewDelegate#getErrorString */ | 80 /** @see android.webkit.WebViewDelegate#getErrorString */ |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 View containerView, long nativeDrawGLFunctor, boolean waitForCom
pletion) { | 143 View containerView, long nativeDrawGLFunctor, boolean waitForCom
pletion) { |
| 138 mDelegate.invokeDrawGlFunctor(containerView, nativeDrawGLFunctor, wa
itForCompletion); | 144 mDelegate.invokeDrawGlFunctor(containerView, nativeDrawGLFunctor, wa
itForCompletion); |
| 139 } | 145 } |
| 140 | 146 |
| 141 @Override | 147 @Override |
| 142 public void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor)
{ | 148 public void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor)
{ |
| 143 mDelegate.callDrawGlFunction(canvas, nativeDrawGLFunctor); | 149 mDelegate.callDrawGlFunction(canvas, nativeDrawGLFunctor); |
| 144 } | 150 } |
| 145 | 151 |
| 146 @Override | 152 @Override |
| 153 public void callDrawGlFunction( |
| 154 Canvas canvas, long nativeDrawGLFunctor, Runnable releasedRunnab
le) { |
| 155 throw new RuntimeException("Call not supported"); |
| 156 } |
| 157 |
| 158 @Override |
| 147 public void detachDrawGlFunctor(View containerView, long nativeDrawGLFun
ctor) { | 159 public void detachDrawGlFunctor(View containerView, long nativeDrawGLFun
ctor) { |
| 148 mDelegate.detachDrawGlFunctor(containerView, nativeDrawGLFunctor); | 160 mDelegate.detachDrawGlFunctor(containerView, nativeDrawGLFunctor); |
| 149 } | 161 } |
| 150 | 162 |
| 151 @Override | 163 @Override |
| 152 public int getPackageId(Resources resources, String packageName) { | 164 public int getPackageId(Resources resources, String packageName) { |
| 153 return mDelegate.getPackageId(resources, packageName); | 165 return mDelegate.getPackageId(resources, packageName); |
| 154 } | 166 } |
| 155 | 167 |
| 156 @Override | 168 @Override |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 @Override | 310 @Override |
| 299 public void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor)
{ | 311 public void callDrawGlFunction(Canvas canvas, long nativeDrawGLFunctor)
{ |
| 300 try { | 312 try { |
| 301 mCallDrawGLFunctionMethod.invoke(canvas, nativeDrawGLFunctor); | 313 mCallDrawGLFunctionMethod.invoke(canvas, nativeDrawGLFunctor); |
| 302 } catch (Exception e) { | 314 } catch (Exception e) { |
| 303 throw new RuntimeException("Invalid reflection", e); | 315 throw new RuntimeException("Invalid reflection", e); |
| 304 } | 316 } |
| 305 } | 317 } |
| 306 | 318 |
| 307 @Override | 319 @Override |
| 320 public void callDrawGlFunction( |
| 321 Canvas canvas, long nativeDrawGLFunctor, Runnable releasedRunnab
le) { |
| 322 throw new RuntimeException("Call not supported"); |
| 323 } |
| 324 |
| 325 @Override |
| 308 public void detachDrawGlFunctor(View containerView, long nativeDrawGLFun
ctor) { | 326 public void detachDrawGlFunctor(View containerView, long nativeDrawGLFun
ctor) { |
| 309 try { | 327 try { |
| 310 Object viewRootImpl = mGetViewRootImplMethod.invoke(containerVie
w); | 328 Object viewRootImpl = mGetViewRootImplMethod.invoke(containerVie
w); |
| 311 if (viewRootImpl != null) { | 329 if (viewRootImpl != null) { |
| 312 mDetachFunctorMethod.invoke(viewRootImpl, nativeDrawGLFuncto
r); | 330 mDetachFunctorMethod.invoke(viewRootImpl, nativeDrawGLFuncto
r); |
| 313 } | 331 } |
| 314 } catch (Exception e) { | 332 } catch (Exception e) { |
| 315 throw new RuntimeException("Invalid reflection", e); | 333 throw new RuntimeException("Invalid reflection", e); |
| 316 } | 334 } |
| 317 } | 335 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // Avoid calling the ContextWrapper.getAssets() proxy | 378 // Avoid calling the ContextWrapper.getAssets() proxy |
| 361 // chain, which can return an unexpected AssetManager. | 379 // chain, which can return an unexpected AssetManager. |
| 362 mAddAssetPathMethod.invoke( | 380 mAddAssetPathMethod.invoke( |
| 363 context.getResources().getAssets(), info.applicationInfo
.sourceDir); | 381 context.getResources().getAssets(), info.applicationInfo
.sourceDir); |
| 364 } catch (Exception e) { | 382 } catch (Exception e) { |
| 365 throw new RuntimeException("Invalid reflection", e); | 383 throw new RuntimeException("Invalid reflection", e); |
| 366 } | 384 } |
| 367 } | 385 } |
| 368 } | 386 } |
| 369 } | 387 } |
| OLD | NEW |