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

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: 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 | « no previous file | chrome/browser/resources/snippets_internals.js » ('j') | no next file with comments »
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 6ae606b8b7ee3d8182220ea5a61fc9561755a554..ad2873925e2ca2f58da33280535ffcfe276d3d32 100644
--- a/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
+++ b/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ntp_snippets/ntp_snippets_service_factory.h"
#include "base/feature_list.h"
+#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
#include "chrome/browser/browser_process.h"
@@ -19,6 +20,8 @@
#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_constants.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"
@@ -96,6 +99,8 @@ KeyedService* NTPSnippetsServiceFactory::BuildServiceInstanceFor(
scheduler = NTPSnippetsLauncher::Get();
#endif // OS_ANDROID
+ base::FilePath database_dir(
+ profile->GetPath().Append(ntp_snippets::kDatabaseFolder));
scoped_refptr<base::SequencedTaskRunner> task_runner =
BrowserThread::GetBlockingPool()
->GetSequencedTaskRunnerWithShutdownBehavior(
@@ -104,10 +109,12 @@ KeyedService* NTPSnippetsServiceFactory::BuildServiceInstanceFor(
return new ntp_snippets::NTPSnippetsService(
enabled, profile->GetPrefs(), sync_service, suggestions_service,
- task_runner, g_browser_process->GetApplicationLocale(), scheduler,
+ 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 | chrome/browser/resources/snippets_internals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698