Home | History | Annotate | Download | only in webkit
      1 /*
      2  * Copyright (C) 2007 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.annotation.SystemApi;
     20 
     21 
     22 /**
     23  * Public class for handling JavaScript prompt requests. The WebChromeClient will receive a
     24  * {@link WebChromeClient#onJsPrompt(WebView, String, String, String, JsPromptResult)} call with a
     25  * JsPromptResult instance as a parameter. This parameter is used to return the result of this user
     26  * dialog prompt back to the WebView instance. The client can call cancel() to cancel the dialog or
     27  * confirm() with the user's input to confirm the dialog.
     28  */
     29 public class JsPromptResult extends JsResult {
     30     // String result of the prompt
     31     private String mStringResult;
     32 
     33     /**
     34      * Handle a confirmation response from the user.
     35      */
     36     public void confirm(String result) {
     37         mStringResult = result;
     38         confirm();
     39     }
     40 
     41     /**
     42      * @hide Only for use by WebViewProvider implementations
     43      */
     44     @SystemApi
     45     public JsPromptResult(ResultReceiver receiver) {
     46         super(receiver);
     47     }
     48 
     49     /**
     50      * @hide Only for use by WebViewProvider implementations
     51      */
     52     @SystemApi
     53     public String getStringResult() {
     54         return mStringResult;
     55     }
     56 }
     57