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