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.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 private ContentSettingsAdapter mWebSettings; | 94 private ContentSettingsAdapter mWebSettings; |
95 // The WebView wrapper for ContentViewCore and required browser compontents. | 95 // The WebView wrapper for ContentViewCore and required browser compontents. |
96 AwContents mAwContents; | 96 AwContents mAwContents; |
97 // Non-null if this webview is using the GL accelerated draw path. | 97 // Non-null if this webview is using the GL accelerated draw path. |
98 private DrawGLFunctor mGLfunctor; | 98 private DrawGLFunctor mGLfunctor; |
99 | 99 |
100 private final WebView.HitTestResult mHitTestResult; | 100 private final WebView.HitTestResult mHitTestResult; |
101 | 101 |
102 private final int mAppTargetSdkVersion; | 102 private final int mAppTargetSdkVersion; |
103 | 103 |
104 private WebViewChromiumFactoryProvider mFactory; | 104 protected WebViewChromiumFactoryProvider mFactory; |
105 | 105 |
106 private final boolean mShouldDisableThreadChecking; | 106 private final boolean mShouldDisableThreadChecking; |
107 | 107 |
108 private static boolean sRecordWholeDocumentEnabledByApi; | 108 private static boolean sRecordWholeDocumentEnabledByApi; |
109 static void enableSlowWholeDocumentDraw() { | 109 static void enableSlowWholeDocumentDraw() { |
110 sRecordWholeDocumentEnabledByApi = true; | 110 sRecordWholeDocumentEnabledByApi = true; |
111 } | 111 } |
112 | 112 |
113 // This does not touch any global / non-threadsafe state, but note that | 113 // This does not touch any global / non-threadsafe state, but note that |
114 // init is ofter called right after and is NOT threadsafe. | 114 // init is ofter called right after and is NOT threadsafe. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 // TODO: This assumes AwContents ignores second Paint param. | 243 // TODO: This assumes AwContents ignores second Paint param. |
244 mAwContents.setLayerType(mWebView.getLayerType(), null); | 244 mAwContents.setLayerType(mWebView.getLayerType(), null); |
245 } | 245 } |
246 | 246 |
247 private RuntimeException createThreadException() { | 247 private RuntimeException createThreadException() { |
248 return new IllegalStateException( | 248 return new IllegalStateException( |
249 "Calling View methods on another thread than the UI thread."); | 249 "Calling View methods on another thread than the UI thread."); |
250 } | 250 } |
251 | 251 |
252 private boolean checkNeedsPost() { | 252 protected boolean checkNeedsPost() { |
253 boolean needsPost = !mFactory.hasStarted() || !ThreadUtils.runningOnUiTh
read(); | 253 boolean needsPost = !mFactory.hasStarted() || !ThreadUtils.runningOnUiTh
read(); |
254 if (!needsPost && mAwContents == null) { | 254 if (!needsPost && mAwContents == null) { |
255 throw new IllegalStateException("AwContents must be created if we ar
e not posting!"); | 255 throw new IllegalStateException("AwContents must be created if we ar
e not posting!"); |
256 } | 256 } |
257 return needsPost; | 257 return needsPost; |
258 } | 258 } |
259 | 259 |
260 // Intentionally not static, as no need to check thread on static methods | 260 // Intentionally not static, as no need to check thread on static methods |
261 private void checkThread() { | 261 private void checkThread() { |
262 if (!ThreadUtils.runningOnUiThread()) { | 262 if (!ThreadUtils.runningOnUiThread()) { |
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2273 mAwContents.extractSmartClipData(x, y, width, height); | 2273 mAwContents.extractSmartClipData(x, y, width, height); |
2274 } | 2274 } |
2275 | 2275 |
2276 // Implements SmartClipProvider | 2276 // Implements SmartClipProvider |
2277 @Override | 2277 @Override |
2278 public void setSmartClipResultHandler(final Handler resultHandler) { | 2278 public void setSmartClipResultHandler(final Handler resultHandler) { |
2279 checkThread(); | 2279 checkThread(); |
2280 mAwContents.setSmartClipResultHandler(resultHandler); | 2280 mAwContents.setSmartClipResultHandler(resultHandler); |
2281 } | 2281 } |
2282 } | 2282 } |
OLD | NEW |