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 20 /** 21 * Public class for handling javascript prompt requests. A 22 * JsDialogHandlerInterface implentation will receive a jsPrompt call with a 23 * JsPromptResult parameter. This parameter is used to return a result to 24 * WebView. The client can call cancel() to cancel the dialog or confirm() with 25 * the user's input to confirm the dialog. 26 */ 27 public 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 /*package*/ JsPromptResult(CallbackProxy proxy) { 40 super(proxy, /* unused */ false); 41 } 42 43 /*package*/ String getStringResult() { 44 return mStringResult; 45 } 46 47 @Override 48 /*package*/ void handleDefault() { 49 mStringResult = null; 50 super.handleDefault(); 51 } 52 } 53