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

Side by Side Diff: chrome/browser/speech/tts_message_filter.cc

Issue 15108002: Add Pause and Resume to Web TTS & Extension TTS APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 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
« no previous file with comments | « chrome/browser/speech/tts_mac.mm ('k') | chrome/browser/speech/tts_platform.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/speech/tts_message_filter.h" 5 #include "chrome/browser/speech/tts_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/speech/tts_controller.h" 10 #include "chrome/browser/speech/tts_controller.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 params.pitch = request.pitch; 82 params.pitch = request.pitch;
83 params.volume = request.volume; 83 params.volume = request.volume;
84 utterance->set_continuous_parameters(params); 84 utterance->set_continuous_parameters(params);
85 85
86 utterance->set_event_delegate(this); 86 utterance->set_event_delegate(this);
87 87
88 TtsController::GetInstance()->SpeakOrEnqueue(utterance.release()); 88 TtsController::GetInstance()->SpeakOrEnqueue(utterance.release());
89 } 89 }
90 90
91 void TtsMessageFilter::OnPause() { 91 void TtsMessageFilter::OnPause() {
92 // TODO(dmazzoni): Not supported by TtsController yet. 92 TtsController::GetInstance()->Pause();
93 } 93 }
94 94
95 void TtsMessageFilter::OnResume() { 95 void TtsMessageFilter::OnResume() {
96 // TODO(dmazzoni): Not supported by TtsController yet. 96 TtsController::GetInstance()->Resume();
97 } 97 }
98 98
99 void TtsMessageFilter::OnCancel() { 99 void TtsMessageFilter::OnCancel() {
100 TtsController::GetInstance()->Stop(); 100 TtsController::GetInstance()->Stop();
101 } 101 }
102 102
103 void TtsMessageFilter::OnTtsEvent(Utterance* utterance, 103 void TtsMessageFilter::OnTtsEvent(Utterance* utterance,
104 TtsEventType event_type, 104 TtsEventType event_type,
105 int char_index, 105 int char_index,
106 const std::string& error_message) { 106 const std::string& error_message) {
(...skipping 16 matching lines...) Expand all
123 case TTS_EVENT_INTERRUPTED: 123 case TTS_EVENT_INTERRUPTED:
124 Send(new TtsMsg_WasInterrupted(utterance->src_id())); 124 Send(new TtsMsg_WasInterrupted(utterance->src_id()));
125 break; 125 break;
126 case TTS_EVENT_CANCELLED: 126 case TTS_EVENT_CANCELLED:
127 Send(new TtsMsg_WasCancelled(utterance->src_id())); 127 Send(new TtsMsg_WasCancelled(utterance->src_id()));
128 break; 128 break;
129 case TTS_EVENT_ERROR: 129 case TTS_EVENT_ERROR:
130 Send(new TtsMsg_SpeakingErrorOccurred( 130 Send(new TtsMsg_SpeakingErrorOccurred(
131 utterance->src_id(), error_message)); 131 utterance->src_id(), error_message));
132 break; 132 break;
133 case TTS_EVENT_PAUSE:
134 Send(new TtsMsg_DidPauseSpeaking(utterance->src_id()));
135 break;
136 case TTS_EVENT_RESUME:
137 Send(new TtsMsg_DidResumeSpeaking(utterance->src_id()));
138 break;
133 } 139 }
134 } 140 }
135 141
136 void TtsMessageFilter::OnVoicesChanged() { 142 void TtsMessageFilter::OnVoicesChanged() {
137 OnInitializeVoiceList(); 143 OnInitializeVoiceList();
138 } 144 }
139 145
140 TtsMessageFilter::~TtsMessageFilter() { 146 TtsMessageFilter::~TtsMessageFilter() {
141 } 147 }
OLDNEW
« no previous file with comments | « chrome/browser/speech/tts_mac.mm ('k') | chrome/browser/speech/tts_platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698