Home | History | Annotate | Download | only in webkit
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.webkit;
     18 
     19 import android.net.Uri;
     20 
     21 import java.io.InputStream;
     22 import java.util.Map;
     23 
     24 /**
     25  * Encompasses parameters to the {@link WebViewClient#shouldInterceptRequest} method.
     26  */
     27 public interface WebResourceRequest {
     28     /**
     29      * Gets the URL for which the resource request was made.
     30      *
     31      * @return the URL for which the resource request was made.
     32      */
     33     Uri getUrl();
     34 
     35     /**
     36      * Gets whether the request was made for the main frame.
     37      *
     38      * @return whether the request was made for the main frame. Will be false for iframes,
     39      *         for example.
     40      */
     41     boolean isForMainFrame();
     42 
     43     /**
     44      * Gets whether a gesture (such as a click) was associated with the request.
     45      *
     46      * @return whether a gesture was associated with the request.
     47      */
     48     boolean hasGesture();
     49 
     50     /**
     51      * Gets the method associated with the request, for example "GET".
     52      *
     53      * @return the method associated with the request.
     54      */
     55     String getMethod();
     56 
     57     /**
     58      * Gets the headers associated with the request. These are represented as a mapping of header
     59      * name to header value.
     60      *
     61      * @return the headers associated with the request.
     62      */
     63     Map<String, String> getRequestHeaders();
     64 }
     65