| 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.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.ActivityNotFoundException; | 8 import android.content.ActivityNotFoundException; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 } finally { | 571 } finally { |
| 572 TraceEvent.end("WebViewContentsClientAdapter.onPageFinished"); | 572 TraceEvent.end("WebViewContentsClientAdapter.onPageFinished"); |
| 573 } | 573 } |
| 574 } | 574 } |
| 575 | 575 |
| 576 /** | 576 /** |
| 577 * @see ContentViewClient#onReceivedError(int,String,String) | 577 * @see ContentViewClient#onReceivedError(int,String,String) |
| 578 */ | 578 */ |
| 579 @Override | 579 @Override |
| 580 public void onReceivedError(int errorCode, String description, String failin
gUrl) { | 580 public void onReceivedError(int errorCode, String description, String failin
gUrl) { |
| 581 // TODO(mnaganov): In the next version of glue, this will look as follow
s: |
| 582 // if (<next-level-api>) return; |
| 583 // Currently, we should just run this code always. |
| 584 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.CUR_DEVELOPMENT + 1) ret
urn; |
| 581 try { | 585 try { |
| 582 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedError"); | 586 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedError"); |
| 583 if (description == null || description.isEmpty()) { | 587 if (description == null || description.isEmpty()) { |
| 584 // ErrorStrings is @hidden, so we can't do this in AwContents.
Normally the net/ | 588 // ErrorStrings is @hidden, so we can't do this in AwContents.
Normally the net/ |
| 585 // layer will set a valid description, but for synthesized callb
acks (like in the | 589 // layer will set a valid description, but for synthesized callb
acks (like in the |
| 586 // case for intercepted requests) AwContents will pass in null. | 590 // case for intercepted requests) AwContents will pass in null. |
| 587 description = mWebViewDelegate.getErrorString(mContext, errorCod
e); | 591 description = mWebViewDelegate.getErrorString(mContext, errorCod
e); |
| 588 } | 592 } |
| 589 if (TRACE) Log.d(TAG, "onReceivedError=" + failingUrl); | 593 if (TRACE) Log.d(TAG, "onReceivedError=" + failingUrl); |
| 590 mWebViewClient.onReceivedError(mWebView, errorCode, description, fai
lingUrl); | 594 mWebViewClient.onReceivedError( |
| 595 mWebView, errorCode, description, failingUrl); |
| 591 } finally { | 596 } finally { |
| 592 TraceEvent.end("WebViewContentsClientAdapter.onReceivedError"); | 597 TraceEvent.end("WebViewContentsClientAdapter.onReceivedError"); |
| 593 } | 598 } |
| 599 } |
| 600 |
| 601 /** |
| 602 * @see ContentViewClient#onReceivedError( |
| 603 * AwContentsClient.AwWebResourceRequest,AwContentsClient.AwWebResourceError
) |
| 604 */ |
| 605 @Override |
| 606 public void onReceivedError2(AwContentsClient.AwWebResourceRequest request, |
| 607 AwContentsClient.AwWebResourceError error) { |
| 608 // TODO(mnaganov): In the next version of glue, this will look as follow
s: |
| 609 // if (!<next-level-api>) return; |
| 610 // Currently, we should never run this code. |
| 611 if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.CUR_DEVELOPMENT + 1) re
turn; |
| 612 try { |
| 613 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedError"); |
| 614 if (error.description == null || error.description.isEmpty()) { |
| 615 // ErrorStrings is @hidden, so we can't do this in AwContents.
Normally the net/ |
| 616 // layer will set a valid description, but for synthesized callb
acks (like in the |
| 617 // case for intercepted requests) AwContents will pass in null. |
| 618 error.description = mWebViewDelegate.getErrorString(mContext, er
ror.errorCode); |
| 619 } |
| 620 if (TRACE) Log.d(TAG, "onReceivedError=" + request.url); |
| 621 // TODO(mnaganov): When the new API becomes available, uncomment the
following: |
| 622 // mWebViewClient.onReceivedError(request, error); |
| 623 } finally { |
| 624 TraceEvent.end("WebViewContentsClientAdapter.onReceivedError"); |
| 625 } |
| 594 } | 626 } |
| 595 | 627 |
| 596 /** | 628 /** |
| 597 * @see ContentViewClient#onReceivedTitle(String) | 629 * @see ContentViewClient#onReceivedTitle(String) |
| 598 */ | 630 */ |
| 599 @Override | 631 @Override |
| 600 public void onReceivedTitle(String title) { | 632 public void onReceivedTitle(String title) { |
| 601 try { | 633 try { |
| 602 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedTitle"); | 634 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedTitle"); |
| 603 if (mWebChromeClient != null) { | 635 if (mWebChromeClient != null) { |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 else | 1278 else |
| 1247 mAwPermissionRequest.deny(); | 1279 mAwPermissionRequest.deny(); |
| 1248 } | 1280 } |
| 1249 | 1281 |
| 1250 @Override | 1282 @Override |
| 1251 public void deny() { | 1283 public void deny() { |
| 1252 mAwPermissionRequest.deny(); | 1284 mAwPermissionRequest.deny(); |
| 1253 } | 1285 } |
| 1254 } | 1286 } |
| 1255 } | 1287 } |
| OLD | NEW |