| 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_TTS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_TTS_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_SPEECH_TTS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_SPEECH_TTS_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 const std::set<TtsEventType>& desired_event_types() const { | 195 const std::set<TtsEventType>& desired_event_types() const { |
| 196 return desired_event_types_; | 196 return desired_event_types_; |
| 197 } | 197 } |
| 198 | 198 |
| 199 const std::string& extension_id() const { return extension_id_; } | 199 const std::string& extension_id() const { return extension_id_; } |
| 200 void set_extension_id(const std::string& extension_id) { | 200 void set_extension_id(const std::string& extension_id) { |
| 201 extension_id_ = extension_id; | 201 extension_id_ = extension_id; |
| 202 } | 202 } |
| 203 | 203 |
| 204 UtteranceEventDelegate* event_delegate() const { | 204 UtteranceEventDelegate* event_delegate() const { |
| 205 return event_delegate_.get(); | 205 return event_delegate_; |
| 206 } | 206 } |
| 207 void set_event_delegate( | 207 void set_event_delegate(UtteranceEventDelegate* event_delegate) { |
| 208 base::WeakPtr<UtteranceEventDelegate> event_delegate) { | |
| 209 event_delegate_ = event_delegate; | 208 event_delegate_ = event_delegate; |
| 210 } | 209 } |
| 211 | 210 |
| 212 // Getters and setters for internal state. | 211 // Getters and setters for internal state. |
| 213 content::BrowserContext* browser_context() const { return browser_context_; } | 212 content::BrowserContext* browser_context() const { return browser_context_; } |
| 214 int id() const { return id_; } | 213 int id() const { return id_; } |
| 215 bool finished() const { return finished_; } | 214 bool finished() const { return finished_; } |
| 216 | 215 |
| 217 private: | 216 private: |
| 218 // The BrowserContext that initiated this utterance. | 217 // The BrowserContext that initiated this utterance. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 238 scoped_ptr<base::Value> options_; | 237 scoped_ptr<base::Value> options_; |
| 239 | 238 |
| 240 // The source extension's ID of this utterance, so that it can associate | 239 // The source extension's ID of this utterance, so that it can associate |
| 241 // events with the appropriate callback. | 240 // events with the appropriate callback. |
| 242 int src_id_; | 241 int src_id_; |
| 243 | 242 |
| 244 // The URL of the page where the source extension called speak. | 243 // The URL of the page where the source extension called speak. |
| 245 GURL src_url_; | 244 GURL src_url_; |
| 246 | 245 |
| 247 // The delegate to be called when an utterance event is fired. | 246 // The delegate to be called when an utterance event is fired. |
| 248 base::WeakPtr<UtteranceEventDelegate> event_delegate_; | 247 UtteranceEventDelegate* event_delegate_; |
| 249 | 248 |
| 250 // The parsed options. | 249 // The parsed options. |
| 251 std::string voice_name_; | 250 std::string voice_name_; |
| 252 std::string lang_; | 251 std::string lang_; |
| 253 TtsGenderType gender_; | 252 TtsGenderType gender_; |
| 254 UtteranceContinuousParameters continuous_parameters_; | 253 UtteranceContinuousParameters continuous_parameters_; |
| 255 bool can_enqueue_; | 254 bool can_enqueue_; |
| 256 std::set<TtsEventType> required_event_types_; | 255 std::set<TtsEventType> required_event_types_; |
| 257 std::set<TtsEventType> desired_event_types_; | 256 std::set<TtsEventType> desired_event_types_; |
| 258 | 257 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // Called by the extension system or platform implementation when the | 307 // Called by the extension system or platform implementation when the |
| 309 // list of voices may have changed and should be re-queried. | 308 // list of voices may have changed and should be re-queried. |
| 310 virtual void VoicesChanged() = 0; | 309 virtual void VoicesChanged() = 0; |
| 311 | 310 |
| 312 // Add a delegate that wants to be notified when the set of voices changes. | 311 // Add a delegate that wants to be notified when the set of voices changes. |
| 313 virtual void AddVoicesChangedDelegate(VoicesChangedDelegate* delegate) = 0; | 312 virtual void AddVoicesChangedDelegate(VoicesChangedDelegate* delegate) = 0; |
| 314 | 313 |
| 315 // Remove delegate that wants to be notified when the set of voices changes. | 314 // Remove delegate that wants to be notified when the set of voices changes. |
| 316 virtual void RemoveVoicesChangedDelegate(VoicesChangedDelegate* delegate) = 0; | 315 virtual void RemoveVoicesChangedDelegate(VoicesChangedDelegate* delegate) = 0; |
| 317 | 316 |
| 317 // Remove delegate that wants to be notified when an utterance fires an event. |
| 318 // Note: this cancels speech from any utterance with this delegate, and |
| 319 // removes any utterances with this delegate from the queue. |
| 320 virtual void RemoveUtteranceEventDelegate(UtteranceEventDelegate* delegate) |
| 321 = 0; |
| 322 |
| 318 // Set the delegate that processes TTS requests with user-installed | 323 // Set the delegate that processes TTS requests with user-installed |
| 319 // extensions. | 324 // extensions. |
| 320 virtual void SetTtsEngineDelegate(TtsEngineDelegate* delegate) = 0; | 325 virtual void SetTtsEngineDelegate(TtsEngineDelegate* delegate) = 0; |
| 321 | 326 |
| 322 // Get the delegate that processes TTS requests with user-installed | 327 // Get the delegate that processes TTS requests with user-installed |
| 323 // extensions. | 328 // extensions. |
| 324 virtual TtsEngineDelegate* GetTtsEngineDelegate() = 0; | 329 virtual TtsEngineDelegate* GetTtsEngineDelegate() = 0; |
| 325 | 330 |
| 326 // For unit testing. | 331 // For unit testing. |
| 327 virtual void SetPlatformImpl(TtsPlatformImpl* platform_impl) = 0; | 332 virtual void SetPlatformImpl(TtsPlatformImpl* platform_impl) = 0; |
| 328 virtual int QueueSize() = 0; | 333 virtual int QueueSize() = 0; |
| 329 | 334 |
| 330 protected: | 335 protected: |
| 331 virtual ~TtsController() {} | 336 virtual ~TtsController() {} |
| 332 }; | 337 }; |
| 333 | 338 |
| 334 #endif // CHROME_BROWSER_SPEECH_TTS_CONTROLLER_H_ | 339 #endif // CHROME_BROWSER_SPEECH_TTS_CONTROLLER_H_ |
| OLD | NEW |