Chromium Code Reviews| 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.TargetApi; | 8 import android.annotation.TargetApi; |
| 8 import android.content.Context; | 9 import android.content.Context; |
| 9 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
| 10 import android.graphics.BitmapFactory; | 11 import android.graphics.BitmapFactory; |
| 11 import android.graphics.Canvas; | 12 import android.graphics.Canvas; |
| 12 import android.graphics.Color; | 13 import android.graphics.Color; |
| 13 import android.graphics.Picture; | 14 import android.graphics.Picture; |
| 14 import android.net.Uri; | 15 import android.net.Uri; |
| 15 import android.net.http.SslError; | 16 import android.net.http.SslError; |
| 16 import android.os.Build; | 17 import android.os.Build; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 private WebViewDelegate mWebViewDelegate; | 104 private WebViewDelegate mWebViewDelegate; |
| 104 | 105 |
| 105 private DownloadListener mDownloadListener; | 106 private DownloadListener mDownloadListener; |
| 106 | 107 |
| 107 private Handler mUiThreadHandler; | 108 private Handler mUiThreadHandler; |
| 108 | 109 |
| 109 private static final int NEW_WEBVIEW_CREATED = 100; | 110 private static final int NEW_WEBVIEW_CREATED = 100; |
| 110 | 111 |
| 111 private WeakHashMap<AwPermissionRequest, WeakReference<PermissionRequestAdap ter>> | 112 private WeakHashMap<AwPermissionRequest, WeakReference<PermissionRequestAdap ter>> |
| 112 mOngoingPermissionRequests; | 113 mOngoingPermissionRequests; |
| 114 | |
| 115 // Suppress the handler leak lint warning because: | |
| 116 // 1. the handler does not get GC'ed when there are still pending messages, which does | |
| 117 // not happen when there are no delayed messages. | |
| 118 // 2. If the app returns true for WebChromeClient#onCreateWindow callback bu t | |
| 119 // does not reply to the message with the WebView instance for the popup, th en the | |
| 120 // static handler + weak reference pattern will have to deal with the case w here the | |
| 121 // original webview instance being GC'ed by the time NEW_WEBVIEW_CREATED is sent by the | |
| 122 // app. Too much complexity for little gain. | |
| 123 @SuppressLint("HandlerLeak") | |
|
boliu
2016/08/24 21:25:43
I say don't bother with the comment. it's bound to
hush (inactive)
2016/08/30 21:58:17
Done.
| |
| 113 /** | 124 /** |
| 114 * Adapter constructor. | 125 * Adapter constructor. |
| 115 * | 126 * |
| 116 * @param webView the {@link WebView} instance that this adapter is serving. | 127 * @param webView the {@link WebView} instance that this adapter is serving. |
| 117 */ | 128 */ |
| 118 WebViewContentsClientAdapter(WebView webView, Context context, | 129 WebViewContentsClientAdapter(WebView webView, Context context, |
| 119 WebViewDelegate webViewDelegate) { | 130 WebViewDelegate webViewDelegate) { |
| 120 if (webView == null || webViewDelegate == null) { | 131 if (webView == null || webViewDelegate == null) { |
| 121 throw new IllegalArgumentException("webView or delegate can't be nul l."); | 132 throw new IllegalArgumentException("webView or delegate can't be nul l."); |
| 122 } | 133 } |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1282 mAwPermissionRequest.deny(); | 1293 mAwPermissionRequest.deny(); |
| 1283 } | 1294 } |
| 1284 } | 1295 } |
| 1285 | 1296 |
| 1286 @Override | 1297 @Override |
| 1287 public void deny() { | 1298 public void deny() { |
| 1288 mAwPermissionRequest.deny(); | 1299 mAwPermissionRequest.deny(); |
| 1289 } | 1300 } |
| 1290 } | 1301 } |
| 1291 } | 1302 } |
| OLD | NEW |