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

Side by Side Diff: chrome/browser/extensions/extension_tts_api_chromeos.cc

Issue 8400077: chromeos: Rename functions to be PascalCase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/chromeos/system_key_event_listener.cc ('k') | chrome/browser/ui/browser_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/singleton.h" 6 #include "base/memory/singleton.h"
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 10 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (params.volume >= 0.0) { 98 if (params.volume >= 0.0) {
99 // The Chrome OS TTS service allows a range of 0 to 5 for speech volume, 99 // The Chrome OS TTS service allows a range of 0 to 5 for speech volume,
100 // but 5 clips, so map to a range of 0...4. 100 // but 5 clips, so map to a range of 0...4.
101 AppendSpeakOption( 101 AppendSpeakOption(
102 chromeos::SpeechSynthesizerClient::kSpeechPropertyVolume, 102 chromeos::SpeechSynthesizerClient::kSpeechPropertyVolume,
103 DoubleToString(params.volume * 4), 103 DoubleToString(params.volume * 4),
104 &options); 104 &options);
105 } 105 }
106 106
107 chromeos::SpeechSynthesizerClient* speech_synthesizer_client = 107 chromeos::SpeechSynthesizerClient* speech_synthesizer_client =
108 chromeos::DBusThreadManager::Get()->speech_synthesizer_client(); 108 chromeos::DBusThreadManager::Get()->GetSpeechSynthesizerClient();
109 109
110 if (!options.empty()) 110 if (!options.empty())
111 speech_synthesizer_client->SetSpeakProperties(options); 111 speech_synthesizer_client->SetSpeakProperties(options);
112 112
113 speech_synthesizer_client->Speak(utterance); 113 speech_synthesizer_client->Speak(utterance);
114 ExtensionTtsController* controller = ExtensionTtsController::GetInstance(); 114 ExtensionTtsController* controller = ExtensionTtsController::GetInstance();
115 controller->OnTtsEvent(utterance_id_, TTS_EVENT_START, 0, std::string()); 115 controller->OnTtsEvent(utterance_id_, TTS_EVENT_START, 0, std::string());
116 PollUntilSpeechFinishes(utterance_id_); 116 PollUntilSpeechFinishes(utterance_id_);
117 117
118 return true; 118 return true;
119 } 119 }
120 120
121 bool ExtensionTtsPlatformImplChromeOs::StopSpeaking() { 121 bool ExtensionTtsPlatformImplChromeOs::StopSpeaking() {
122 chromeos::DBusThreadManager::Get()->speech_synthesizer_client()-> 122 chromeos::DBusThreadManager::Get()->GetSpeechSynthesizerClient()->
123 StopSpeaking(); 123 StopSpeaking();
124 return true; 124 return true;
125 } 125 }
126 126
127 bool ExtensionTtsPlatformImplChromeOs::SendsEvent(TtsEventType event_type) { 127 bool ExtensionTtsPlatformImplChromeOs::SendsEvent(TtsEventType event_type) {
128 return (event_type == TTS_EVENT_START || 128 return (event_type == TTS_EVENT_START ||
129 event_type == TTS_EVENT_END || 129 event_type == TTS_EVENT_END ||
130 event_type == TTS_EVENT_ERROR); 130 event_type == TTS_EVENT_ERROR);
131 } 131 }
132 132
133 void ExtensionTtsPlatformImplChromeOs::PollUntilSpeechFinishes( 133 void ExtensionTtsPlatformImplChromeOs::PollUntilSpeechFinishes(
134 int utterance_id) { 134 int utterance_id) {
135 if (utterance_id != utterance_id_) { 135 if (utterance_id != utterance_id_) {
136 // This utterance must have been interrupted or cancelled. 136 // This utterance must have been interrupted or cancelled.
137 return; 137 return;
138 } 138 }
139 chromeos::SpeechSynthesizerClient* speech_synthesizer_client = 139 chromeos::SpeechSynthesizerClient* speech_synthesizer_client =
140 chromeos::DBusThreadManager::Get()->speech_synthesizer_client(); 140 chromeos::DBusThreadManager::Get()->GetSpeechSynthesizerClient();
141 speech_synthesizer_client->IsSpeaking(base::Bind( 141 speech_synthesizer_client->IsSpeaking(base::Bind(
142 &ExtensionTtsPlatformImplChromeOs::ContinuePollingIfSpeechIsNotFinished, 142 &ExtensionTtsPlatformImplChromeOs::ContinuePollingIfSpeechIsNotFinished,
143 weak_ptr_factory_.GetWeakPtr(), utterance_id)); 143 weak_ptr_factory_.GetWeakPtr(), utterance_id));
144 } 144 }
145 145
146 void ExtensionTtsPlatformImplChromeOs::ContinuePollingIfSpeechIsNotFinished( 146 void ExtensionTtsPlatformImplChromeOs::ContinuePollingIfSpeechIsNotFinished(
147 int utterance_id, bool is_speaking) { 147 int utterance_id, bool is_speaking) {
148 if (utterance_id != utterance_id_) { 148 if (utterance_id != utterance_id_) {
149 // This utterance must have been interrupted or cancelled. 149 // This utterance must have been interrupted or cancelled.
150 return; 150 return;
(...skipping 22 matching lines...) Expand all
173 chromeos::SpeechSynthesizerClient::kSpeechPropertyEquals + 173 chromeos::SpeechSynthesizerClient::kSpeechPropertyEquals +
174 value + 174 value +
175 chromeos::SpeechSynthesizerClient::kSpeechPropertyDelimiter; 175 chromeos::SpeechSynthesizerClient::kSpeechPropertyDelimiter;
176 } 176 }
177 177
178 // static 178 // static
179 ExtensionTtsPlatformImplChromeOs* 179 ExtensionTtsPlatformImplChromeOs*
180 ExtensionTtsPlatformImplChromeOs::GetInstance() { 180 ExtensionTtsPlatformImplChromeOs::GetInstance() {
181 return Singleton<ExtensionTtsPlatformImplChromeOs>::get(); 181 return Singleton<ExtensionTtsPlatformImplChromeOs>::get();
182 } 182 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system_key_event_listener.cc ('k') | chrome/browser/ui/browser_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698