summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 00:41:20 +0000
committerarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 00:41:20 +0000
commit956bb3f6af144d6da6784311556244bf6bd4595e (patch)
tree4ed064c8d307b2434847753690bcfe18c925cdaf
parent85dacd4319aa6cd40cf0dba9b0dde9d21728b266 (diff)
downloadchromium_src-956bb3f6af144d6da6784311556244bf6bd4595e.zip
chromium_src-956bb3f6af144d6da6784311556244bf6bd4595e.tar.gz
chromium_src-956bb3f6af144d6da6784311556244bf6bd4595e.tar.bz2
NNTP: Add a menu item that allows the user to restore all blacklisted
thumbnails BUG=15247 TEST=Blacklist (remove) a few thumbnails (hit the x on the thumbnail toolbar). Then go to the options menu and "Restore all removed thumbnails". The removed thumbnails should be back. Review URL: http://codereview.chromium.org/165107 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22704 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/new_new_tab.css7
-rw-r--r--chrome/browser/resources/new_new_tab.html16
-rw-r--r--chrome/browser/resources/new_new_tab.js50
3 files changed, 51 insertions, 22 deletions
diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css
index c46ce3c..01b93ad 100644
--- a/chrome/browser/resources/new_new_tab.css
+++ b/chrome/browser/resources/new_new_tab.css
@@ -420,7 +420,6 @@ html[dir='rtl'] .item {
border: 1px solid #999;
-webkit-box-shadow: 2px 2px 3px hsla(0, 0%, 0%, .3);
background-color: hsla(213, 0%, 100%, .95);
- width: 157px;
left: 0;
white-space: nowrap;
z-index: 2;
@@ -428,6 +427,12 @@ html[dir='rtl'] .item {
cursor: default;
}
+.window-menu > hr {
+ border: 0;
+ border-top: 1px solid rgb(153, 153, 153);
+ margin: 2px 0;
+}
+
/* Made to look like a tooltip using vista/win7 look and feel.
TODO(arv): Replace with -webkit-appearance once issue 17371 is fixed
*/
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html
index 3674b20..6012544 100644
--- a/chrome/browser/resources/new_new_tab.html
+++ b/chrome/browser/resources/new_new_tab.html
@@ -67,15 +67,19 @@ document.write('<link id="themecss" rel="stylesheet" ' +
i18n-values="title:pagedisplaytooltip"></div>
<div id="option-menu" class="window-menu">
- <div section="THUMB" show="true" i18n-content="showthumbnails"
+ <div command="show" section="THUMB" i18n-content="showthumbnails"
style="display:none"></div>
- <div section="THUMB" show="false" i18n-content="hidethumbnails"></div>
- <div section="LIST" show="true" i18n-content="showlist"></div>
- <div section="LIST" show="false" i18n-content="hidelist"
+ <div command="hide" section="THUMB" i18n-content="hidethumbnails"></div>
+ <div command="show" section="LIST" i18n-content="showlist"></div>
+ <div command="hide" section="LIST" i18n-content="hidelist"
style="display:none"></div>
- <div section="RECENT" show="true" i18n-content="showrecentlyclosedtabs"
+ <div command="show" section="RECENT" i18n-content="showrecentlyclosedtabs"
style="display:none"></div>
- <div section="RECENT" show="false" i18n-content="hiderecentlyclosedtabs"></div>
+ <div command="hide" section="RECENT"
+ i18n-content="hiderecentlyclosedtabs"></div>
+ <hr>
+ <div command="clear-all-blacklisted"
+ i18n-content="restorethumbnails"></div>
</div>
<div id="notification">
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index e1b649b..7ce28bd 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -748,11 +748,14 @@ function updateOptionMenu() {
var menuItems = $('option-menu').children;
for (var i = 0; i < menuItems.length; i++) {
var item = menuItems[i];
- var section = Section[item.getAttribute('section')];
- var show = item.getAttribute('show') == 'true';
- // Hide show items if already shown. Hide hide items if already hidden.
- var hideMenuItem = show == !!(shownSections & section);
- item.style.display = hideMenuItem ? 'none' : '';
+ var command = item.getAttribute('command');
+ if (command == 'show' || command == 'hide') {
+ var show = command == 'show';
+ var section = Section[item.getAttribute('section')];
+ // Hide show items if already shown. Hide hide items if already hidden.
+ var hideMenuItem = show == !!(shownSections & section);
+ item.style.display = hideMenuItem ? 'none' : '';
+ }
}
}
@@ -895,8 +898,12 @@ OptionMenu.prototype = {
handleMouseOver: function(e) {
var el = e.target;
- var index = Array.prototype.indexOf.call(this.menu.children, el);
- this.setSelectedIndex(index);
+ if (!el.hasAttribute('command')) {
+ this.setSelectedIndex(-1);
+ } else {
+ var index = Array.prototype.indexOf.call(this.menu.children, el);
+ this.setSelectedIndex(index);
+ }
},
handleMouseOut: function(e) {
@@ -925,7 +932,8 @@ OptionMenu.prototype = {
while (true) {
i = (i + m + len) % len;
item = children[i];
- if (item && item.style.display != 'none') {
+ if (item && item.hasAttribute('command') &&
+ item.style.display != 'none') {
break;
}
}
@@ -990,20 +998,32 @@ OptionMenu.prototype = {
},
executeItem: function(item) {
- var section = Section[item.getAttribute('section')];
- var show = item.getAttribute('show') == 'true';
- if (show) {
- showSection(section);
- } else {
- hideSection(section);
+ var command = item.getAttribute('command');
+ if (command in this.commands) {
+ this.commands[command].call(this, item);
}
this.hide();
- saveShownSections();
}
};
var optionMenu = new OptionMenu($('option-button'), $('option-menu'));
+optionMenu.commands = {
+ 'clear-all-blacklisted' : function() {
+ mostVisited.clearAllBlacklisted();
+ chrome.send('getMostVisited');
+ },
+ 'show': function(item) {
+ var section = Section[item.getAttribute('section')];
+ showSection(section);
+ saveShownSections();
+ },
+ 'hide': function(item) {
+ var section = Section[item.getAttribute('section')];
+ hideSection(section);
+ saveShownSections();
+ }
+};
$('most-visited').addEventListener('click', function(e) {
var target = e.target;