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