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; |
| 8 import android.annotation.TargetApi; |
7 import android.app.assist.AssistStructure.ViewNode; | 9 import android.app.assist.AssistStructure.ViewNode; |
8 import android.content.Context; | 10 import android.content.Context; |
9 import android.content.res.Configuration; | 11 import android.content.res.Configuration; |
10 import android.graphics.Bitmap; | 12 import android.graphics.Bitmap; |
11 import android.graphics.Canvas; | 13 import android.graphics.Canvas; |
12 import android.graphics.Paint; | 14 import android.graphics.Paint; |
13 import android.graphics.Picture; | 15 import android.graphics.Picture; |
14 import android.graphics.Rect; | 16 import android.graphics.Rect; |
15 import android.graphics.drawable.Drawable; | 17 import android.graphics.drawable.Drawable; |
16 import android.net.Uri; | 18 import android.net.Uri; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 191 |
190 private <T> T runOnUiThreadBlocking(Callable<T> c) { | 192 private <T> T runOnUiThreadBlocking(Callable<T> c) { |
191 return runBlockingFuture(new FutureTask<T>(c)); | 193 return runBlockingFuture(new FutureTask<T>(c)); |
192 } | 194 } |
193 | 195 |
194 // WebViewProvider methods -------------------------------------------------
------------------- | 196 // WebViewProvider methods -------------------------------------------------
------------------- |
195 | 197 |
196 @Override | 198 @Override |
197 // BUG=6790250 |javaScriptInterfaces| was only ever used by the obsolete Dum
pRenderTree | 199 // BUG=6790250 |javaScriptInterfaces| was only ever used by the obsolete Dum
pRenderTree |
198 // so is ignored. TODO: remove it from WebViewProvider. | 200 // so is ignored. TODO: remove it from WebViewProvider. |
| 201 @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
199 public void init(final Map<String, Object> javaScriptInterfaces, | 202 public void init(final Map<String, Object> javaScriptInterfaces, |
200 final boolean privateBrowsing) { | 203 final boolean privateBrowsing) { |
201 if (privateBrowsing) { | 204 if (privateBrowsing) { |
202 mFactory.startYourEngines(true); | 205 mFactory.startYourEngines(true); |
203 final String msg = "Private browsing is not supported in WebView."; | 206 final String msg = "Private browsing is not supported in WebView."; |
204 if (mAppTargetSdkVersion >= Build.VERSION_CODES.KITKAT) { | 207 if (mAppTargetSdkVersion >= Build.VERSION_CODES.KITKAT) { |
205 throw new IllegalArgumentException(msg); | 208 throw new IllegalArgumentException(msg); |
206 } else { | 209 } else { |
207 Log.w(TAG, msg); | 210 Log.w(TAG, msg); |
208 TextView warningLabel = new TextView(mContext); | 211 TextView warningLabel = new TextView(mContext); |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 public void run() { | 1708 public void run() { |
1706 onWindowVisibilityChanged(visibility); | 1709 onWindowVisibilityChanged(visibility); |
1707 } | 1710 } |
1708 }); | 1711 }); |
1709 return; | 1712 return; |
1710 } | 1713 } |
1711 mAwContents.onWindowVisibilityChanged(visibility); | 1714 mAwContents.onWindowVisibilityChanged(visibility); |
1712 } | 1715 } |
1713 | 1716 |
1714 @Override | 1717 @Override |
| 1718 @SuppressLint("DrawAllocation") |
1715 public void onDraw(final Canvas canvas) { | 1719 public void onDraw(final Canvas canvas) { |
1716 mFactory.startYourEngines(true); | 1720 mFactory.startYourEngines(true); |
1717 if (checkNeedsPost()) { | 1721 if (checkNeedsPost()) { |
1718 runVoidTaskOnUiThreadBlocking(new Runnable() { | 1722 runVoidTaskOnUiThreadBlocking(new Runnable() { |
1719 @Override | 1723 @Override |
1720 public void run() { | 1724 public void run() { |
1721 onDraw(canvas); | 1725 onDraw(canvas); |
1722 } | 1726 } |
1723 }); | 1727 }); |
1724 return; | 1728 return; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2001 return requestFocus(direction, previouslyFocusedRect); | 2005 return requestFocus(direction, previouslyFocusedRect); |
2002 } | 2006 } |
2003 }); | 2007 }); |
2004 return ret; | 2008 return ret; |
2005 } | 2009 } |
2006 mAwContents.requestFocus(); | 2010 mAwContents.requestFocus(); |
2007 return mWebViewPrivate.super_requestFocus(direction, previouslyFocusedRe
ct); | 2011 return mWebViewPrivate.super_requestFocus(direction, previouslyFocusedRe
ct); |
2008 } | 2012 } |
2009 | 2013 |
2010 @Override | 2014 @Override |
| 2015 @SuppressLint("DrawAllocation") |
2011 public void onMeasure(final int widthMeasureSpec, final int heightMeasureSpe
c) { | 2016 public void onMeasure(final int widthMeasureSpec, final int heightMeasureSpe
c) { |
2012 mFactory.startYourEngines(false); | 2017 mFactory.startYourEngines(false); |
2013 if (checkNeedsPost()) { | 2018 if (checkNeedsPost()) { |
2014 runVoidTaskOnUiThreadBlocking(new Runnable() { | 2019 runVoidTaskOnUiThreadBlocking(new Runnable() { |
2015 @Override | 2020 @Override |
2016 public void run() { | 2021 public void run() { |
2017 onMeasure(widthMeasureSpec, heightMeasureSpec); | 2022 onMeasure(widthMeasureSpec, heightMeasureSpec); |
2018 } | 2023 } |
2019 }); | 2024 }); |
2020 return; | 2025 return; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 mAwContents.extractSmartClipData(x, y, width, height); | 2293 mAwContents.extractSmartClipData(x, y, width, height); |
2289 } | 2294 } |
2290 | 2295 |
2291 // Implements SmartClipProvider | 2296 // Implements SmartClipProvider |
2292 @Override | 2297 @Override |
2293 public void setSmartClipResultHandler(final Handler resultHandler) { | 2298 public void setSmartClipResultHandler(final Handler resultHandler) { |
2294 checkThread(); | 2299 checkThread(); |
2295 mAwContents.setSmartClipResultHandler(resultHandler); | 2300 mAwContents.setSmartClipResultHandler(resultHandler); |
2296 } | 2301 } |
2297 } | 2302 } |
OLD | NEW |