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

Unified Diff: ios/chrome/browser/reading_list/reading_list_model_factory.cc

Issue 2667213002: Get ModelTypeStoreFactory for reading list from ProfileSyncService (Closed)
Patch Set: Created 3 years, 11 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 | « ios/chrome/browser/reading_list/BUILD.gn ('k') | ios/chrome/browser/sync/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/reading_list/reading_list_model_factory.cc
diff --git a/ios/chrome/browser/reading_list/reading_list_model_factory.cc b/ios/chrome/browser/reading_list/reading_list_model_factory.cc
index b6e2c0c82e63142d3cc462c111c7b7b528561512..e396d611e6c026f5e81d63dbaf8f9eb7fbfdb3f3 100644
--- a/ios/chrome/browser/reading_list/reading_list_model_factory.cc
+++ b/ios/chrome/browser/reading_list/reading_list_model_factory.cc
@@ -9,6 +9,7 @@
#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
+#include "components/browser_sync/profile_sync_service.h"
#include "components/keyed_service/ios/browser_state_dependency_manager.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/reading_list/core/reading_list_switches.h"
@@ -19,6 +20,7 @@
#include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/experimental_flags.h"
+#include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
#include "ios/chrome/common/channel_info.h"
#include "ios/web/public/web_thread.h"
@@ -62,23 +64,18 @@ void ReadingListModelFactory::RegisterBrowserStatePrefs(
std::unique_ptr<KeyedService> ReadingListModelFactory::BuildServiceInstanceFor(
web::BrowserState* context) const {
- scoped_refptr<base::SequencedTaskRunner> background_task_runner =
- web::WebThread::GetBlockingPool()->GetSequencedTaskRunner(
- web::WebThread::GetBlockingPool()->GetSequenceToken());
-
- base::FilePath database_dir(
- context->GetStatePath().Append(FILE_PATH_LITERAL("readinglist")));
+ ios::ChromeBrowserState* chrome_browser_state =
+ ios::ChromeBrowserState::FromBrowserState(context);
+ browser_sync::ProfileSyncService* profile_sync_service =
+ IOSChromeProfileSyncServiceFactory::GetForBrowserState(
+ chrome_browser_state);
- // TODO(crbug.com/664920): use a shared location for the store.
std::unique_ptr<ReadingListStore> store = base::MakeUnique<ReadingListStore>(
- base::Bind(&syncer::ModelTypeStore::CreateStore, syncer::READING_LIST,
- database_dir.AsUTF8Unsafe(), background_task_runner),
+ profile_sync_service->GetModelTypeStoreFactory(syncer::READING_LIST),
base::Bind(&syncer::ModelTypeChangeProcessor::Create,
base::BindRepeating(&syncer::ReportUnrecoverableError,
GetChannel())));
- ios::ChromeBrowserState* chrome_browser_state =
- ios::ChromeBrowserState::FromBrowserState(context);
std::unique_ptr<KeyedService> reading_list_model =
base::MakeUnique<ReadingListModelImpl>(std::move(store),
chrome_browser_state->GetPrefs());
« no previous file with comments | « ios/chrome/browser/reading_list/BUILD.gn ('k') | ios/chrome/browser/sync/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698