Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/speech_synthesis_loader.h |
| diff --git a/chrome/browser/chromeos/extensions/speech_synthesis_loader.h b/chrome/browser/chromeos/extensions/speech_synthesis_loader.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7553c64f233d85b44f735d9db8f07c1b8cb55ea1 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/extensions/speech_synthesis_loader.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_SPEECH_SYNTHESIS_LOADER_H_ |
| +#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_SPEECH_SYNTHESIS_LOADER_H_ |
| + |
| +#include "base/containers/hash_tables.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/prefs/pref_change_registrar.h" |
| +#include "chrome/browser/extensions/external_loader.h" |
| +#include "chrome/browser/profiles/profile.h" |
| + |
| +namespace user_prefs { |
| +class PrefRegistrySyncable; |
| +} |
| + |
| +class PrefChanceRegistrar; |
| + |
| +namespace chromeos { |
| + |
| +// Chrome OS comes with medium-quality speech synthesis extensions built-in. |
| +// When the user speaks a certain threshold of utterances in the same session, |
| +// we set a preference indicating that high quality speech is enabled for that |
| +// language. This class is the external extension loader that checks the |
| +// preference and prepares the list of external extensions to be installed |
| +// from the web store automatically. The high-quality speech synthesis |
| +// extensions are installed silently as component extensions. |
| +class SpeechSynthesisLoader |
| + : public extensions::ExternalLoader, |
| + public base::SupportsWeakPtr<SpeechSynthesisLoader> { |
| + public: |
| + explicit SpeechSynthesisLoader(Profile* profile); |
| + virtual ~SpeechSynthesisLoader(); |
| + |
| + // Implementation of extensions::ExternalLoader: |
| + virtual void StartLoading() OVERRIDE; |
| + |
| + // Register speech synthesis prefs for a profile. |
| + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| + |
| + private: |
| + // The profile that this loader is associated with. It listens for |
| + // preference changes for that profile. |
| + Profile* profile_; |
|
Dmitry Polukhin
2013/12/05 18:35:32
Need to find out how to make it work with multipro
dmazzoni
2013/12/05 23:19:47
Currently TTS is all done per-profile - even on de
Dmitry Polukhin
2013/12/05 23:29:19
On Chrome OS accessibility UI is available from sy
dmazzoni
2013/12/05 23:39:04
Yes, but speech synthesis is a service available t
|
| + |
| + // The pref change registrar, so we can watch for pref changes. |
| + scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| + |
| + // A weak ptr factory, so we can safely bind pref change registrar |
| + // callbacks to this class. |
| + base::WeakPtrFactory<SpeechSynthesisLoader> weak_ptr_factory_; |
| + |
| + // A map from language code to the extension id of the high-quality |
| + // extension for that language in the web store, if any. |
| + base::hash_map<std::string, std::string> lang_to_extension_id_map_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SpeechSynthesisLoader); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_SPEECH_SYNTHESIS_LOADER_H_ |