1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_
8 #include "base/memory/singleton.h"
9 #include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
11 class BrowserContextKeyedService;
15 // Singleton that owns all HotwordServices and associates them with Profiles.
16 class HotwordServiceFactory : public BrowserContextKeyedServiceFactory {
18 // Returns the HotwordService for |profile|.
19 static HotwordService* GetForProfile(Profile* profile);
21 static HotwordServiceFactory* GetInstance();
23 // Returns true to show the opt in pop up for that profile.
24 static bool ShouldShowOptInPopup(Profile* profile);
26 // Returns true if the hotwording service is available for |profile|.
27 static bool IsServiceAvailable(Profile* profile);
29 // Returns true if hotwording is allowed for |profile|.
30 static bool IsHotwordAllowed(Profile* profile);
33 friend struct DefaultSingletonTraits<HotwordServiceFactory>;
35 HotwordServiceFactory();
36 virtual ~HotwordServiceFactory();
38 // Overrides from BrowserContextKeyedServiceFactory:
39 virtual void RegisterProfilePrefs(
40 user_prefs::PrefRegistrySyncable* registry) OVERRIDE;
41 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
42 content::BrowserContext* profile) const OVERRIDE;
44 DISALLOW_COPY_AND_ASSIGN(HotwordServiceFactory);
47 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_