Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: chrome/browser/resources/options/cookies_view.js

Issue 5685008: Cookies tree js code touch up. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address arv's comments Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/cookies_view.js
diff --git a/chrome/browser/resources/options/cookies_view.js b/chrome/browser/resources/options/cookies_view.js
index 93d2967aa0c199ec340b33936e97f141b1bea75c..0f51fcb0b73d4a347b88d6adcec5383b82d84b51 100644
--- a/chrome/browser/resources/options/cookies_view.js
+++ b/chrome/browser/resources/options/cookies_view.js
@@ -32,7 +32,7 @@ cr.define('options', function() {
options.CookiesTree.decorate(cookiesTree);
cookiesTree.addEventListener('change',
this.handleCookieTreeChange_.bind(this));
- cookiesTree.addEventListener('keydown', this.handleKeyDown_);
+ cookiesTree.addEventListener('keydown', this.handleKeyDown_.bind(this));
$('cookiesSearchBox').addEventListener('keydown',
this.handleQueryEditKeyDown_.bind(this));
@@ -44,8 +44,7 @@ cr.define('options', function() {
}
$('remove-cookie').onclick = function(e) {
- var selected = cookiesTree.selectedItem;
- chrome.send('removeCookie', [selected.pathId]);
+ self.removeSelectedCookie_();
}
$('remove-all-cookie').onclick = function(e) {
@@ -234,6 +233,16 @@ cr.define('options', function() {
},
/**
+ * Remove currently selected cookie.
+ * @private
+ */
+ removeSelectedCookie_: function() {
+ var selected = cookiesTree.selectedItem;
+ if (selected)
+ chrome.send('removeCookie', [selected.pathId]);
+ },
+
+ /**
* Handler for keydown event.
* @private
* @param {Event} e KeyDown event.
@@ -244,9 +253,11 @@ cr.define('options', function() {
if (!$('remove-cookie').disabled &&
(e.keyIdentifier == 'U+007F' ||
(cr.isMac && e.keyIdentifier == 'U+0008'))) {
+ // No further key handling to avoid navigation triggered by 'Backspace'
+ // on Mac.
e.preventDefault();
- e.stopPropagation();
- cr.dispatchSimpleEvent($('remove-cookie'), 'click');
+
+ this.removeSelectedCookie_();
}
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698