| OLD | NEW |
| 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 "chrome/browser/extensions/extension_tts_engine_api.h" | 5 #include "chrome/browser/extensions/extension_tts_engine_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 if (sends_end_event && options->HasKey(constants::kEnqueueKey)) | 178 if (sends_end_event && options->HasKey(constants::kEnqueueKey)) |
| 179 options->Remove(constants::kEnqueueKey, NULL); | 179 options->Remove(constants::kEnqueueKey, NULL); |
| 180 if (options->HasKey(constants::kSrcIdKey)) | 180 if (options->HasKey(constants::kSrcIdKey)) |
| 181 options->Remove(constants::kSrcIdKey, NULL); | 181 options->Remove(constants::kSrcIdKey, NULL); |
| 182 if (options->HasKey(constants::kIsFinalEventKey)) | 182 if (options->HasKey(constants::kIsFinalEventKey)) |
| 183 options->Remove(constants::kIsFinalEventKey, NULL); | 183 options->Remove(constants::kIsFinalEventKey, NULL); |
| 184 | 184 |
| 185 args.Set(1, options); | 185 args.Set(1, options); |
| 186 args.Set(2, Value::CreateIntegerValue(utterance->id())); | 186 args.Set(2, Value::CreateIntegerValue(utterance->id())); |
| 187 std::string json_args; | 187 std::string json_args; |
| 188 base::JSONWriter::Write(&args, false, &json_args); | 188 base::JSONWriter::Write(&args, &json_args); |
| 189 | 189 |
| 190 utterance->profile()->GetExtensionEventRouter()->DispatchEventToExtension( | 190 utterance->profile()->GetExtensionEventRouter()->DispatchEventToExtension( |
| 191 extension->id(), | 191 extension->id(), |
| 192 events::kOnSpeak, | 192 events::kOnSpeak, |
| 193 json_args, | 193 json_args, |
| 194 utterance->profile(), | 194 utterance->profile(), |
| 195 GURL()); | 195 GURL()); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ExtensionTtsEngineStop(Utterance* utterance) { | 198 void ExtensionTtsEngineStop(Utterance* utterance) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 std::string error_message; | 257 std::string error_message; |
| 258 event->GetString(constants::kErrorMessageKey, &error_message); | 258 event->GetString(constants::kErrorMessageKey, &error_message); |
| 259 controller->OnTtsEvent( | 259 controller->OnTtsEvent( |
| 260 utterance_id, TTS_EVENT_ERROR, char_index, error_message); | 260 utterance_id, TTS_EVENT_ERROR, char_index, error_message); |
| 261 } else { | 261 } else { |
| 262 EXTENSION_FUNCTION_VALIDATE(false); | 262 EXTENSION_FUNCTION_VALIDATE(false); |
| 263 } | 263 } |
| 264 | 264 |
| 265 return true; | 265 return true; |
| 266 } | 266 } |
| OLD | NEW |