1 // Copyright 2018 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_PROFILES_RENDERER_UPDATER_FACTORY_H_
6 #define CHROME_BROWSER_PROFILES_RENDERER_UPDATER_FACTORY_H_
7 
8 #include "base/memory/singleton.h"
9 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
10 
11 class Profile;
12 class RendererUpdater;
13 
14 // Singleton that creates/deletes RendererUpdater as new Profiles are
15 // created/shutdown.
16 class RendererUpdaterFactory : public BrowserContextKeyedServiceFactory {
17  public:
18   // Returns an instance of the RendererUpdaterFactory singleton.
19   static RendererUpdaterFactory* GetInstance();
20 
21   // Returns the instance of RendererUpdater for the passed |profile|.
22   static RendererUpdater* GetForProfile(Profile* profile);
23 
24   RendererUpdaterFactory(const RendererUpdaterFactory&) = delete;
25   RendererUpdaterFactory& operator=(const RendererUpdaterFactory&) = delete;
26 
27  protected:
28   // BrowserContextKeyedServiceFactory:
29   KeyedService* BuildServiceInstanceFor(
30       content::BrowserContext* profile) const override;
31   bool ServiceIsCreatedWithBrowserContext() const override;
32 
33  private:
34   friend struct base::DefaultSingletonTraits<RendererUpdaterFactory>;
35 
36   RendererUpdaterFactory();
37   ~RendererUpdaterFactory() override;
38 };
39 
40 #endif  // CHROME_BROWSER_PROFILES_RENDERER_UPDATER_FACTORY_H_
41