Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / search / hotword_service_factory.h
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.
4
5 #ifndef CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_
7
8 #include "base/memory/singleton.h"
9 #include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
10
11 class BrowserContextKeyedService;
12 class HotwordService;
13 class Profile;
14
15 // Singleton that owns all HotwordServices and associates them with Profiles.
16 class HotwordServiceFactory : public BrowserContextKeyedServiceFactory {
17  public:
18   // Returns the HotwordService for |profile|.
19   static HotwordService* GetForProfile(Profile* profile);
20
21   static HotwordServiceFactory* GetInstance();
22
23   // Returns true to show the opt in pop up for that profile.
24   static bool ShouldShowOptInPopup(Profile* profile);
25
26   // Returns true if the hotwording service is available for |profile|.
27   static bool IsServiceAvailable(Profile* profile);
28
29   // Returns true if hotwording is allowed for |profile|.
30   static bool IsHotwordAllowed(Profile* profile);
31
32  private:
33   friend struct DefaultSingletonTraits<HotwordServiceFactory>;
34
35   HotwordServiceFactory();
36   virtual ~HotwordServiceFactory();
37
38   // Overrides from BrowserContextKeyedServiceFactory:
39   virtual void RegisterProfilePrefs(
40       user_prefs::PrefRegistrySyncable* registry) OVERRIDE;
41   virtual BrowserContextKeyedService* BuildServiceInstanceFor(
42       content::BrowserContext* profile) const OVERRIDE;
43
44   DISALLOW_COPY_AND_ASSIGN(HotwordServiceFactory);
45 };
46
47 #endif  // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_