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.TargetApi; | |
7 import android.content.Context; | 8 import android.content.Context; |
8 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
9 import android.graphics.BitmapFactory; | 10 import android.graphics.BitmapFactory; |
10 import android.graphics.Canvas; | 11 import android.graphics.Canvas; |
11 import android.graphics.Color; | 12 import android.graphics.Color; |
12 import android.graphics.Picture; | 13 import android.graphics.Picture; |
13 import android.net.Uri; | 14 import android.net.Uri; |
14 import android.net.http.SslError; | 15 import android.net.http.SslError; |
15 import android.os.Build; | 16 import android.os.Build; |
16 import android.os.Handler; | 17 import android.os.Handler; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 * | 73 * |
73 * A {@link ContentViewClient} may be shared between multiple {@link ContentView }s, | 74 * A {@link ContentViewClient} may be shared between multiple {@link ContentView }s, |
74 * and hence multiple WebViews. Many WebViewClient methods pass the source | 75 * and hence multiple WebViews. Many WebViewClient methods pass the source |
75 * WebView as an argument. This means that we either need to pass the | 76 * WebView as an argument. This means that we either need to pass the |
76 * corresponding ContentView to the corresponding ContentViewClient methods, | 77 * corresponding ContentView to the corresponding ContentViewClient methods, |
77 * or use an instance of ContentViewClientAdapter per WebViewChromium, to | 78 * or use an instance of ContentViewClientAdapter per WebViewChromium, to |
78 * allow the source WebView to be injected by ContentViewClientAdapter. We | 79 * allow the source WebView to be injected by ContentViewClientAdapter. We |
79 * choose the latter, because it makes for a cleaner design. | 80 * choose the latter, because it makes for a cleaner design. |
80 */ | 81 */ |
81 @SuppressWarnings("deprecation") | 82 @SuppressWarnings("deprecation") |
83 // You shouldn't change TargetApi, please see how Android M API was added. | |
84 @TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
newt (away)
2015/10/13 21:50:57
Why is it overkill to use @TargetApi on individual
michaelbai
2015/10/13 22:03:48
Yes, Webview only update down to L.
| |
82 public class WebViewContentsClientAdapter extends AwContentsClient { | 85 public class WebViewContentsClientAdapter extends AwContentsClient { |
83 // TAG is chosen for consistency with classic webview tracing. | 86 // TAG is chosen for consistency with classic webview tracing. |
84 private static final String TAG = "WebViewCallback"; | 87 private static final String TAG = "WebViewCallback"; |
85 // Enables API callback tracing | 88 // Enables API callback tracing |
86 private static final boolean TRACE = false; | 89 private static final boolean TRACE = false; |
87 // Default WebViewClient used to avoid null checks. | 90 // Default WebViewClient used to avoid null checks. |
88 private static WebViewClient sNullWebViewClient = new WebViewClient(); | 91 private static WebViewClient sNullWebViewClient = new WebViewClient(); |
89 // The WebView instance that this adapter is serving. | 92 // The WebView instance that this adapter is serving. |
90 private final WebView mWebView; | 93 private final WebView mWebView; |
91 // The Context to use. This is different from mWebView.getContext(), which s hould not be used. | 94 // The Context to use. This is different from mWebView.getContext(), which s hould not be used. |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1273 mAwPermissionRequest.deny(); | 1276 mAwPermissionRequest.deny(); |
1274 } | 1277 } |
1275 } | 1278 } |
1276 | 1279 |
1277 @Override | 1280 @Override |
1278 public void deny() { | 1281 public void deny() { |
1279 mAwPermissionRequest.deny(); | 1282 mAwPermissionRequest.deny(); |
1280 } | 1283 } |
1281 } | 1284 } |
1282 } | 1285 } |
OLD | NEW |