Chromium Code Reviews| Index: chrome/browser/profile_resetter/triggered_profile_resetter_factory.h |
| diff --git a/chrome/browser/profile_resetter/triggered_profile_resetter_factory.h b/chrome/browser/profile_resetter/triggered_profile_resetter_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f9de1ee437babd3b1aa9f327be3ef21762601d32 |
| --- /dev/null |
| +++ b/chrome/browser/profile_resetter/triggered_profile_resetter_factory.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_FACTORY_H_ |
| +#define CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_FACTORY_H_ |
| + |
| +#include "base/macros.h" |
| +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" |
| + |
| +namespace base { |
| +template <typename T> |
| +struct DefaultSingletonTraits; |
| +} |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} |
| + |
| +namespace user_prefs { |
| +class PrefRegistrySyncable; |
| +} |
| + |
| +class TriggeredProfileResetter; |
| + |
| +class TriggeredProfileResetterFactory |
| + : public BrowserContextKeyedServiceFactory { |
| + public: |
| + static TriggeredProfileResetter* GetForBrowserContext( |
| + content::BrowserContext* context); |
| + static TriggeredProfileResetterFactory* GetInstance(); |
| + |
| + // Registers a factory function to build a TriggeredProfileResetter instance |
| + // to be returned by any subsequent calls to GetForBrowserContext(). Used in |
| + // browser tests that don't provide an easy way to call KeyedServiceFactory's |
| + // SetTesting() methods after profile creation but before factories that |
| + // return true from ServiceIsCreatedWithBrowserContext() are created. |
| + static void SetGlobalTestingFactory(TestingFactoryFunction testing_factory); |
|
engedy
2015/09/14 23:28:56
I think in the browser test you should be able to
robertshield
2015/09/21 04:16:22
Thanks, I hunted for this and somehow missed it. M
|
| + |
| + private: |
| + friend struct base::DefaultSingletonTraits<TriggeredProfileResetterFactory>; |
| + |
| + TriggeredProfileResetterFactory(); |
| + ~TriggeredProfileResetterFactory() override; |
| + |
| + // BrowserContextKeyedServiceFactory: |
| + KeyedService* BuildServiceInstanceFor( |
| + content::BrowserContext* context) const override; |
| + |
| + // BrowserContextKeyedBaseFactory: |
| + void RegisterProfilePrefs( |
| + user_prefs::PrefRegistrySyncable* registry) override; |
| + bool ServiceIsCreatedWithBrowserContext() const override; |
| + |
| + TestingFactoryFunction testing_factory_function_ = nullptr; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TriggeredProfileResetterFactory); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_PROFILE_RESETTER_TRIGGERED_PROFILE_RESETTER_FACTORY_H_ |