OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_FACTORY_H_ |
| 6 #define CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_FACTORY_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 10 |
| 11 namespace base { |
| 12 template <typename T> |
| 13 struct DefaultSingletonTraits; |
| 14 } |
| 15 |
| 16 namespace content { |
| 17 class BrowserContext; |
| 18 } |
| 19 |
| 20 namespace user_prefs { |
| 21 class PrefRegistrySyncable; |
| 22 } |
| 23 |
| 24 class TriggeredProfileResetter; |
| 25 |
| 26 class TriggeredProfileResetterFactory |
| 27 : public BrowserContextKeyedServiceFactory { |
| 28 public: |
| 29 static TriggeredProfileResetter* GetForBrowserContext( |
| 30 content::BrowserContext* context); |
| 31 static TriggeredProfileResetterFactory* GetInstance(); |
| 32 |
| 33 // Registers a factory function to build a TriggeredProfileResetter instance |
| 34 // to be returned by any subsequent calls to GetForBrowserContext(). Used in |
| 35 // browser tests that don't provide an easy way to call KeyedServiceFactory's |
| 36 // SetTesting() methods after profile creation but before factories that |
| 37 // return true from ServiceIsCreatedWithBrowserContext() are created. |
| 38 static void SetGlobalTestingFactory(TestingFactoryFunction testing_factory); |
| 39 |
| 40 private: |
| 41 friend struct base::DefaultSingletonTraits<TriggeredProfileResetterFactory>; |
| 42 |
| 43 TriggeredProfileResetterFactory(); |
| 44 ~TriggeredProfileResetterFactory() override; |
| 45 |
| 46 // BrowserContextKeyedServiceFactory: |
| 47 KeyedService* BuildServiceInstanceFor( |
| 48 content::BrowserContext* context) const override; |
| 49 |
| 50 // BrowserContextKeyedBaseFactory: |
| 51 void RegisterProfilePrefs( |
| 52 user_prefs::PrefRegistrySyncable* registry) override; |
| 53 bool ServiceIsCreatedWithBrowserContext() const override; |
| 54 |
| 55 TestingFactoryFunction testing_factory_function_ = nullptr; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(TriggeredProfileResetterFactory); |
| 58 }; |
| 59 |
| 60 #endif // CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_FACTORY_H_ |
OLD | NEW |