Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 992593003: [Android WebView] Lay the groundwork for a better onReceivedError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.content.ComponentCallbacks2; 9 import android.content.ComponentCallbacks2;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 // Return the response directly if the url is default video poster u rl. 363 // Return the response directly if the url is default video poster u rl.
364 awWebResourceResponse = mDefaultVideoPosterRequestHandler.shouldInte rceptRequest(url); 364 awWebResourceResponse = mDefaultVideoPosterRequestHandler.shouldInte rceptRequest(url);
365 if (awWebResourceResponse != null) return awWebResourceResponse; 365 if (awWebResourceResponse != null) return awWebResourceResponse;
366 366
367 awWebResourceResponse = mContentsClient.shouldInterceptRequest(reque st); 367 awWebResourceResponse = mContentsClient.shouldInterceptRequest(reque st);
368 368
369 if (awWebResourceResponse == null) { 369 if (awWebResourceResponse == null) {
370 mContentsClient.getCallbackHelper().postOnLoadResource(url); 370 mContentsClient.getCallbackHelper().postOnLoadResource(url);
371 } 371 }
372 372
373 if (request.isMainFrame && awWebResourceResponse != null 373 if (awWebResourceResponse != null && awWebResourceResponse.getData() == null) {
374 && awWebResourceResponse.getData() == null) {
375 // In this case the intercepted URLRequest job will simulate an empty response 374 // In this case the intercepted URLRequest job will simulate an empty response
376 // which doesn't trigger the onReceivedError callback. For WebVi ewClassic 375 // which doesn't trigger the onReceivedError callback. For WebVi ewClassic
377 // compatibility we synthesize that callback. http://crbug.com/1 80950 376 // compatibility we synthesize that callback. http://crbug.com/1 80950
378 mContentsClient.getCallbackHelper().postOnReceivedError( 377 mContentsClient.getCallbackHelper().postOnReceivedError(
379 ErrorCodeConversionHelper.ERROR_UNKNOWN, 378 request,
380 null /* filled in by the glue layer */, url); 379 /* error description filled in by the glue layer */
380 new AwContentsClient.AwWebResourceError());
381 } 381 }
382 return awWebResourceResponse; 382 return awWebResourceResponse;
383 } 383 }
384 384
385 @Override 385 @Override
386 public boolean shouldBlockContentUrls() { 386 public boolean shouldBlockContentUrls() {
387 return !mSettings.getAllowContentAccess(); 387 return !mSettings.getAllowContentAccess();
388 } 388 }
389 389
390 @Override 390 @Override
(...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo rter awPdfExporter); 2803 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo rter awPdfExporter);
2804 2804
2805 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin, 2805 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin,
2806 long resources); 2806 long resources);
2807 2807
2808 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId, 2808 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId,
2809 String message, String targetOrigin, int[] msgPorts); 2809 String message, String targetOrigin, int[] msgPorts);
2810 2810
2811 private native void nativeCreateMessageChannel(long nativeAwContents, Messag ePort[] ports); 2811 private native void nativeCreateMessageChannel(long nativeAwContents, Messag ePort[] ports);
2812 } 2812 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698