summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 22:28:21 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 22:28:21 +0000
commit9ec206e8b676533228ec2edb51273c4715fc8d31 (patch)
treebf41535995c92ba0c07c532d9fcf19a4719af6ab /chrome
parent4e4015e8c9448ee352589bafd0356ff7a4514d91 (diff)
downloadchromium_src-9ec206e8b676533228ec2edb51273c4715fc8d31.zip
chromium_src-9ec206e8b676533228ec2edb51273c4715fc8d31.tar.gz
chromium_src-9ec206e8b676533228ec2edb51273c4715fc8d31.tar.bz2
Bookmark manager: Tweak the top bar behavior a bit.
Empty searches are not shown now, instead we go to "Bookmarks bar" folder. Clicking the logo button clears the search and takes the user to the "Bookmarks bar" folder. BUG=None TEST=See above Review URL: http://codereview.chromium.org/1816001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45995 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/resources/bookmark_manager/main.html31
1 files changed, 18 insertions, 13 deletions
diff --git a/chrome/browser/resources/bookmark_manager/main.html b/chrome/browser/resources/bookmark_manager/main.html
index e3da891..97b7326 100644
--- a/chrome/browser/resources/bookmark_manager/main.html
+++ b/chrome/browser/resources/bookmark_manager/main.html
@@ -39,7 +39,6 @@ found in the LICENSE file.
<script src="chrome://resources/js/localstrings.js"></script>
<script src="chrome://resources/js/i18ntemplate.js"></script>
-
<script src="js/bmm/treeiterator.js"></script>
<script src="js/bmm.js"></script>
<script src="js/bmm/bookmarklist.js"></script>
@@ -60,7 +59,7 @@ if (cr.isMac)
<body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
<div class="header">
- <button onclick="resetSearch()" class="logo" tabindex=3></button>
+ <button class="logo" tabindex=3></button>
<form onsubmit="setSearch(this.term.value); return false;"
class="form">
<input type="search" id="term" tabindex=1 autofocus
@@ -270,28 +269,34 @@ $('term').oninput = function(e) {
* @para {string} searchText The text to search for.
*/
function setSearch(searchText) {
- delete bmm.treeLookup[searchTreeItem.bookmarkId];
- var id = searchTreeItem.bookmarkId = 'q=' + searchText;
- bmm.treeLookup[searchTreeItem.bookmarkId] = searchTreeItem;
+ if (searchText) {
+ // Only update search item if we have a search term. We never want the
+ // search item to be for an empty search.
+ delete bmm.treeLookup[searchTreeItem.bookmarkId];
+ var id = searchTreeItem.bookmarkId = 'q=' + searchText;
+ bmm.treeLookup[searchTreeItem.bookmarkId] = searchTreeItem;
+ }
+
$('term').value = searchText;
+
if (searchText) {
tree.add(searchTreeItem);
tree.selectedItem = searchTreeItem;
} else {
- tree.remove(searchTreeItem);
+ // Go "home".
tree.selectedItem = tree.items[0];
+ id = tree.selectedItem.bookmarkId;
}
+
navigateTo(id);
}
-/**
- * Clears the search.
- */
-function resetSearch() {
- $('term').value = '';
+// Handle the logo button UI.
+// When the user clicks the button we should navigate "home" and focus the list
+document.querySelector('button.logo').onclick = function(e) {
setSearch('');
- $('term').focus();
-}
+ $('list').focus();
+};
/**
* Called when the title of a bookmark changes.