OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ |
6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" | 9 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" |
10 | 10 |
11 class BrowserContextKeyedService; | 11 class BrowserContextKeyedService; |
12 class HotwordService; | 12 class HotwordService; |
13 class Profile; | 13 class Profile; |
14 | 14 |
15 // Singleton that owns all HotwordServices and associates them with Profiles. | 15 // Singleton that owns all HotwordServices and associates them with Profiles. |
16 class HotwordServiceFactory : public BrowserContextKeyedServiceFactory { | 16 class HotwordServiceFactory : public BrowserContextKeyedServiceFactory { |
17 public: | 17 public: |
18 // Returns the HotwordService for |profile|. | 18 // Returns the HotwordService for |context|. |
19 static HotwordService* GetForProfile(Profile* profile); | 19 static HotwordService* GetForProfile(content::BrowserContext* context); |
20 | 20 |
21 static HotwordServiceFactory* GetInstance(); | 21 static HotwordServiceFactory* GetInstance(); |
22 | 22 |
23 // Returns true to show the opt in pop up for that profile. | 23 // Returns true to show the opt in pop up for |context|. |
24 static bool ShouldShowOptInPopup(Profile* profile); | 24 static bool ShouldShowOptInPopup(content::BrowserContext* context); |
25 | 25 |
26 // Returns true if the hotwording service is available for |profile|. | 26 // Returns true if the hotwording service is available for |context|. |
27 static bool IsServiceAvailable(Profile* profile); | 27 static bool IsServiceAvailable(content::BrowserContext* context); |
28 | 28 |
29 // Returns true if hotwording is allowed for |profile|. | 29 // Returns true if hotwording is allowed for |context|. |
30 static bool IsHotwordAllowed(Profile* profile); | 30 static bool IsHotwordAllowed(content::BrowserContext* context); |
31 | 31 |
32 private: | 32 private: |
33 friend struct DefaultSingletonTraits<HotwordServiceFactory>; | 33 friend struct DefaultSingletonTraits<HotwordServiceFactory>; |
34 | 34 |
35 HotwordServiceFactory(); | 35 HotwordServiceFactory(); |
36 virtual ~HotwordServiceFactory(); | 36 virtual ~HotwordServiceFactory(); |
37 | 37 |
38 // Overrides from BrowserContextKeyedServiceFactory: | 38 // Overrides from BrowserContextKeyedServiceFactory: |
39 virtual void RegisterProfilePrefs( | 39 virtual void RegisterProfilePrefs( |
40 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; | 40 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; |
41 virtual BrowserContextKeyedService* BuildServiceInstanceFor( | 41 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
42 content::BrowserContext* profile) const OVERRIDE; | 42 content::BrowserContext* context) const OVERRIDE; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(HotwordServiceFactory); | 44 DISALLOW_COPY_AND_ASSIGN(HotwordServiceFactory); |
45 }; | 45 }; |
46 | 46 |
47 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ | 47 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_ |
OLD | NEW |