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.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // The Context to use. This is different from mWebView.getContext(), which s
hould not be used. | 93 // The Context to use. This is different from mWebView.getContext(), which s
hould not be used. |
94 private final Context mContext; | 94 private final Context mContext; |
95 // The WebViewClient instance that was passed to WebView.setWebViewClient(). | 95 // The WebViewClient instance that was passed to WebView.setWebViewClient(). |
96 private WebViewClient mWebViewClient = sNullWebViewClient; | 96 private WebViewClient mWebViewClient = sNullWebViewClient; |
97 // The WebChromeClient instance that was passed to WebView.setContentViewCli
ent(). | 97 // The WebChromeClient instance that was passed to WebView.setContentViewCli
ent(). |
98 private WebChromeClient mWebChromeClient; | 98 private WebChromeClient mWebChromeClient; |
99 // The listener receiving find-in-page API results. | 99 // The listener receiving find-in-page API results. |
100 private WebView.FindListener mFindListener; | 100 private WebView.FindListener mFindListener; |
101 // The listener receiving notifications of screen updates. | 101 // The listener receiving notifications of screen updates. |
102 private WebView.PictureListener mPictureListener; | 102 private WebView.PictureListener mPictureListener; |
| 103 // Whether the picture listener is invalidate only (i.e. receives a null Pic
ture) |
| 104 private boolean mPictureListenerInvalidateOnly; |
103 | 105 |
104 private WebViewDelegate mWebViewDelegate; | 106 private WebViewDelegate mWebViewDelegate; |
105 | 107 |
106 private DownloadListener mDownloadListener; | 108 private DownloadListener mDownloadListener; |
107 | 109 |
108 private Handler mUiThreadHandler; | 110 private Handler mUiThreadHandler; |
109 | 111 |
110 private static final int NEW_WEBVIEW_CREATED = 100; | 112 private static final int NEW_WEBVIEW_CREATED = 100; |
111 | 113 |
112 private WeakHashMap<AwPermissionRequest, WeakReference<PermissionRequestAdap
ter>> | 114 private WeakHashMap<AwPermissionRequest, WeakReference<PermissionRequestAdap
ter>> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 176 } |
175 | 177 |
176 void setDownloadListener(DownloadListener listener) { | 178 void setDownloadListener(DownloadListener listener) { |
177 mDownloadListener = listener; | 179 mDownloadListener = listener; |
178 } | 180 } |
179 | 181 |
180 void setFindListener(WebView.FindListener listener) { | 182 void setFindListener(WebView.FindListener listener) { |
181 mFindListener = listener; | 183 mFindListener = listener; |
182 } | 184 } |
183 | 185 |
184 void setPictureListener(WebView.PictureListener listener) { | 186 void setPictureListener(WebView.PictureListener listener, boolean invalidate
Only) { |
185 mPictureListener = listener; | 187 mPictureListener = listener; |
| 188 mPictureListenerInvalidateOnly = invalidateOnly; |
186 } | 189 } |
187 | 190 |
188 //--------------------------------------------------------------------------
------------------ | 191 //--------------------------------------------------------------------------
------------------ |
189 // Adapter for all the methods. | 192 // Adapter for all the methods. |
190 //--------------------------------------------------------------------------
------------------ | 193 //--------------------------------------------------------------------------
------------------ |
191 | 194 |
192 /** | 195 /** |
193 * @see AwContentsClient#hasWebViewClient. | 196 * @see AwContentsClient#hasWebViewClient. |
194 */ | 197 */ |
195 @Override | 198 @Override |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 // are invoked. The CTS harness discards any pictures it receives be
fore | 545 // are invoked. The CTS harness discards any pictures it receives be
fore |
543 // onPageStarted is invoked, so in the case we get the Picture befor
e that and | 546 // onPageStarted is invoked, so in the case we get the Picture befor
e that and |
544 // no further updates after onPageStarted, we'll fail the test by ti
ming | 547 // no further updates after onPageStarted, we'll fail the test by ti
ming |
545 // out waiting for a Picture. | 548 // out waiting for a Picture. |
546 if (mPictureListener != null) { | 549 if (mPictureListener != null) { |
547 ThreadUtils.postOnUiThreadDelayed(new Runnable() { | 550 ThreadUtils.postOnUiThreadDelayed(new Runnable() { |
548 @Override | 551 @Override |
549 public void run() { | 552 public void run() { |
550 if (mPictureListener != null) { | 553 if (mPictureListener != null) { |
551 if (TRACE) Log.d(TAG, "onPageFinished-fake"); | 554 if (TRACE) Log.d(TAG, "onPageFinished-fake"); |
552 mPictureListener.onNewPicture(mWebView, new Picture(
)); | 555 mPictureListener.onNewPicture(mWebView, |
| 556 mPictureListenerInvalidateOnly ? null : new
Picture()); |
553 } | 557 } |
554 } | 558 } |
555 }, 100); | 559 }, 100); |
556 } | 560 } |
557 } finally { | 561 } finally { |
558 TraceEvent.end("WebViewContentsClientAdapter.onPageFinished"); | 562 TraceEvent.end("WebViewContentsClientAdapter.onPageFinished"); |
559 } | 563 } |
560 } | 564 } |
561 | 565 |
562 /** | 566 /** |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 mAwPermissionRequest.deny(); | 1296 mAwPermissionRequest.deny(); |
1293 } | 1297 } |
1294 } | 1298 } |
1295 | 1299 |
1296 @Override | 1300 @Override |
1297 public void deny() { | 1301 public void deny() { |
1298 mAwPermissionRequest.deny(); | 1302 mAwPermissionRequest.deny(); |
1299 } | 1303 } |
1300 } | 1304 } |
1301 } | 1305 } |
OLD | NEW |