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