| 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.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
| 9 import android.app.assist.AssistStructure.ViewNode; | 9 import android.app.assist.AssistStructure.ViewNode; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 }); | 267 }); |
| 268 } | 268 } |
| 269 | 269 |
| 270 private void initForReal() { | 270 private void initForReal() { |
| 271 AwContentsStatics.setRecordFullDocument(sRecordWholeDocumentEnabledByApi | 271 AwContentsStatics.setRecordFullDocument(sRecordWholeDocumentEnabledByApi |
| 272 || mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP); | 272 || mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP); |
| 273 | 273 |
| 274 mAwContents = new AwContents(mFactory.getBrowserContext(), mWebView, mCo
ntext, | 274 mAwContents = new AwContents(mFactory.getBrowserContext(), mWebView, mCo
ntext, |
| 275 new InternalAccessAdapter(), new WebViewNativeGLDelegate(), mCon
tentsClientAdapter, | 275 new InternalAccessAdapter(), new WebViewNativeDrawGLFunctorFacto
ry(), |
| 276 mWebSettings.getAwSettings()); | 276 mContentsClientAdapter, mWebSettings.getAwSettings()); |
| 277 | 277 |
| 278 if (mAppTargetSdkVersion >= Build.VERSION_CODES.KITKAT) { | 278 if (mAppTargetSdkVersion >= Build.VERSION_CODES.KITKAT) { |
| 279 // On KK and above, favicons are automatically downloaded as the met
hod | 279 // On KK and above, favicons are automatically downloaded as the met
hod |
| 280 // old apps use to enable that behavior is deprecated. | 280 // old apps use to enable that behavior is deprecated. |
| 281 AwContents.setShouldDownloadFavicons(); | 281 AwContents.setShouldDownloadFavicons(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) { | 284 if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) { |
| 285 // Prior to Lollipop, JavaScript objects injected via addJavascriptI
nterface | 285 // Prior to Lollipop, JavaScript objects injected via addJavascriptI
nterface |
| 286 // were not inspectable. | 286 // were not inspectable. |
| (...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 return; | 2233 return; |
| 2234 } | 2234 } |
| 2235 mAwContents.computeScroll(); | 2235 mAwContents.computeScroll(); |
| 2236 } | 2236 } |
| 2237 | 2237 |
| 2238 @Override | 2238 @Override |
| 2239 public PrintDocumentAdapter createPrintDocumentAdapter(String documentName)
{ | 2239 public PrintDocumentAdapter createPrintDocumentAdapter(String documentName)
{ |
| 2240 checkThread(); | 2240 checkThread(); |
| 2241 return new AwPrintDocumentAdapter(mAwContents.getPdfExporter(), document
Name); | 2241 return new AwPrintDocumentAdapter(mAwContents.getPdfExporter(), document
Name); |
| 2242 } | 2242 } |
| 2243 | 2243 // AwContents.NativeDrawGLFunctorFactory implementation --------------------
-------------- |
| 2244 // AwContents.NativeGLDelegate implementation ------------------------------
-------- | 2244 private class WebViewNativeDrawGLFunctorFactory |
| 2245 private class WebViewNativeGLDelegate implements AwContents.NativeGLDelegate
{ | 2245 implements AwContents.NativeDrawGLFunctorFactory { |
| 2246 @Override | 2246 @Override |
| 2247 public boolean supportsDrawGLFunctorReleasedCallback() { | 2247 public AwContents.NativeDrawGLFunctor createFunctor(long context) { |
| 2248 return DrawGLFunctor.supportsDrawGLFunctorReleasedCallback(); | 2248 return new DrawGLFunctor(context, mFactory.getWebViewDelegate()); |
| 2249 } | |
| 2250 | |
| 2251 @Override | |
| 2252 public boolean requestDrawGL(Canvas canvas, boolean waitForCompletion, V
iew containerView, | |
| 2253 Runnable releasedCallback) { | |
| 2254 if (mGLfunctor == null) { | |
| 2255 mGLfunctor = new DrawGLFunctor( | |
| 2256 mAwContents.getAwDrawGLViewContext(), mFactory.getWebVie
wDelegate()); | |
| 2257 } | |
| 2258 return mGLfunctor.requestDrawGL( | |
| 2259 canvas, containerView, waitForCompletion, releasedCallback); | |
| 2260 } | |
| 2261 | |
| 2262 @Override | |
| 2263 public void detachGLFunctor() { | |
| 2264 if (mGLfunctor != null) { | |
| 2265 mGLfunctor.detach(); | |
| 2266 } | |
| 2267 } | 2249 } |
| 2268 } | 2250 } |
| 2269 | 2251 |
| 2270 // AwContents.InternalAccessDelegate implementation ------------------------
-------------- | 2252 // AwContents.InternalAccessDelegate implementation ------------------------
-------------- |
| 2271 private class InternalAccessAdapter implements AwContents.InternalAccessDele
gate { | 2253 private class InternalAccessAdapter implements AwContents.InternalAccessDele
gate { |
| 2272 @Override | 2254 @Override |
| 2273 public boolean super_onKeyUp(int arg0, KeyEvent arg1) { | 2255 public boolean super_onKeyUp(int arg0, KeyEvent arg1) { |
| 2274 // Intentional no-op | 2256 // Intentional no-op |
| 2275 return false; | 2257 return false; |
| 2276 } | 2258 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2362 mAwContents.extractSmartClipData(x, y, width, height); | 2344 mAwContents.extractSmartClipData(x, y, width, height); |
| 2363 } | 2345 } |
| 2364 | 2346 |
| 2365 // Implements SmartClipProvider | 2347 // Implements SmartClipProvider |
| 2366 @Override | 2348 @Override |
| 2367 public void setSmartClipResultHandler(final Handler resultHandler) { | 2349 public void setSmartClipResultHandler(final Handler resultHandler) { |
| 2368 checkThread(); | 2350 checkThread(); |
| 2369 mAwContents.setSmartClipResultHandler(resultHandler); | 2351 mAwContents.setSmartClipResultHandler(resultHandler); |
| 2370 } | 2352 } |
| 2371 } | 2353 } |
| OLD | NEW |