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 COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_SHUTDOWN_NOTIFIER_FACTORY_H_ 6 #define COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_SHUTDOWN_NOTIFIER_FACTORY_H_ 7 8 #include "base/macros.h" 9 #include "components/keyed_service/content/browser_context_keyed_service_factory.h" 10 #include "components/keyed_service/core/keyed_service_export.h" 11 12 class KeyedServiceShutdownNotifier; 13 14 // A base class for factories for KeyedServiceShutdownNotifier objects that are 15 // keyed on a BrowserContext. 16 // To use this class, create a singleton subclass and declare its dependencies 17 // in the constructor. 18 class KEYED_SERVICE_EXPORT BrowserContextKeyedServiceShutdownNotifierFactory 19 : public BrowserContextKeyedServiceFactory { 20 public: 21 KeyedServiceShutdownNotifier* Get(content::BrowserContext* context); 22 23 protected: 24 explicit BrowserContextKeyedServiceShutdownNotifierFactory(const char* name); 25 ~BrowserContextKeyedServiceShutdownNotifierFactory() override; 26 27 private: 28 KeyedService* BuildServiceInstanceFor( 29 content::BrowserContext* context) const override; 30 content::BrowserContext* GetBrowserContextToUse( 31 content::BrowserContext* context) const override; 32 33 DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedServiceShutdownNotifierFactory); 34 }; 35 36 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_SHUTDOWN_NOTIFIER_FACTORY_H_ 37