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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 public void onReceivedError(int errorCode, String description, String failin gUrl) { | 580 public void onReceivedError(int errorCode, String description, String failin gUrl) { |
581 try { | 581 try { |
582 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedError"); | 582 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedError"); |
583 if (description == null || description.isEmpty()) { | 583 if (description == null || description.isEmpty()) { |
584 // ErrorStrings is @hidden, so we can't do this in AwContents. Normally the net/ | 584 // 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 | 585 // layer will set a valid description, but for synthesized callb acks (like in the |
586 // case for intercepted requests) AwContents will pass in null. | 586 // case for intercepted requests) AwContents will pass in null. |
587 description = mWebViewDelegate.getErrorString(mContext, errorCod e); | 587 description = mWebViewDelegate.getErrorString(mContext, errorCod e); |
588 } | 588 } |
589 if (TRACE) Log.d(TAG, "onReceivedError=" + failingUrl); | 589 if (TRACE) Log.d(TAG, "onReceivedError=" + failingUrl); |
590 mWebViewClient.onReceivedError(mWebView, errorCode, description, fai lingUrl); | 590 // TODO(mnaganov): In the next version of glue, this will look as fo llows: |
591 // if (!<next-level-api>) { | |
592 // mWebViewClient.onReceivedError(mWebView, errorCode, description , failingUrl); | |
593 // } | |
594 mWebViewClient.onReceivedError( | |
595 mWebView, errorCode, description, failingUrl); | |
591 } finally { | 596 } finally { |
592 TraceEvent.end("WebViewContentsClientAdapter.onReceivedError"); | 597 TraceEvent.end("WebViewContentsClientAdapter.onReceivedError"); |
593 } | 598 } |
594 } | 599 } |
595 | 600 |
596 /** | 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 try { | |
609 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedError2"); | |
610 if (error.description == null || error.description.isEmpty()) { | |
611 // ErrorStrings is @hidden, so we can't do this in AwContents. Normally the net/ | |
612 // layer will set a valid description, but for synthesized callb acks (like in the | |
613 // case for intercepted requests) AwContents will pass in null. | |
614 error.description = mWebViewDelegate.getErrorString(mContext, er ror.errorCode); | |
Torne
2015/03/09 16:00:36
Is this costly at all? We might want to only do it
mnaganov (inactive)
2015/03/09 16:53:39
It goes into some reflection bullsh*t, so indeed l
| |
615 } | |
616 if (TRACE) Log.d(TAG, "onReceivedError2=" + request.url); | |
617 // TODO(mnaganov): In the next version of glue, this will look as fo llows: | |
618 // if (<next-level-api>) { | |
619 // mWebViewClient.onReceivedError(request, error); | |
620 // } | |
621 } finally { | |
622 TraceEvent.end("WebViewContentsClientAdapter.onReceivedError2"); | |
623 } | |
624 } | |
625 | |
626 /** | |
597 * @see ContentViewClient#onReceivedTitle(String) | 627 * @see ContentViewClient#onReceivedTitle(String) |
598 */ | 628 */ |
599 @Override | 629 @Override |
600 public void onReceivedTitle(String title) { | 630 public void onReceivedTitle(String title) { |
601 try { | 631 try { |
602 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedTitle"); | 632 TraceEvent.begin("WebViewContentsClientAdapter.onReceivedTitle"); |
603 if (mWebChromeClient != null) { | 633 if (mWebChromeClient != null) { |
604 if (TRACE) Log.d(TAG, "onReceivedTitle"); | 634 if (TRACE) Log.d(TAG, "onReceivedTitle"); |
605 mWebChromeClient.onReceivedTitle(mWebView, title); | 635 mWebChromeClient.onReceivedTitle(mWebView, title); |
606 } | 636 } |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1246 else | 1276 else |
1247 mAwPermissionRequest.deny(); | 1277 mAwPermissionRequest.deny(); |
1248 } | 1278 } |
1249 | 1279 |
1250 @Override | 1280 @Override |
1251 public void deny() { | 1281 public void deny() { |
1252 mAwPermissionRequest.deny(); | 1282 mAwPermissionRequest.deny(); |
1253 } | 1283 } |
1254 } | 1284 } |
1255 } | 1285 } |
OLD | NEW |