Merge "Delete bookmarks when sync account is removed"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 7dab8b0..c76cb92 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -103,6 +103,13 @@
                 <data android:scheme="file" />
                 <data android:mimeType="application/x-webarchive-xml"/>
             </intent-filter>
+            <!-- Accept inbound NFC URLs at a low priority -->
+            <intent-filter android:priority="-101">
+                <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:scheme="http" />
+                <data android:scheme="https" />
+            </intent-filter>
             <!-- We are also the main entry point of the browser. -->
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
diff --git a/res/layout-port/autofill_settings_fragment.xml b/res/layout-port/autofill_settings_fragment.xml
new file mode 100644
index 0000000..63dba4d
--- /dev/null
+++ b/res/layout-port/autofill_settings_fragment.xml
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="0px"
+        android:layout_weight="1">
+
+        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical">
+
+            <View
+                android:layout_height="10dip"
+                android:layout_width="match_parent" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_heading" />
+
+            <View
+                android:layout_height="12dip"
+                android:layout_width="match_parent" />
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_name" />
+            <EditText android:id="@+id/autofill_profile_editor_name_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:inputType="textPersonName|textCapWords"
+                android:singleLine="true" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_company_name" />
+            <EditText android:id="@+id/autofill_profile_editor_company_name_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:inputType="textCapWords"
+                android:singleLine="true" />
+            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_margin="2dip"
+                android:orientation="vertical">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="center_vertical"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:text="@string/autofill_profile_editor_address_line_1" />
+                 <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="center_vertical"
+                    android:textAppearance="?android:attr/textAppearanceSmall"
+                    android:text="@string/autofill_profile_editor_address_line_1_hint" />
+            </LinearLayout>
+            <EditText android:id="@+id/autofill_profile_editor_address_line_1_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:inputType="textCapWords"
+                android:singleLine="true" />
+            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_margin="2dip"
+                android:orientation="vertical">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="center_vertical"
+                    android:textAppearance="?android:attr/textAppearanceMedium"
+                    android:text="@string/autofill_profile_editor_address_line_2" />
+                 <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="center_vertical"
+                    android:textAppearance="?android:attr/textAppearanceSmall"
+                    android:text="@string/autofill_profile_editor_address_line_2_hint" />
+            </LinearLayout>
+            <EditText android:id="@+id/autofill_profile_editor_address_line_2_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="bottom"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:inputType="textCapWords"
+                android:singleLine="true" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_city" />
+            <EditText android:id="@+id/autofill_profile_editor_city_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:inputType="textCapWords"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:singleLine="true" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_state" />
+            <EditText android:id="@+id/autofill_profile_editor_state_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:inputType="textCapWords"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:singleLine="true" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_zip_code" />
+            <EditText android:id="@+id/autofill_profile_editor_zip_code_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:inputType="textCapCharacters"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:singleLine="true" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_country" />
+            <EditText android:id="@+id/autofill_profile_editor_country_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:inputType="textCapWords"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:singleLine="true" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_phone_number" />
+            <EditText android:id="@+id/autofill_profile_editor_phone_number_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:singleLine="true"
+                android:phoneNumber="true" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_email_address" />
+            <EditText android:id="@+id/autofill_profile_editor_email_address_edit"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:layout_margin="2dip"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:inputType="textEmailAddress"
+                android:singleLine="true" />
+        </LinearLayout>
+    </ScrollView>
+
+    <View
+        android:layout_height="12dip"
+        android:layout_width="match_parent" />
+
+    <Button
+        android:id="@+id/autofill_profile_editor_save_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/autofill_profile_editor_save_profile"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+</LinearLayout>
diff --git a/res/layout/autofill_settings_fragment.xml b/res/layout/autofill_settings_fragment.xml
index b92c149..8c90dd7 100644
--- a/res/layout/autofill_settings_fragment.xml
+++ b/res/layout/autofill_settings_fragment.xml
@@ -13,256 +13,246 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:orientation="vertical">
 
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical">
-
-        <View
-            android:layout_height="10dip"
-            android:layout_width="match_parent" />
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:text="@string/autofill_profile_editor_heading" />
-
-        <View
-            android:layout_height="12dip"
-            android:layout_width="match_parent" />
-
-        <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:shrinkColumns="1"
-            android:stretchColumns="1">
-            <TableRow>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:text="@string/autofill_profile_editor_name" />
-                <EditText android:id="@+id/autofill_profile_editor_name_edit"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:inputType="textPersonName|textCapWords"
-                    android:singleLine="true" />
-            </TableRow>
-            <TableRow>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:text="@string/autofill_profile_editor_company_name" />
-                <EditText android:id="@+id/autofill_profile_editor_company_name_edit"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:inputType="textCapWords"
-                    android:singleLine="true" />
-            </TableRow>
-            <TableRow>
-                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_margin="2dip"
-                    android:orientation="vertical">
-                    <TextView
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:gravity="center_vertical"
-                        android:textAppearance="?android:attr/textAppearanceMedium"
-                        android:text="@string/autofill_profile_editor_address_line_1" />
-                     <TextView
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:gravity="center_vertical"
-                        android:textAppearance="?android:attr/textAppearanceSmall"
-                        android:text="@string/autofill_profile_editor_address_line_1_hint" />
-                </LinearLayout>
-                <EditText android:id="@+id/autofill_profile_editor_address_line_1_edit"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:inputType="textCapWords"
-                    android:singleLine="true" />
-            </TableRow>
-            <TableRow>
-                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_margin="2dip"
-                    android:orientation="vertical">
-                    <TextView
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:gravity="center_vertical"
-                        android:textAppearance="?android:attr/textAppearanceMedium"
-                        android:text="@string/autofill_profile_editor_address_line_2" />
-                     <TextView
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:gravity="center_vertical"
-                        android:textAppearance="?android:attr/textAppearanceSmall"
-                        android:text="@string/autofill_profile_editor_address_line_2_hint" />
-                </LinearLayout>
-                <EditText android:id="@+id/autofill_profile_editor_address_line_2_edit"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="bottom"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:inputType="textCapWords"
-                    android:singleLine="true" />
-            </TableRow>
-            <TableRow>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:text="@string/autofill_profile_editor_city" />
-                <EditText android:id="@+id/autofill_profile_editor_city_edit"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:inputType="textCapWords"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:singleLine="true" />
-            </TableRow>
-            <TableRow>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:text="@string/autofill_profile_editor_state" />
-                <EditText android:id="@+id/autofill_profile_editor_state_edit"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:inputType="textCapWords"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:singleLine="true" />
-            </TableRow>
-            <TableRow>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:text="@string/autofill_profile_editor_zip_code" />
-                <EditText android:id="@+id/autofill_profile_editor_zip_code_edit"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:inputType="textCapCharacters"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:singleLine="true" />
-            </TableRow>
-            <TableRow>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:text="@string/autofill_profile_editor_country" />
-                <EditText android:id="@+id/autofill_profile_editor_country_edit"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:inputType="textCapWords"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:singleLine="true" />
-            </TableRow>
-            <TableRow>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:text="@string/autofill_profile_editor_phone_number" />
-                <EditText android:id="@+id/autofill_profile_editor_phone_number_edit"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:singleLine="true"
-                    android:phoneNumber="true" />
-            </TableRow>
-            <TableRow>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:text="@string/autofill_profile_editor_email_address" />
-                <EditText android:id="@+id/autofill_profile_editor_email_address_edit"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:gravity="center_vertical"
-                    android:layout_margin="2dip"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:inputType="textEmailAddress"
-                    android:singleLine="true" />
-            </TableRow>
-        </TableLayout>
-
-        <View
-            android:layout_height="12dip"
-            android:layout_width="match_parent" />
+        android:layout_height="0px"
+        android:layout_weight="1">
 
         <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:gravity="center">
-            <Button
-                android:id="@+id/autofill_profile_editor_save_button"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/autofill_profile_editor_save_profile"
-                android:textAppearance="?android:attr/textAppearanceMedium" />
+            android:layout_height="match_parent"
+            android:orientation="vertical">
 
-            <Button
-                android:id="@+id/autofill_profile_editor_cancel_button"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/cancel"
-                android:textAppearance="?android:attr/textAppearanceMedium" />
+            <View
+                android:layout_height="10dip"
+                android:layout_width="match_parent" />
 
-            <Button
-                android:id="@+id/autofill_profile_editor_delete_button"
+            <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="@string/autofill_profile_editor_delete_profile"
-                android:textAppearance="?android:attr/textAppearanceMedium" />
-        </LinearLayout>
-    </LinearLayout>
-</ScrollView>
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:text="@string/autofill_profile_editor_heading" />
+
+            <View
+                android:layout_height="12dip"
+                android:layout_width="match_parent" />
+
+            <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:shrinkColumns="1"
+                android:stretchColumns="1">
+                <TableRow>
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:text="@string/autofill_profile_editor_name" />
+                    <EditText android:id="@+id/autofill_profile_editor_name_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:inputType="textPersonName|textCapWords"
+                        android:singleLine="true" />
+                </TableRow>
+                <TableRow>
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:text="@string/autofill_profile_editor_company_name" />
+                    <EditText android:id="@+id/autofill_profile_editor_company_name_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:inputType="textCapWords"
+                        android:singleLine="true" />
+                </TableRow>
+                <TableRow>
+                    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_margin="2dip"
+                        android:orientation="vertical">
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:gravity="center_vertical"
+                            android:textAppearance="?android:attr/textAppearanceMedium"
+                            android:text="@string/autofill_profile_editor_address_line_1" />
+                         <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:gravity="center_vertical"
+                            android:textAppearance="?android:attr/textAppearanceSmall"
+                            android:text="@string/autofill_profile_editor_address_line_1_hint" />
+                    </LinearLayout>
+                    <EditText android:id="@+id/autofill_profile_editor_address_line_1_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:inputType="textCapWords"
+                        android:singleLine="true" />
+                </TableRow>
+                <TableRow>
+                    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_margin="2dip"
+                        android:orientation="vertical">
+                        <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:gravity="center_vertical"
+                            android:textAppearance="?android:attr/textAppearanceMedium"
+                            android:text="@string/autofill_profile_editor_address_line_2" />
+                         <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:gravity="center_vertical"
+                            android:textAppearance="?android:attr/textAppearanceSmall"
+                            android:text="@string/autofill_profile_editor_address_line_2_hint" />
+                    </LinearLayout>
+                    <EditText android:id="@+id/autofill_profile_editor_address_line_2_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="bottom"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:inputType="textCapWords"
+                        android:singleLine="true" />
+                </TableRow>
+                <TableRow>
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:text="@string/autofill_profile_editor_city" />
+                    <EditText android:id="@+id/autofill_profile_editor_city_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:inputType="textCapWords"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:singleLine="true" />
+                </TableRow>
+                <TableRow>
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:text="@string/autofill_profile_editor_state" />
+                    <EditText android:id="@+id/autofill_profile_editor_state_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:inputType="textCapWords"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:singleLine="true" />
+                </TableRow>
+                <TableRow>
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:text="@string/autofill_profile_editor_zip_code" />
+                    <EditText android:id="@+id/autofill_profile_editor_zip_code_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:inputType="textCapCharacters"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:singleLine="true" />
+                </TableRow>
+                <TableRow>
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:text="@string/autofill_profile_editor_country" />
+                    <EditText android:id="@+id/autofill_profile_editor_country_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:inputType="textCapWords"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:singleLine="true" />
+                </TableRow>
+                <TableRow>
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:text="@string/autofill_profile_editor_phone_number" />
+                    <EditText android:id="@+id/autofill_profile_editor_phone_number_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:singleLine="true"
+                        android:phoneNumber="true" />
+                </TableRow>
+                <TableRow>
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:text="@string/autofill_profile_editor_email_address" />
+                    <EditText android:id="@+id/autofill_profile_editor_email_address_edit"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:gravity="center_vertical"
+                        android:layout_margin="2dip"
+                        android:textAppearance="?android:attr/textAppearanceMedium"
+                        android:inputType="textEmailAddress"
+                        android:singleLine="true" />
+                </TableRow>
+            </TableLayout>
+       </LinearLayout>
+    </ScrollView>
+
+    <View
+        android:layout_height="12dip"
+        android:layout_width="match_parent" />
+
+    <Button
+        android:id="@+id/autofill_profile_editor_save_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/autofill_profile_editor_save_profile"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+</LinearLayout>
+
diff --git a/res/menu/autofill_profile_editor.xml b/res/menu/autofill_profile_editor.xml
new file mode 100644
index 0000000..4e746e5
--- /dev/null
+++ b/res/menu/autofill_profile_editor.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/autofill_profile_editor_delete_profile_menu_id"
+        android:title="@string/autofill_profile_editor_delete_profile"
+        android:icon="@android:drawable/ic_menu_delete"
+        android:showAsAction="ifRoom|withText" />
+</menu>
diff --git a/src/com/android/browser/AutoFillSettingsFragment.java b/src/com/android/browser/AutoFillSettingsFragment.java
index e87645e..b282789 100644
--- a/src/com/android/browser/AutoFillSettingsFragment.java
+++ b/src/com/android/browser/AutoFillSettingsFragment.java
@@ -28,6 +28,9 @@
 import android.view.ViewGroup;
 import android.view.View.OnClickListener;
 import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
 import android.view.inputmethod.InputMethodManager;
 import android.webkit.WebSettings.AutoFillProfile;
 import android.widget.Button;
@@ -131,10 +134,41 @@
     @Override
     public void onCreate(Bundle savedState) {
         super.onCreate(savedState);
+        setHasOptionsMenu(true);
         mSettings = BrowserSettings.getInstance();
     }
 
     @Override
+    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        inflater.inflate(R.menu.autofill_profile_editor, menu);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == R.id.autofill_profile_editor_delete_profile_menu_id) {
+            // Clear the UI.
+            mFullNameEdit.setText("");
+            mEmailEdit.setText("");
+            mCompanyEdit.setText("");
+            mAddressLine1Edit.setText("");
+            mAddressLine2Edit.setText("");
+            mCityEdit.setText("");
+            mStateEdit.setText("");
+            mZipEdit.setText("");
+            mCountryEdit.setText("");
+            mPhoneEdit.setText("");
+
+            // Update browser settings and native with a null profile. This will
+            // trigger the current profile to get deleted from the DB.
+            mSettings.setAutoFillProfile(null,
+                    mHandler.obtainMessage(PROFILE_DELETED_MSG));
+            updateButtonState();
+            return true;
+        }
+        return false;
+    }
+
+    @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
         View v = inflater.inflate(R.layout.autofill_settings_fragment, container, false);
@@ -185,37 +219,6 @@
             }
         });
 
-        Button deleteButton = (Button)v.findViewById(R.id.autofill_profile_editor_delete_button);
-        deleteButton.setOnClickListener(new OnClickListener() {
-            public void onClick(View button) {
-                // Clear the UI.
-                mFullNameEdit.setText("");
-                mEmailEdit.setText("");
-                mCompanyEdit.setText("");
-                mAddressLine1Edit.setText("");
-                mAddressLine2Edit.setText("");
-                mCityEdit.setText("");
-                mStateEdit.setText("");
-                mZipEdit.setText("");
-                mCountryEdit.setText("");
-                mPhoneEdit.setText("");
-
-                // Update browser settings and native with a null profile. This will
-                // trigger the current profile to get deleted from the DB.
-                mSettings.setAutoFillProfile(null,
-                        mHandler.obtainMessage(PROFILE_DELETED_MSG));
-
-                updateButtonState();
-            }
-        });
-
-        Button cancelButton = (Button)v.findViewById(R.id.autofill_profile_editor_cancel_button);
-        cancelButton.setOnClickListener(new OnClickListener() {
-           public void onClick(View button) {
-               closeEditor();
-           }
-        });
-
         // Populate the text boxes with any pre existing AutoFill data.
         AutoFillProfile activeProfile = mSettings.getAutoFillProfile();
         if (activeProfile != null) {
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index 8d1b784..4a8fa22 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -27,6 +27,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.net.Uri;
+import android.nfc.NfcAdapter;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.provider.Browser;
@@ -95,6 +96,7 @@
         boolean activateVoiceSearch = RecognizerResultsIntent
                 .ACTION_VOICE_SEARCH_RESULTS.equals(action);
         if (Intent.ACTION_VIEW.equals(action)
+                || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)
                 || Intent.ACTION_SEARCH.equals(action)
                 || MediaStore.INTENT_ACTION_MEDIA_SEARCH.equals(action)
                 || Intent.ACTION_WEB_SEARCH.equals(action)
@@ -214,7 +216,8 @@
         if (intent != null
                 && (intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
             final String action = intent.getAction();
-            if (Intent.ACTION_VIEW.equals(action)) {
+            if (Intent.ACTION_VIEW.equals(action) ||
+                    NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
                 url = UrlUtils.smartUrlFilter(intent.getData());
                 if (url != null && url.startsWith("http")) {
                     final Bundle pairs = intent
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java
index 936f131..284d9bc 100644
--- a/src/com/android/browser/provider/BrowserProvider2.java
+++ b/src/com/android/browser/provider/BrowserProvider2.java
@@ -1281,16 +1281,21 @@
                     values.put(Bookmarks.DATE_MODIFIED, now);
                     values.put(Bookmarks.DIRTY, 1);
 
+                    boolean hasAccounts = values.containsKey(Bookmarks.ACCOUNT_TYPE)
+                            || values.containsKey(Bookmarks.ACCOUNT_NAME);
                     String accountType = values
                             .getAsString(Bookmarks.ACCOUNT_TYPE);
                     String accountName = values
                             .getAsString(Bookmarks.ACCOUNT_NAME);
                     boolean hasParent = values.containsKey(Bookmarks.PARENT);
-                    if (hasParent) {
+                    if (hasParent && hasAccounts) {
                         // Let's make sure it's valid
                         long parentId = values.getAsLong(Bookmarks.PARENT);
                         hasParent = isValidParent(
                                 accountType, accountName, parentId);
+                    } else if (hasParent && !hasAccounts) {
+                        long parentId = values.getAsLong(Bookmarks.PARENT);
+                        hasParent = setParentValues(parentId, values);
                     }
 
                     // If no parent is set default to the "Bookmarks Bar" folder
@@ -1378,12 +1383,11 @@
         }
     }
 
-    private boolean isValidParent(String accountType, String accountName,
-            long parentId) {
-        if (parentId <= 0) {
-            return false;
+    private String[] getAccountNameAndType(long id) {
+        if (id <= 0) {
+            return null;
         }
-        Uri uri = ContentUris.withAppendedId(Bookmarks.CONTENT_URI, parentId);
+        Uri uri = ContentUris.withAppendedId(Bookmarks.CONTENT_URI, id);
         Cursor c = query(uri,
                 new String[] { Bookmarks.ACCOUNT_NAME, Bookmarks.ACCOUNT_TYPE },
                 null, null, null);
@@ -1391,17 +1395,35 @@
             if (c.moveToFirst()) {
                 String parentName = c.getString(0);
                 String parentType = c.getString(1);
-                if (TextUtils.equals(accountName, parentName)
-                        && TextUtils.equals(accountType, parentType)) {
-                    return true;
-                }
+                return new String[] { parentName, parentType };
             }
-            return false;
+            return null;
         } finally {
             c.close();
         }
     }
 
+    private boolean setParentValues(long parentId, ContentValues values) {
+        String[] parent = getAccountNameAndType(parentId);
+        if (parent == null) {
+            return false;
+        }
+        values.put(Bookmarks.ACCOUNT_NAME, parent[0]);
+        values.put(Bookmarks.ACCOUNT_TYPE, parent[1]);
+        return true;
+    }
+
+    private boolean isValidParent(String accountType, String accountName,
+            long parentId) {
+        String[] parent = getAccountNameAndType(parentId);
+        if (parent != null
+                && TextUtils.equals(accountName, parent[0])
+                && TextUtils.equals(accountType, parent[1])) {
+            return true;
+        }
+        return false;
+    }
+
     private void filterSearchClient(String[] selectionArgs) {
         if (selectionArgs != null) {
             for (int i = 0; i < selectionArgs.length; i++) {