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

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

Issue 1987333003: [NTP Snippets] Persist snippets in a LevelDB instead of prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test memleaks Created 4 years, 7 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
« no previous file with comments | « chrome/browser/ui/webui/snippets_internals_message_handler.h ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/snippets_internals_message_handler.cc
diff --git a/chrome/browser/ui/webui/snippets_internals_message_handler.cc b/chrome/browser/ui/webui/snippets_internals_message_handler.cc
index f1ec08fee69013b992630a5df247bb5b10a15a7f..be78905744bdf628d4d7a4547c87b1826a9356e3 100644
--- a/chrome/browser/ui/webui/snippets_internals_message_handler.cc
+++ b/chrome/browser/ui/webui/snippets_internals_message_handler.cc
@@ -13,19 +13,15 @@
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/i18n/time_formatting.h"
-#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/values.h"
#include "chrome/browser/android/chrome_feature_list.h"
#include "chrome/browser/ntp_snippets/ntp_snippets_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/ntp_snippets/ntp_snippet.h"
-#include "components/ntp_snippets/pref_names.h"
#include "components/ntp_snippets/switches.h"
-#include "components/prefs/pref_service.h"
#include "content/public/browser/web_ui.h"
namespace {
@@ -96,10 +92,6 @@ void SnippetsInternalsMessageHandler::RegisterMessages() {
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
- "dump", base::Bind(&SnippetsInternalsMessageHandler::HandleDump,
- base::Unretained(this)));
-
- web_ui()->RegisterMessageCallback(
"download", base::Bind(&SnippetsInternalsMessageHandler::HandleDownload,
base::Unretained(this)));
@@ -124,18 +116,6 @@ void SnippetsInternalsMessageHandler::HandleClear(const base::ListValue* args) {
ntp_snippets_service_->ClearSnippets();
}
-void SnippetsInternalsMessageHandler::HandleDump(const base::ListValue* args) {
- DCHECK_EQ(0u, args->GetSize());
-
- PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
-
- std::string json;
- base::JSONWriter::Write(
- *pref_service->GetList(ntp_snippets::prefs::kSnippets), &json);
-
- SendJson(json);
-}
-
void SnippetsInternalsMessageHandler::HandleClearDiscarded(
const base::ListValue* args) {
DCHECK_EQ(0u, args->GetSize());
@@ -238,12 +218,6 @@ void SnippetsInternalsMessageHandler::SendHosts() {
result);
}
-void SnippetsInternalsMessageHandler::SendJson(const std::string& json) {
- web_ui()->CallJavascriptFunction(
- "chrome.SnippetsInternals.receiveJsonToDownload",
- base::StringValue(json));
-}
-
void SnippetsInternalsMessageHandler::SendBoolean(const std::string& name,
bool value) {
SendString(name, value ? "True" : "False");
« no previous file with comments | « chrome/browser/ui/webui/snippets_internals_message_handler.h ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698