| 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.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.BitmapFactory; | 9 import android.graphics.BitmapFactory; |
| 10 import android.graphics.Canvas; | 10 import android.graphics.Canvas; |
| 11 import android.graphics.Color; | 11 import android.graphics.Color; |
| 12 import android.graphics.Picture; | 12 import android.graphics.Picture; |
| 13 import android.net.Uri; | 13 import android.net.Uri; |
| 14 import android.net.http.SslError; | 14 import android.net.http.SslError; |
| 15 import android.os.Build; | 15 import android.os.Build; |
| 16 import android.os.Handler; | 16 import android.os.Handler; |
| 17 import android.os.Message; | 17 import android.os.Message; |
| 18 import android.util.Log; | 18 import android.util.Log; |
| 19 import android.view.ActionMode; | |
| 20 import android.view.KeyEvent; | 19 import android.view.KeyEvent; |
| 21 import android.view.View; | 20 import android.view.View; |
| 22 import android.webkit.ClientCertRequest; | 21 import android.webkit.ClientCertRequest; |
| 23 import android.webkit.ConsoleMessage; | 22 import android.webkit.ConsoleMessage; |
| 24 import android.webkit.DownloadListener; | 23 import android.webkit.DownloadListener; |
| 25 import android.webkit.GeolocationPermissions; | 24 import android.webkit.GeolocationPermissions; |
| 26 import android.webkit.JsDialogHelper; | 25 import android.webkit.JsDialogHelper; |
| 27 import android.webkit.JsPromptResult; | 26 import android.webkit.JsPromptResult; |
| 28 import android.webkit.JsResult; | 27 import android.webkit.JsResult; |
| 29 import android.webkit.PermissionRequest; | 28 import android.webkit.PermissionRequest; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 45 import org.chromium.android_webview.AwWebResourceResponse; | 44 import org.chromium.android_webview.AwWebResourceResponse; |
| 46 import org.chromium.android_webview.JsPromptResultReceiver; | 45 import org.chromium.android_webview.JsPromptResultReceiver; |
| 47 import org.chromium.android_webview.JsResultReceiver; | 46 import org.chromium.android_webview.JsResultReceiver; |
| 48 import org.chromium.android_webview.permission.AwPermissionRequest; | 47 import org.chromium.android_webview.permission.AwPermissionRequest; |
| 49 import org.chromium.android_webview.permission.Resource; | 48 import org.chromium.android_webview.permission.Resource; |
| 50 import org.chromium.base.ThreadUtils; | 49 import org.chromium.base.ThreadUtils; |
| 51 import org.chromium.base.TraceEvent; | 50 import org.chromium.base.TraceEvent; |
| 52 import org.chromium.content.browser.ContentView; | 51 import org.chromium.content.browser.ContentView; |
| 53 import org.chromium.content.browser.ContentViewClient; | 52 import org.chromium.content.browser.ContentViewClient; |
| 54 import org.chromium.content.browser.ContentViewCore; | 53 import org.chromium.content.browser.ContentViewCore; |
| 55 import org.chromium.content.browser.WebActionMode; | |
| 56 import org.chromium.content.browser.WebActionModeCallback; | |
| 57 import org.chromium.content.browser.WebActionModeCallback.ActionHandler; | |
| 58 | 54 |
| 59 import java.lang.ref.WeakReference; | 55 import java.lang.ref.WeakReference; |
| 60 import java.security.Principal; | 56 import java.security.Principal; |
| 61 import java.security.PrivateKey; | 57 import java.security.PrivateKey; |
| 62 import java.security.cert.X509Certificate; | 58 import java.security.cert.X509Certificate; |
| 63 import java.util.ArrayList; | 59 import java.util.ArrayList; |
| 64 import java.util.HashMap; | 60 import java.util.HashMap; |
| 65 import java.util.Map; | 61 import java.util.Map; |
| 66 import java.util.WeakHashMap; | 62 import java.util.WeakHashMap; |
| 67 | 63 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 try { | 389 try { |
| 394 TraceEvent.begin("WebViewContentsClientAdapter.onNewPicture"); | 390 TraceEvent.begin("WebViewContentsClientAdapter.onNewPicture"); |
| 395 if (mPictureListener == null) return; | 391 if (mPictureListener == null) return; |
| 396 if (TRACE) Log.d(TAG, "onNewPicture"); | 392 if (TRACE) Log.d(TAG, "onNewPicture"); |
| 397 mPictureListener.onNewPicture(mWebView, picture); | 393 mPictureListener.onNewPicture(mWebView, picture); |
| 398 } finally { | 394 } finally { |
| 399 TraceEvent.end("WebViewContentsClientAdapter.onNewPicture"); | 395 TraceEvent.end("WebViewContentsClientAdapter.onNewPicture"); |
| 400 } | 396 } |
| 401 } | 397 } |
| 402 | 398 |
| 403 /** | |
| 404 * @See AwContentsClient#startActionMode(View,ActionHandler,boolean) | |
| 405 */ | |
| 406 @Override | |
| 407 public WebActionMode startActionMode( | |
| 408 View view, ActionHandler actionHandler, boolean floating) { | |
| 409 try { | |
| 410 TraceEvent.begin("WebViewContentsClientAdapter.startActionMode"); | |
| 411 if (TRACE) Log.d(TAG, "startActionMode"); | |
| 412 if (floating && !supportsFloatingActionMode()) return null; | |
| 413 if (floating) { | |
| 414 return startFloatingActionMode(view, actionHandler); | |
| 415 } else { | |
| 416 return startDefaultActionMode(view, actionHandler); | |
| 417 } | |
| 418 } finally { | |
| 419 TraceEvent.end("WebViewContentsClientAdapter.startActionMode"); | |
| 420 } | |
| 421 } | |
| 422 | |
| 423 private WebActionMode startDefaultActionMode(View view, ActionHandler action
Handler) { | |
| 424 ActionMode.Callback callback = | |
| 425 new WebActionModeCallback(view.getContext(), actionHandler); | |
| 426 return new WebActionMode(view.startActionMode(callback)); | |
| 427 } | |
| 428 | |
| 429 private WebActionMode startFloatingActionMode(View view, ActionHandler actio
nHandler) { | |
| 430 ActionMode.Callback2 callback = | |
| 431 new FloatingWebActionModeCallback(view.getContext(), actionHandl
er); | |
| 432 ActionMode actionMode = view.startActionMode(callback, ActionMode.TYPE_F
LOATING); | |
| 433 return actionMode != null ? new FloatingWebActionMode(actionMode) : null
; | |
| 434 } | |
| 435 | |
| 436 /** | |
| 437 * @See AwContentsClient#supportsFloatingActionMode() | |
| 438 */ | |
| 439 @Override | |
| 440 public boolean supportsFloatingActionMode() { | |
| 441 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; | |
| 442 } | |
| 443 | |
| 444 @Override | 399 @Override |
| 445 public void onLoadResource(String url) { | 400 public void onLoadResource(String url) { |
| 446 try { | 401 try { |
| 447 TraceEvent.begin("WebViewContentsClientAdapter.onLoadResource"); | 402 TraceEvent.begin("WebViewContentsClientAdapter.onLoadResource"); |
| 448 if (TRACE) Log.d(TAG, "onLoadResource=" + url); | 403 if (TRACE) Log.d(TAG, "onLoadResource=" + url); |
| 449 mWebViewClient.onLoadResource(mWebView, url); | 404 mWebViewClient.onLoadResource(mWebView, url); |
| 450 } finally { | 405 } finally { |
| 451 TraceEvent.end("WebViewContentsClientAdapter.onLoadResource"); | 406 TraceEvent.end("WebViewContentsClientAdapter.onLoadResource"); |
| 452 } | 407 } |
| 453 } | 408 } |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 mAwPermissionRequest.deny(); | 1272 mAwPermissionRequest.deny(); |
| 1318 } | 1273 } |
| 1319 } | 1274 } |
| 1320 | 1275 |
| 1321 @Override | 1276 @Override |
| 1322 public void deny() { | 1277 public void deny() { |
| 1323 mAwPermissionRequest.deny(); | 1278 mAwPermissionRequest.deny(); |
| 1324 } | 1279 } |
| 1325 } | 1280 } |
| 1326 } | 1281 } |
| OLD | NEW |