Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / search / hotword_service_factory.h
blob31139bd21cde05ae007139b0f9b989bddc78a2bc
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/keyed_service/content/browser_context_keyed_service_factory.h"
11 class HotwordService;
12 class Profile;
14 // Singleton that owns all HotwordServices and associates them with Profiles.
15 class HotwordServiceFactory : public BrowserContextKeyedServiceFactory {
16 public:
17 // Returns the HotwordService for |context|.
18 static HotwordService* GetForProfile(content::BrowserContext* context);
20 static HotwordServiceFactory* GetInstance();
22 // Returns true if the hotwording service is available for |context|.
23 static bool IsServiceAvailable(content::BrowserContext* context);
25 // Returns true if hotwording is allowed for |context|.
26 static bool IsHotwordAllowed(content::BrowserContext* context);
28 // Returns whether always-on hotwording is available.
29 static bool IsAlwaysOnAvailable();
31 // Returns the current error message for the service for |context|.
32 // A value of 0 indicates no error.
33 static int GetCurrentError(content::BrowserContext* context);
35 // This will kick off the monitor that calls OnUpdateAudioDevices when the
36 // number of audio devices changes (or is initialized). It needs to be a
37 // separate function so it can be called after the service is initialized
38 // (i.e., after startup). The monitor can't be initialized during startup
39 // because it would slow down startup too much so it is delayed and not
40 // called until it's needed by the webui in browser_options_handler.
41 void UpdateMicrophoneState();
43 private:
44 friend struct base::DefaultSingletonTraits<HotwordServiceFactory>;
46 HotwordServiceFactory();
47 ~HotwordServiceFactory() override;
49 // Overrides from BrowserContextKeyedServiceFactory:
50 void RegisterProfilePrefs(
51 user_prefs::PrefRegistrySyncable* registry) override;
52 KeyedService* BuildServiceInstanceFor(
53 content::BrowserContext* context) const override;
55 DISALLOW_COPY_AND_ASSIGN(HotwordServiceFactory);
58 #endif // CHROME_BROWSER_SEARCH_HOTWORD_SERVICE_FACTORY_H_