summaryrefslogtreecommitdiff
path: root/src/com/android/browser/Controller.java
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-11-16 11:58:21 +0000
committerBen Murdoch <benm@google.com>2010-11-23 12:14:30 +0000
commit8029a777106fa6fb911ee1d58402b0de768a583a (patch)
tree9bad7ba26817f4fa97271ad544f8f7fa09fc0e90 /src/com/android/browser/Controller.java
parent1514bb7ed5656316a8dac966cee21653f3c59aff (diff)
Invite the user to set up AutoFill
If the user has not set up an AutoFill profile but has the feature enabled and they start to fill out a form that we have determined as "autofillable" then offer to take them to the profile editor to set up their profile. Change-Id: Ia44c7036ef616d4ea826e541471dd916262488f2
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r--src/com/android/browser/Controller.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index e0b15b43..41e73564 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -47,6 +47,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
+import android.preference.PreferenceActivity;
import android.provider.Browser;
import android.provider.BrowserContract;
import android.provider.BrowserContract.History;
@@ -114,6 +115,8 @@ public class Controller
// activity requestCode
final static int PREFERENCES_PAGE = 3;
final static int FILE_SELECTED = 4;
+ final static int AUTOFILL_SETUP = 5;
+
private final static int WAKELOCK_TIMEOUT = 5 * 60 * 1000; // 5 minutes
// As the ids are dynamically created, we can't guarantee that they will
@@ -143,6 +146,8 @@ public class Controller
private PageDialogsHandler mPageDialogsHandler;
private NetworkStateHandler mNetworkHandler;
+ private Message mAutoFillSetupMessage;
+
private boolean mShouldShowErrorConsole;
private SystemAllowGeolocationOrigins mSystemAllowGeolocationOrigins;
@@ -1050,6 +1055,15 @@ public class Controller
mUploadHandler.onResult(resultCode, intent);
mUploadHandler = null;
break;
+ case AUTOFILL_SETUP:
+ // Determine whether a profile was actually set up or not
+ // and if so, send the message back to the WebTextView to
+ // fill the form with the new profile.
+ if (getSettings().getAutoFillProfile() != null) {
+ mAutoFillSetupMessage.sendToTarget();
+ mAutoFillSetupMessage = null;
+ }
+ break;
default:
break;
}
@@ -2409,4 +2423,14 @@ public class Controller
return mMenuIsDown;
}
+ public void setupAutoFill(Message message) {
+ // Open the settings activity at the AutoFill profile fragment so that
+ // the user can create a new profile. When they return, we will dispatch
+ // the message so that we can autofill the form using their new profile.
+ Intent intent = new Intent(mActivity, BrowserPreferencesPage.class);
+ intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
+ AutoFillSettingsFragment.class.getName());
+ mAutoFillSetupMessage = message;
+ mActivity.startActivityForResult(intent, AUTOFILL_SETUP);
+ }
}