Limit the touch area for opening search to the right edge of the textfield.

Now all single taps to the title bar will result in either
a search or opening the bookmarks picker, depending on whether
they were past the right edge of the textfield.

Fixes http://b/issue?id=2113429

Also move the lock icon in between the favicon and the url.  See
http://b/issue?id=2085847

Change-Id: I30447aa7517b6fc801d3cf34eff233db3a4ce635
diff --git a/src/com/android/browser/TitleBarSet.java b/src/com/android/browser/TitleBarSet.java
index 9cfce86..ba6c23a 100644
--- a/src/com/android/browser/TitleBarSet.java
+++ b/src/com/android/browser/TitleBarSet.java
@@ -177,6 +177,18 @@
         if (titleBar != getTitleBarAt(position)) {
             return false;
         }
+        View textfield = titleBar.findViewById(R.id.title);
+        // Interpret all touches past the right edge of the search field as
+        // a touch on the icon on the right.
+        if ((int) mLastTouchUp.getX() > textfield.getRight()) {
+            WebView webView = titleBar.getWebView();
+            if (webView != null && webView.getProgress() < 100) {
+                webView.stopLoading();
+            } else {
+                mBrowserActivity.bookmarksOrHistoryPicker(false);
+            }
+            return true;
+        }
         mBrowserActivity.onSearchRequested();
         return true;
     }