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

Unified Diff: chrome/browser/ntp_snippets/ntp_snippets_service_factory.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: . 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 | « no previous file | components/components_tests.gyp » ('j') | components/ntp_snippets.gypi » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
diff --git a/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc b/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
index 17dbfc27177760cb259731f356b7922c19a899d0..36104bb435feb751e8f15ad49e47791d7b3a7965 100644
--- a/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
+++ b/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ntp_snippets/ntp_snippets_service_factory.h"
+#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
#include "chrome/browser/browser_process.h"
@@ -17,6 +18,7 @@
#include "components/browser_sync/browser/profile_sync_service.h"
#include "components/image_fetcher/image_fetcher.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "components/ntp_snippets/ntp_snippets_database.h"
#include "components/ntp_snippets/ntp_snippets_fetcher.h"
#include "components/ntp_snippets/ntp_snippets_scheduler.h"
#include "components/ntp_snippets/ntp_snippets_service.h"
@@ -83,6 +85,8 @@ KeyedService* NTPSnippetsServiceFactory::BuildServiceInstanceFor(
scheduler = NTPSnippetsLauncher::Get();
#endif // OS_ANDROID
+ base::FilePath database_dir(
+ profile->GetPath().Append(FILE_PATH_LITERAL("NTPSnippets")));
scoped_refptr<base::SequencedTaskRunner> task_runner =
BrowserThread::GetBlockingPool()
->GetSequencedTaskRunnerWithShutdownBehavior(
@@ -90,11 +94,13 @@ KeyedService* NTPSnippetsServiceFactory::BuildServiceInstanceFor(
base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
return new ntp_snippets::NTPSnippetsService(
- profile->GetPrefs(), sync_service, suggestions_service, task_runner,
+ profile->GetPrefs(), sync_service, suggestions_service,
g_browser_process->GetApplicationLocale(), scheduler,
base::WrapUnique(new ntp_snippets::NTPSnippetsFetcher(
signin_manager, token_service, request_context,
base::Bind(&safe_json::SafeJsonParser::Parse),
chrome::GetChannel() == version_info::Channel::STABLE)),
- base::WrapUnique(new ImageFetcherImpl(request_context.get())));
+ base::WrapUnique(new ImageFetcherImpl(request_context.get())),
+ base::WrapUnique(
+ new ntp_snippets::NTPSnippetsDatabase(database_dir, task_runner)));
}
« no previous file with comments | « no previous file | components/components_tests.gyp » ('j') | components/ntp_snippets.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698