Chromium Code Reviews| Index: ios/chrome/browser/voice/text_to_speech_listener.h |
| diff --git a/ios/chrome/browser/voice/text_to_speech_listener.h b/ios/chrome/browser/voice/text_to_speech_listener.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d14a0351414713faf5aef8545e10a2b2942ea3c3 |
| --- /dev/null |
| +++ b/ios/chrome/browser/voice/text_to_speech_listener.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2016 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 IOS_CHROME_BROWSER_VOICE_TEXT_TO_SPEECH_LISTENER_H_ |
| +#define IOS_CHROME_BROWSER_VOICE_TEXT_TO_SPEECH_LISTENER_H_ |
| + |
| +#import <Foundation/Foundation.h> |
| + |
| +class GURL; |
| +namespace web { |
| +class WebState; |
| +} |
| + |
| +@protocol TextToSpeechListenerDelegate; |
| + |
| +// Class that listens for page loads on a WebState and extracts TTS data. |
| +@interface TextToSpeechListener : NSObject |
| + |
| +// The WebState passed on initialization. |
| +@property(nonatomic, readonly) web::WebState* webState; |
| + |
| +// Designated initializer. |
| +- (instancetype)initWithWebState:(web::WebState*)webState |
| + delegate:(id<TextToSpeechListenerDelegate>)delegate |
| + NS_DESIGNATED_INITIALIZER; |
| +- (instancetype)init NS_UNAVAILABLE; |
| + |
| +@end |
| + |
| +@protocol TextToSpeechListenerDelegate<NSObject> |
| + |
| +// Called by |listener| when TTS audio data has been extracted from its |
| +// WebState. If a page load was encountered that was not a Voice Search SRP, |
| +// this function is called with a nil |result|. |
| +- (void)textToSpeechListener:(TextToSpeechListener*)listener |
| + didReceieveResult:(NSData*)result; |
|
sdefresne
2016/10/25 13:20:30
nit: s/didReceieveResult/didReceiveResult/ (or sho
rohitrao (ping after 24h)
2016/10/25 15:23:12
Good catch, done!
|
| + |
| +// Called by |listener| when its WebState was destroyed. |
|
sdefresne
2016/10/25 13:20:30
nit: "Called by |listener| after its WebState was
rohitrao (ping after 24h)
2016/10/25 15:23:12
Done.
|
| +- (void)textToSpeechListenerWebStateWasDestroyed: |
| + (TextToSpeechListener*)listener; |
| + |
| +// Called by |listener| to determine whether |URL| is a Voice Search SRP with |
| +// Text-To-Speech data. |
| +- (BOOL)shouldTextToSpeechListener:(TextToSpeechListener*)listener |
| + parseDataFromURL:(const GURL&)URL; |
| + |
| +@end |
| + |
| +#endif // IOS_CHROME_BROWSER_VOICE_TEXT_TO_SPEECH_LISTENER_H_ |