OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SIGNIN_ACCOUNT_CONSISTENCY_SERVICE_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_SIGNIN_ACCOUNT_CONSISTENCY_SERVICE_FACTORY_H_ |
6 #define IOS_CHROME_BROWSER_SIGNIN_ACCOUNT_CONSISTENCY_SERVICE_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_SIGNIN_ACCOUNT_CONSISTENCY_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
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 template <typename T> | 13 template <typename T> |
13 struct DefaultSingletonTraits; | 14 struct DefaultSingletonTraits; |
| 15 } |
| 16 |
14 class AccountConsistencyService; | 17 class AccountConsistencyService; |
15 | 18 |
16 namespace ios { | 19 namespace ios { |
17 | 20 |
18 class ChromeBrowserState; | 21 class ChromeBrowserState; |
19 | 22 |
20 // Singleton that owns the AccountConsistencyService(s) and associates them with | 23 // Singleton that owns the AccountConsistencyService(s) and associates them with |
21 // browser states. | 24 // browser states. |
22 class AccountConsistencyServiceFactory | 25 class AccountConsistencyServiceFactory |
23 : public BrowserStateKeyedServiceFactory { | 26 : public BrowserStateKeyedServiceFactory { |
24 public: | 27 public: |
25 // Returns the instance of AccountConsistencyService associated with this | 28 // Returns the instance of AccountConsistencyService associated with this |
26 // browser state (creating one if none exists). Returns null if this browser | 29 // browser state (creating one if none exists). Returns null if this browser |
27 // state cannot have an AccountConsistencyService (for example, if it is | 30 // state cannot have an AccountConsistencyService (for example, if it is |
28 // incognito or if WKWebView is not enabled). | 31 // incognito or if WKWebView is not enabled). |
29 static AccountConsistencyService* GetForBrowserState( | 32 static AccountConsistencyService* GetForBrowserState( |
30 ios::ChromeBrowserState* browser_state); | 33 ios::ChromeBrowserState* browser_state); |
31 | 34 |
32 // Returns an instance of the factory singleton. | 35 // Returns an instance of the factory singleton. |
33 static AccountConsistencyServiceFactory* GetInstance(); | 36 static AccountConsistencyServiceFactory* GetInstance(); |
34 | 37 |
35 private: | 38 private: |
36 friend struct DefaultSingletonTraits<AccountConsistencyServiceFactory>; | 39 friend struct base::DefaultSingletonTraits<AccountConsistencyServiceFactory>; |
37 | 40 |
38 AccountConsistencyServiceFactory(); | 41 AccountConsistencyServiceFactory(); |
39 ~AccountConsistencyServiceFactory() override; | 42 ~AccountConsistencyServiceFactory() override; |
40 | 43 |
41 // BrowserStateKeyedServiceFactory: | 44 // BrowserStateKeyedServiceFactory: |
42 void RegisterBrowserStatePrefs( | 45 void RegisterBrowserStatePrefs( |
43 user_prefs::PrefRegistrySyncable* registry) override; | 46 user_prefs::PrefRegistrySyncable* registry) override; |
44 scoped_ptr<KeyedService> BuildServiceInstanceFor( | 47 scoped_ptr<KeyedService> BuildServiceInstanceFor( |
45 web::BrowserState* context) const override; | 48 web::BrowserState* context) const override; |
46 bool ServiceIsCreatedWithBrowserState() const override; | 49 bool ServiceIsCreatedWithBrowserState() const override; |
47 | 50 |
48 DISALLOW_COPY_AND_ASSIGN(AccountConsistencyServiceFactory); | 51 DISALLOW_COPY_AND_ASSIGN(AccountConsistencyServiceFactory); |
49 }; | 52 }; |
50 | 53 |
51 } // namespace ios | 54 } // namespace ios |
52 | 55 |
53 #endif // IOS_CHROME_BROWSER_SIGNIN_ACCOUNT_CONSISTENCY_SERVICE_FACTORY_H_ | 56 #endif // IOS_CHROME_BROWSER_SIGNIN_ACCOUNT_CONSISTENCY_SERVICE_FACTORY_H_ |
OLD | NEW |