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