| OLD | NEW |
| 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 "chrome/browser/speech/extension_api/tts_engine_extension_api.h" | 5 #include "chrome/browser/speech/extension_api/tts_engine_extension_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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 if (options->HasKey(constants::kRequiredEventTypesKey)) | 174 if (options->HasKey(constants::kRequiredEventTypesKey)) |
| 175 options->Remove(constants::kRequiredEventTypesKey, NULL); | 175 options->Remove(constants::kRequiredEventTypesKey, NULL); |
| 176 if (options->HasKey(constants::kDesiredEventTypesKey)) | 176 if (options->HasKey(constants::kDesiredEventTypesKey)) |
| 177 options->Remove(constants::kDesiredEventTypesKey, NULL); | 177 options->Remove(constants::kDesiredEventTypesKey, NULL); |
| 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 if (options->HasKey(constants::kOnEventKey)) |
| 185 options->Remove(constants::kOnEventKey, NULL); |
| 184 | 186 |
| 185 args.Set(1, options); | 187 args.Set(1, options); |
| 186 args.Set(2, Value::CreateIntegerValue(utterance->id())); | 188 args.Set(2, Value::CreateIntegerValue(utterance->id())); |
| 187 std::string json_args; | 189 std::string json_args; |
| 188 base::JSONWriter::Write(&args, &json_args); | 190 base::JSONWriter::Write(&args, &json_args); |
| 189 | 191 |
| 190 utterance->profile()->GetExtensionEventRouter()->DispatchEventToExtension( | 192 utterance->profile()->GetExtensionEventRouter()->DispatchEventToExtension( |
| 191 extension->id(), | 193 extension->id(), |
| 192 events::kOnSpeak, | 194 events::kOnSpeak, |
| 193 json_args, | 195 json_args, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 std::string error_message; | 259 std::string error_message; |
| 258 event->GetString(constants::kErrorMessageKey, &error_message); | 260 event->GetString(constants::kErrorMessageKey, &error_message); |
| 259 controller->OnTtsEvent( | 261 controller->OnTtsEvent( |
| 260 utterance_id, TTS_EVENT_ERROR, char_index, error_message); | 262 utterance_id, TTS_EVENT_ERROR, char_index, error_message); |
| 261 } else { | 263 } else { |
| 262 EXTENSION_FUNCTION_VALIDATE(false); | 264 EXTENSION_FUNCTION_VALIDATE(false); |
| 263 } | 265 } |
| 264 | 266 |
| 265 return true; | 267 return true; |
| 266 } | 268 } |
| OLD | NEW |