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

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: 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/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..7f3997684546a49305801a7c17ccde57cb22a742 100644
--- a/chrome/browser/ui/webui/snippets_internals_message_handler.h
+++ b/chrome/browser/ui/webui/snippets_internals_message_handler.h
@@ -5,9 +5,12 @@
#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/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "components/ntp_snippets/category.h"
#include "components/ntp_snippets/category_status.h"
@@ -28,6 +31,8 @@ class SnippetsInternalsMessageHandler
~SnippetsInternalsMessageHandler() override;
private:
+ enum class DismissedState { HIDDEN, LOADING, VISIBLE };
+
// content::WebUIMessageHandler:
void RegisterMessages() override;
@@ -44,6 +49,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 +57,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 +71,17 @@ 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_;
+
+ base::WeakPtrFactory<SnippetsInternalsMessageHandler> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SnippetsInternalsMessageHandler);
};
« no previous file with comments | « chrome/browser/resources/snippets_internals.js ('k') | chrome/browser/ui/webui/snippets_internals_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698