| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/extension_tts_api.h" | 5 #include "chrome/browser/extensions/extension_tts_api.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcom.h> | 8 #include <atlcom.h> |
| 9 #include <sapi.h> | 9 #include <sapi.h> |
| 10 | 10 |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "base/scoped_comptr_win.h" | |
| 13 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 14 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "base/win/scoped_comptr.h" |
| 16 | 16 |
| 17 namespace util = extension_tts_api_util; | 17 namespace util = extension_tts_api_util; |
| 18 | 18 |
| 19 class ExtensionTtsPlatformImplWin : public ExtensionTtsPlatformImpl { | 19 class ExtensionTtsPlatformImplWin : public ExtensionTtsPlatformImpl { |
| 20 public: | 20 public: |
| 21 virtual bool Speak( | 21 virtual bool Speak( |
| 22 const std::string& utterance, | 22 const std::string& utterance, |
| 23 const std::string& language, | 23 const std::string& language, |
| 24 const std::string& gender, | 24 const std::string& gender, |
| 25 double rate, | 25 double rate, |
| 26 double pitch, | 26 double pitch, |
| 27 double volume); | 27 double volume); |
| 28 | 28 |
| 29 virtual bool StopSpeaking(); | 29 virtual bool StopSpeaking(); |
| 30 | 30 |
| 31 virtual bool IsSpeaking(); | 31 virtual bool IsSpeaking(); |
| 32 | 32 |
| 33 // Get the single instance of this class. | 33 // Get the single instance of this class. |
| 34 static ExtensionTtsPlatformImplWin* GetInstance(); | 34 static ExtensionTtsPlatformImplWin* GetInstance(); |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 ExtensionTtsPlatformImplWin(); | 37 ExtensionTtsPlatformImplWin(); |
| 38 virtual ~ExtensionTtsPlatformImplWin() {} | 38 virtual ~ExtensionTtsPlatformImplWin() {} |
| 39 | 39 |
| 40 ScopedComPtr<ISpVoice> speech_synthesizer_; | 40 base::win::ScopedComPtr<ISpVoice> speech_synthesizer_; |
| 41 bool paused_; | 41 bool paused_; |
| 42 | 42 |
| 43 friend struct DefaultSingletonTraits<ExtensionTtsPlatformImplWin>; | 43 friend struct DefaultSingletonTraits<ExtensionTtsPlatformImplWin>; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsPlatformImplWin); | 45 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsPlatformImplWin); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // static | 48 // static |
| 49 ExtensionTtsPlatformImpl* ExtensionTtsPlatformImpl::GetInstance() { | 49 ExtensionTtsPlatformImpl* ExtensionTtsPlatformImpl::GetInstance() { |
| 50 return ExtensionTtsPlatformImplWin::GetInstance(); | 50 return ExtensionTtsPlatformImplWin::GetInstance(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 NULL, | 125 NULL, |
| 126 CLSCTX_SERVER, | 126 CLSCTX_SERVER, |
| 127 IID_ISpVoice, | 127 IID_ISpVoice, |
| 128 reinterpret_cast<void**>(&speech_synthesizer_)); | 128 reinterpret_cast<void**>(&speech_synthesizer_)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // static | 131 // static |
| 132 ExtensionTtsPlatformImplWin* ExtensionTtsPlatformImplWin::GetInstance() { | 132 ExtensionTtsPlatformImplWin* ExtensionTtsPlatformImplWin::GetInstance() { |
| 133 return Singleton<ExtensionTtsPlatformImplWin>::get(); | 133 return Singleton<ExtensionTtsPlatformImplWin>::get(); |
| 134 } | 134 } |
| OLD | NEW |