Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/browser/speech/tts_mac.mm

Issue 12279015: Mac Chromium style checker cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include <string> 5 #include <string>
6 6
7 #include "base/memory/scoped_nsobject.h" 7 #include "base/memory/scoped_nsobject.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/extensions/extension_function.h" 11 #include "chrome/browser/extensions/extension_function.h"
12 #include "chrome/browser/speech/tts_controller.h" 12 #include "chrome/browser/speech/tts_controller.h"
13 #include "chrome/browser/speech/tts_platform.h" 13 #include "chrome/browser/speech/tts_platform.h"
14 14
15 #import <Cocoa/Cocoa.h> 15 #import <Cocoa/Cocoa.h>
16 16
17 class TtsPlatformImplMac; 17 class TtsPlatformImplMac;
18 18
19 @interface ChromeTtsDelegate : NSObject <NSSpeechSynthesizerDelegate> { 19 @interface ChromeTtsDelegate : NSObject <NSSpeechSynthesizerDelegate> {
20 @private 20 @private
21 TtsPlatformImplMac* ttsImplMac_; // weak. 21 TtsPlatformImplMac* ttsImplMac_; // weak.
22 } 22 }
23 23
24 - (id)initWithPlatformImplMac:(TtsPlatformImplMac*)ttsImplMac; 24 - (id)initWithPlatformImplMac:(TtsPlatformImplMac*)ttsImplMac;
25 25
26 @end 26 @end
27 27
28 class TtsPlatformImplMac : public TtsPlatformImpl { 28 class TtsPlatformImplMac : public TtsPlatformImpl {
29 public: 29 public:
30 virtual bool PlatformImplAvailable() { 30 virtual bool PlatformImplAvailable() OVERRIDE {
31 return true; 31 return true;
32 } 32 }
33 33
34 virtual bool Speak( 34 virtual bool Speak(
35 int utterance_id, 35 int utterance_id,
36 const std::string& utterance, 36 const std::string& utterance,
37 const std::string& lang, 37 const std::string& lang,
38 const UtteranceContinuousParameters& params); 38 const UtteranceContinuousParameters& params) OVERRIDE;
39 39
40 virtual bool StopSpeaking(); 40 virtual bool StopSpeaking() OVERRIDE;
41 41
42 virtual bool IsSpeaking(); 42 virtual bool IsSpeaking() OVERRIDE;
43 43
44 virtual bool SendsEvent(TtsEventType event_type); 44 virtual bool SendsEvent(TtsEventType event_type) OVERRIDE;
45 45
46 // Called by ChromeTtsDelegate when we get a callback from the 46 // Called by ChromeTtsDelegate when we get a callback from the
47 // native speech engine. 47 // native speech engine.
48 void OnSpeechEvent(NSSpeechSynthesizer* sender, 48 void OnSpeechEvent(NSSpeechSynthesizer* sender,
49 TtsEventType event_type, 49 TtsEventType event_type,
50 int char_index, 50 int char_index,
51 const std::string& error_message); 51 const std::string& error_message);
52 52
53 // Get the single instance of this class. 53 // Get the single instance of this class.
54 static TtsPlatformImplMac* GetInstance(); 54 static TtsPlatformImplMac* GetInstance();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 - (void)speechSynthesizer:(NSSpeechSynthesizer*)sender 199 - (void)speechSynthesizer:(NSSpeechSynthesizer*)sender
200 didEncounterErrorAtIndex:(NSUInteger)character_index 200 didEncounterErrorAtIndex:(NSUInteger)character_index
201 ofString:(NSString*)string 201 ofString:(NSString*)string
202 message:(NSString*)message { 202 message:(NSString*)message {
203 std::string message_utf8 = base::SysNSStringToUTF8(message); 203 std::string message_utf8 = base::SysNSStringToUTF8(message);
204 ttsImplMac_->OnSpeechEvent(sender, TTS_EVENT_ERROR, character_index, 204 ttsImplMac_->OnSpeechEvent(sender, TTS_EVENT_ERROR, character_index,
205 message_utf8); 205 message_utf8);
206 } 206 }
207 207
208 @end 208 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698