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 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_FACTORY_H_ |
6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_FACTORY_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" | 10 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 template <typename T> | 13 template <typename T> |
14 struct DefaultSingletonTraits; | 14 struct DefaultSingletonTraits; |
15 } // namespace base | 15 } // namespace base |
16 | 16 |
17 class ReadingListModel; | 17 class ReadingListModel; |
| 18 class ReadingListStore; |
18 | 19 |
19 namespace ios { | 20 namespace ios { |
20 class ChromeBrowserState; | 21 class ChromeBrowserState; |
21 } | 22 } |
22 | 23 |
23 // Singleton that owns the ReadingListModel and associates it with | 24 // Singleton that owns the ReadingListModel and associates it with |
24 // ios::ChromeBrowserState. | 25 // ios::ChromeBrowserState. |
25 class ReadingListModelFactory : public BrowserStateKeyedServiceFactory { | 26 class ReadingListModelFactory : public BrowserStateKeyedServiceFactory { |
26 public: | 27 public: |
27 static ReadingListModel* GetForBrowserState( | 28 static ReadingListModel* GetForBrowserState( |
28 ios::ChromeBrowserState* browser_state); | 29 ios::ChromeBrowserState* browser_state); |
29 static ReadingListModel* GetForBrowserStateIfExists( | 30 static ReadingListModel* GetForBrowserStateIfExists( |
30 ios::ChromeBrowserState* browser_state); | 31 ios::ChromeBrowserState* browser_state); |
31 static ReadingListModelFactory* GetInstance(); | 32 static ReadingListModelFactory* GetInstance(); |
| 33 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
32 | 34 |
33 private: | 35 private: |
34 friend struct base::DefaultSingletonTraits<ReadingListModelFactory>; | 36 friend struct base::DefaultSingletonTraits<ReadingListModelFactory>; |
35 | 37 |
36 ReadingListModelFactory(); | 38 ReadingListModelFactory(); |
37 ~ReadingListModelFactory() override; | 39 ~ReadingListModelFactory() override; |
38 | 40 |
39 // BrowserStateKeyedServiceFactory implementation. | 41 // BrowserStateKeyedServiceFactory implementation. |
40 std::unique_ptr<KeyedService> BuildServiceInstanceFor( | 42 std::unique_ptr<KeyedService> BuildServiceInstanceFor( |
41 web::BrowserState* context) const override; | 43 web::BrowserState* context) const override; |
42 web::BrowserState* GetBrowserStateToUse( | 44 web::BrowserState* GetBrowserStateToUse( |
43 web::BrowserState* context) const override; | 45 web::BrowserState* context) const override; |
44 | 46 |
45 DISALLOW_COPY_AND_ASSIGN(ReadingListModelFactory); | 47 DISALLOW_COPY_AND_ASSIGN(ReadingListModelFactory); |
46 }; | 48 }; |
47 | 49 |
48 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_FACTORY_H_ | 50 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_FACTORY_H_ |
OLD | NEW |