OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 5 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 PrefRegistry::NO_REGISTRATION_FLAGS); | 56 PrefRegistry::NO_REGISTRATION_FLAGS); |
57 } | 57 } |
58 | 58 |
59 std::unique_ptr<KeyedService> ReadingListModelFactory::BuildServiceInstanceFor( | 59 std::unique_ptr<KeyedService> ReadingListModelFactory::BuildServiceInstanceFor( |
60 web::BrowserState* context) const { | 60 web::BrowserState* context) const { |
61 ios::ChromeBrowserState* chrome_browser_state = | 61 ios::ChromeBrowserState* chrome_browser_state = |
62 ios::ChromeBrowserState::FromBrowserState(context); | 62 ios::ChromeBrowserState::FromBrowserState(context); |
63 | 63 |
64 const syncer::ModelTypeStoreFactory& store_factory = | 64 const syncer::ModelTypeStoreFactory& store_factory = |
65 browser_sync::ProfileSyncService::GetModelTypeStoreFactory( | 65 browser_sync::ProfileSyncService::GetModelTypeStoreFactory( |
66 syncer::READING_LIST, chrome_browser_state->GetStatePath(), | 66 syncer::READING_LIST, chrome_browser_state->GetStatePath()); |
67 web::WebThread::GetBlockingPool()); | |
68 std::unique_ptr<ReadingListStore> store = base::MakeUnique<ReadingListStore>( | 67 std::unique_ptr<ReadingListStore> store = base::MakeUnique<ReadingListStore>( |
69 store_factory, | 68 store_factory, |
70 base::Bind(&syncer::ModelTypeChangeProcessor::Create, | 69 base::Bind(&syncer::ModelTypeChangeProcessor::Create, |
71 base::BindRepeating(&syncer::ReportUnrecoverableError, | 70 base::BindRepeating(&syncer::ReportUnrecoverableError, |
72 GetChannel()))); | 71 GetChannel()))); |
73 | 72 |
74 std::unique_ptr<KeyedService> reading_list_model = | 73 std::unique_ptr<KeyedService> reading_list_model = |
75 base::MakeUnique<ReadingListModelImpl>( | 74 base::MakeUnique<ReadingListModelImpl>( |
76 std::move(store), chrome_browser_state->GetPrefs(), | 75 std::move(store), chrome_browser_state->GetPrefs(), |
77 base::MakeUnique<base::DefaultClock>()); | 76 base::MakeUnique<base::DefaultClock>()); |
78 return reading_list_model; | 77 return reading_list_model; |
79 } | 78 } |
80 | 79 |
81 web::BrowserState* ReadingListModelFactory::GetBrowserStateToUse( | 80 web::BrowserState* ReadingListModelFactory::GetBrowserStateToUse( |
82 web::BrowserState* context) const { | 81 web::BrowserState* context) const { |
83 return GetBrowserStateRedirectedInIncognito(context); | 82 return GetBrowserStateRedirectedInIncognito(context); |
84 } | 83 } |
OLD | NEW |