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

Unified Diff: chrome/browser/resources/snippets_internals.js

Issue 2260783002: Make GetDismissedSuggestionsForDebugging asynchronous (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace function pointer, use multiple if-continue Created 4 years, 4 months 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
Index: chrome/browser/resources/snippets_internals.js
diff --git a/chrome/browser/resources/snippets_internals.js b/chrome/browser/resources/snippets_internals.js
index 673c697fd5e2fa30e0b79631ab4eb76e14dfcd20..c1ecb6b4302e147bac689f470571566cca2d013e 100644
--- a/chrome/browser/resources/snippets_internals.js
+++ b/chrome/browser/resources/snippets_internals.js
@@ -68,6 +68,12 @@ cr.define('chrome.SnippetsInternals', function() {
for (var button of clearDismissedButtons) {
button.addEventListener('click', onClearDismissedButtonClicked);
}
+
+ var toggleDismissedButtons =
+ document.getElementsByClassName('toggle-dismissed-suggestions');
+ for (var button of toggleDismissedButtons) {
+ button.addEventListener('click', onToggleDismissedButtonClicked);
+ }
}
function onClearCachedButtonClicked(event) {
@@ -82,6 +88,15 @@ cr.define('chrome.SnippetsInternals', function() {
chrome.send('clearDismissedSuggestions', [id]);
}
+ function onToggleDismissedButtonClicked(event) {
+ event.preventDefault();
+ var id = parseInt(event.currentTarget.getAttribute('category-id'), 10);
+ var table = $('dismissed-suggestions-' + id);
+ table.classList.toggle('hidden');
+ chrome.send('toggleDismissedSuggestions',
+ [id, !table.classList.contains('hidden')]);
+ }
+
function receiveJson(json) {
var trimmed = json.trim();
var hasContent = (trimmed && trimmed != '{}');
« no previous file with comments | « chrome/browser/resources/snippets_internals.html ('k') | chrome/browser/ui/webui/snippets_internals_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698