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

Unified Diff: chrome/browser/ui/webui/snippets_internals_message_handler.h

Issue 2260783002: Make GetDismissedSuggestionsForDebugging asynchronous (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/ui/webui/snippets_internals_message_handler.h
diff --git a/chrome/browser/ui/webui/snippets_internals_message_handler.h b/chrome/browser/ui/webui/snippets_internals_message_handler.h
index 7d8d635dded94fc21bb4d7103999509811ac4873..51941eff955dfc6fde7e9a341b4ea56d9ffbe86c 100644
--- a/chrome/browser/ui/webui/snippets_internals_message_handler.h
+++ b/chrome/browser/ui/webui/snippets_internals_message_handler.h
@@ -5,7 +5,9 @@
#ifndef CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_
+#include <map>
#include <string>
+#include <vector>
#include "base/macros.h"
#include "base/scoped_observer.h"
@@ -28,6 +30,8 @@ class SnippetsInternalsMessageHandler
~SnippetsInternalsMessageHandler() override;
private:
+ enum class DismissedState { HIDDEN, LOADING, VISIBLE };
+
// content::WebUIMessageHandler:
void RegisterMessages() override;
@@ -44,6 +48,7 @@ class SnippetsInternalsMessageHandler
void HandleDownload(const base::ListValue* args);
void HandleClearCachedSuggestions(const base::ListValue* args);
void HandleClearDismissedSuggestions(const base::ListValue* args);
+ void HandleToggleDismissedSuggestions(const base::ListValue* args);
void SendAllContent();
void SendHosts();
@@ -51,6 +56,10 @@ class SnippetsInternalsMessageHandler
void SendBoolean(const std::string& name, bool value);
void SendString(const std::string& name, const std::string& value);
+ void OnDismissedSuggestionsLoaded(
+ ntp_snippets::Category category,
+ std::vector<ntp_snippets::ContentSuggestion> dismissed_suggestions);
+
ScopedObserver<ntp_snippets::ContentSuggestionsService,
ntp_snippets::ContentSuggestionsService::Observer>
content_suggestions_service_observer_;
@@ -61,6 +70,15 @@ class SnippetsInternalsMessageHandler
ntp_snippets::NTPSnippetsService* ntp_snippets_service_;
ntp_snippets::ContentSuggestionsService* content_suggestions_service_;
+ std::map<ntp_snippets::Category,
+ DismissedState,
+ ntp_snippets::Category::CompareByID>
+ dismissed_state_;
+ std::map<ntp_snippets::Category,
+ std::vector<ntp_snippets::ContentSuggestion>,
+ ntp_snippets::Category::CompareByID>
+ dismissed_suggestions_;
Marc Treib 2016/08/19 10:07:51 Maybe make a struct that contains DismissedState a
Philipp Keck 2016/08/19 12:11:53 Not sure that would help readability (except if it
+
DISALLOW_COPY_AND_ASSIGN(SnippetsInternalsMessageHandler);
};

Powered by Google App Engine
This is Rietveld 408576698