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_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ | 6 #define CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 9 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
10 | 10 |
11 class Profile; | 11 class Profile; |
12 | 12 |
13 namespace hotword_internal { | 13 namespace hotword_internal { |
14 // Constants for the hotword field trial. | 14 // Constants for the hotword field trial. |
15 extern const char kHotwordFieldTrialName[]; | 15 extern const char kHotwordFieldTrialName[]; |
16 extern const char kHotwordFieldTrialDisabledGroupName[]; | 16 extern const char kHotwordFieldTrialDisabledGroupName[]; |
17 } // namespace hotword_internal | 17 } // namespace hotword_internal |
18 | 18 |
19 // Provides an interface for the Hotword component that does voice triggered | 19 // Provides an interface for the Hotword component that does voice triggered |
20 // search. | 20 // search. |
21 class HotwordService : public BrowserContextKeyedService { | 21 class HotwordService : public BrowserContextKeyedService { |
22 public: | 22 public: |
| 23 // Returns true if the hotword supports the current system language. |
| 24 static bool DoesHotwordSupportLanguage(Profile* profile); |
| 25 |
23 explicit HotwordService(Profile* profile); | 26 explicit HotwordService(Profile* profile); |
24 virtual ~HotwordService(); | 27 virtual ~HotwordService(); |
25 | 28 |
26 bool ShouldShowOptInPopup(); | 29 bool ShouldShowOptInPopup(); |
27 | 30 |
28 // Used in testing to ensure that the popup is not shown more than this | 31 // Used in testing to ensure that the popup is not shown more than this |
29 // maximum number of times. | 32 // maximum number of times. |
30 int MaxNumberTimesToShowOptInPopup(); | 33 int MaxNumberTimesToShowOptInPopup(); |
31 | 34 |
32 // In addition to showing the popup, the preferences | 35 // In addition to showing the popup, the preferences |
33 // kHotwordOptInPopupTimesShown is also incremented. | 36 // kHotwordOptInPopupTimesShown is also incremented. |
34 void ShowOptInPopup(); | 37 void ShowOptInPopup(); |
35 | 38 |
36 // Checks for whether all the necessary files have downloaded to allow for | 39 // Checks for whether all the necessary files have downloaded to allow for |
37 // using the extension. | 40 // using the extension. |
38 virtual bool IsServiceAvailable(); | 41 virtual bool IsServiceAvailable(); |
39 | 42 |
40 // Determine if hotwording is allowed in this profile based on field trials | 43 // Determine if hotwording is allowed in this profile based on field trials |
41 // and language. | 44 // and language. |
42 virtual bool IsHotwordAllowed(); | 45 virtual bool IsHotwordAllowed(); |
43 | 46 |
44 private: | 47 private: |
45 Profile* profile_; | 48 Profile* profile_; |
46 | 49 |
47 DISALLOW_COPY_AND_ASSIGN(HotwordService); | 50 DISALLOW_COPY_AND_ASSIGN(HotwordService); |
48 }; | 51 }; |
49 | 52 |
50 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ | 53 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_H_ |
OLD | NEW |