am ea44c7c7: Merge "Pass the auto login header information to the app." into honeycomb-mr1
* commit 'ea44c7c71431adbce348cf9ef3f22d9561bb7fc1': Pass the auto login header information to the app.
This commit is contained in:
@@ -244923,6 +244923,25 @@
|
||||
<parameter name="realm" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="onReceivedLoginRequest"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="view" type="android.webkit.WebView">
|
||||
</parameter>
|
||||
<parameter name="realm" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="account" type="java.lang.String">
|
||||
</parameter>
|
||||
<parameter name="args" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="onReceivedSslError"
|
||||
return="void"
|
||||
abstract="false"
|
||||
|
||||
@@ -1237,11 +1237,17 @@ class BrowserFrame extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*package*/ SearchBox getSearchBox() {
|
||||
return mSearchBox;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by JNI when processing the X-Auto-Login header.
|
||||
*/
|
||||
private void autoLogin(String realm, String account, String args) {
|
||||
mCallbackProxy.onReceivedLoginRequest(realm, account, args);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// native functions
|
||||
//==========================================================================
|
||||
|
||||
@@ -117,6 +117,7 @@ class CallbackProxy extends Handler {
|
||||
private static final int AUTH_CREDENTIALS = 137;
|
||||
private static final int SET_INSTALLABLE_WEBAPP = 138;
|
||||
private static final int NOTIFY_SEARCHBOX_LISTENERS = 139;
|
||||
private static final int AUTO_LOGIN = 140;
|
||||
|
||||
// Message triggered by the client to resume execution
|
||||
private static final int NOTIFY = 200;
|
||||
@@ -770,7 +771,7 @@ class CallbackProxy extends Handler {
|
||||
(WebHistoryItem) msg.obj, msg.arg1);
|
||||
}
|
||||
break;
|
||||
case AUTH_CREDENTIALS:
|
||||
case AUTH_CREDENTIALS: {
|
||||
String host = msg.getData().getString("host");
|
||||
String realm = msg.getData().getString("realm");
|
||||
username = msg.getData().getString("username");
|
||||
@@ -778,6 +779,7 @@ class CallbackProxy extends Handler {
|
||||
mWebView.setHttpAuthUsernamePassword(
|
||||
host, realm, username, password);
|
||||
break;
|
||||
}
|
||||
case SET_INSTALLABLE_WEBAPP:
|
||||
if (mWebChromeClient != null) {
|
||||
mWebChromeClient.setInstallableWebApp();
|
||||
@@ -789,6 +791,17 @@ class CallbackProxy extends Handler {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> suggestions = (List<String>) msg.obj;
|
||||
searchBox.handleSuggestions(msg.getData().getString("query"), suggestions);
|
||||
break;
|
||||
case AUTO_LOGIN: {
|
||||
if (mWebViewClient != null) {
|
||||
String realm = msg.getData().getString("realm");
|
||||
String account = msg.getData().getString("account");
|
||||
String args = msg.getData().getString("args");
|
||||
mWebViewClient.onReceivedLoginRequest(mWebView, realm,
|
||||
account, args);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1051,6 +1064,20 @@ class CallbackProxy extends Handler {
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
void onReceivedLoginRequest(String realm, String account, String args) {
|
||||
// Do an unsynchronized quick check to avoid posting if no callback has
|
||||
// been set.
|
||||
if (mWebViewClient == null) {
|
||||
return;
|
||||
}
|
||||
Message msg = obtainMessage(AUTO_LOGIN);
|
||||
Bundle bundle = msg.getData();
|
||||
bundle.putString("realm", realm);
|
||||
bundle.putString("account", account);
|
||||
bundle.putString("args", args);
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// DownloadListener functions.
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -256,4 +256,18 @@ public class WebViewClient {
|
||||
*/
|
||||
public void onScaleChanged(WebView view, float oldScale, float newScale) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the host application that a request to automatically log in the
|
||||
* user has been processed.
|
||||
* @param view The WebView requesting the login.
|
||||
* @param realm The account realm used to look up accounts.
|
||||
* @param account An optional account. If not null, the account should be
|
||||
* checked against accounts on the device. If it is a valid
|
||||
* account, it should be used to log in the user.
|
||||
* @param args Authenticator specific arguments used to log in the user.
|
||||
*/
|
||||
public void onReceivedLoginRequest(WebView view, String realm,
|
||||
String account, String args) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user