/** @see AwContentsClient#shouldInterceptRequest(java.lang.String) */
  @Override
  public AwWebResourceResponse shouldInterceptRequest(ShouldInterceptRequestParams params) {
    TraceEvent.begin();
    if (TRACE) Log.d(TAG, "shouldInterceptRequest=" + params.url);
    WebResourceResponse response =
        mWebViewClient.shouldInterceptRequest(mWebView, new WebResourceRequestImpl(params));
    TraceEvent.end();
    if (response == null) return null;

    // AwWebResourceResponse should support null headers. b/16332774.
    Map<String, String> responseHeaders = response.getResponseHeaders();
    if (responseHeaders == null) responseHeaders = new HashMap<String, String>();

    return new AwWebResourceResponse(
        response.getMimeType(),
        response.getEncoding(),
        response.getData(),
        response.getStatusCode(),
        response.getReasonPhrase(),
        responseHeaders);
  }