OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SPEECH_EXTENSION_API_TTS_EXTENSION_API_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_H_ |
6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_H_ | 6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 10 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
11 #include "chrome/browser/extensions/chrome_extension_function.h" | 11 #include "chrome/browser/extensions/chrome_extension_function.h" |
12 #include "chrome/browser/speech/tts_controller.h" | 12 #include "chrome/browser/speech/tts_controller.h" |
13 | 13 |
14 class Profile; | 14 namespace content { |
| 15 class BrowserContext; |
| 16 } |
15 | 17 |
16 const char *TtsEventTypeToString(TtsEventType event_type); | 18 const char *TtsEventTypeToString(TtsEventType event_type); |
17 TtsEventType TtsEventTypeFromString(const std::string& str); | 19 TtsEventType TtsEventTypeFromString(const std::string& str); |
18 | 20 |
19 namespace extensions { | 21 namespace extensions { |
20 | 22 |
21 class TtsSpeakFunction : public ChromeAsyncExtensionFunction { | 23 class TtsSpeakFunction : public ChromeAsyncExtensionFunction { |
22 private: | 24 private: |
23 virtual ~TtsSpeakFunction() {} | 25 virtual ~TtsSpeakFunction() {} |
24 virtual bool RunImpl() OVERRIDE; | 26 virtual bool RunImpl() OVERRIDE; |
(...skipping 30 matching lines...) Expand all Loading... |
55 | 57 |
56 class TtsGetVoicesFunction : public ChromeSyncExtensionFunction { | 58 class TtsGetVoicesFunction : public ChromeSyncExtensionFunction { |
57 private: | 59 private: |
58 virtual ~TtsGetVoicesFunction() {} | 60 virtual ~TtsGetVoicesFunction() {} |
59 virtual bool RunImpl() OVERRIDE; | 61 virtual bool RunImpl() OVERRIDE; |
60 DECLARE_EXTENSION_FUNCTION("tts.getVoices", TTS_GETVOICES) | 62 DECLARE_EXTENSION_FUNCTION("tts.getVoices", TTS_GETVOICES) |
61 }; | 63 }; |
62 | 64 |
63 class TtsAPI : public ProfileKeyedAPI { | 65 class TtsAPI : public ProfileKeyedAPI { |
64 public: | 66 public: |
65 explicit TtsAPI(Profile* profile); | 67 explicit TtsAPI(content::BrowserContext* context); |
66 virtual ~TtsAPI(); | 68 virtual ~TtsAPI(); |
67 | 69 |
68 // Convenience method to get the TtsAPI for a profile. | |
69 static TtsAPI* Get(Profile* profile); | |
70 | |
71 // ProfileKeyedAPI implementation. | 70 // ProfileKeyedAPI implementation. |
72 static ProfileKeyedAPIFactory<TtsAPI>* GetFactoryInstance(); | 71 static ProfileKeyedAPIFactory<TtsAPI>* GetFactoryInstance(); |
73 | 72 |
74 private: | 73 private: |
75 friend class ProfileKeyedAPIFactory<TtsAPI>; | 74 friend class ProfileKeyedAPIFactory<TtsAPI>; |
76 | 75 |
77 // ProfileKeyedAPI implementation. | 76 // ProfileKeyedAPI implementation. |
78 static const char* service_name() { | 77 static const char* service_name() { |
79 return "TtsAPI"; | 78 return "TtsAPI"; |
80 } | 79 } |
81 static const bool kServiceIsNULLWhileTesting = true; | 80 static const bool kServiceIsNULLWhileTesting = true; |
82 }; | 81 }; |
83 | 82 |
84 } // namespace extensions | 83 } // namespace extensions |
85 | 84 |
86 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_H_ | 85 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_H_ |
OLD | NEW |