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_api_controller.h" | 5 #include "chrome/browser/extensions/extension_tts_api_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/float_util.h" | 10 #include "base/float_util.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (char_index != kInvalidCharIndex) | 113 if (char_index != kInvalidCharIndex) |
114 event->SetInteger(constants::kCharIndexKey, char_index); | 114 event->SetInteger(constants::kCharIndexKey, char_index); |
115 event->SetString(constants::kEventTypeKey, event_type_string); | 115 event->SetString(constants::kEventTypeKey, event_type_string); |
116 if (event_type == TTS_EVENT_ERROR) { | 116 if (event_type == TTS_EVENT_ERROR) { |
117 event->SetString(constants::kErrorMessageKey, error_message); | 117 event->SetString(constants::kErrorMessageKey, error_message); |
118 } | 118 } |
119 event->SetInteger(constants::kSrcIdKey, src_id_); | 119 event->SetInteger(constants::kSrcIdKey, src_id_); |
120 event->SetBoolean(constants::kIsFinalEventKey, finished_); | 120 event->SetBoolean(constants::kIsFinalEventKey, finished_); |
121 args.Set(0, event); | 121 args.Set(0, event); |
122 std::string json_args; | 122 std::string json_args; |
123 base::JSONWriter::Write(&args, false, &json_args); | 123 base::JSONWriter::Write(&args, &json_args); |
124 | 124 |
125 profile_->GetExtensionEventRouter()->DispatchEventToExtension( | 125 profile_->GetExtensionEventRouter()->DispatchEventToExtension( |
126 src_extension_id_, | 126 src_extension_id_, |
127 events::kOnEvent, | 127 events::kOnEvent, |
128 json_args, | 128 json_args, |
129 profile_, | 129 profile_, |
130 src_url_); | 130 src_url_); |
131 } | 131 } |
132 | 132 |
133 void Utterance::Finish() { | 133 void Utterance::Finish() { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 int ExtensionTtsController::QueueSize() { | 328 int ExtensionTtsController::QueueSize() { |
329 return static_cast<int>(utterance_queue_.size()); | 329 return static_cast<int>(utterance_queue_.size()); |
330 } | 330 } |
331 | 331 |
332 ExtensionTtsPlatformImpl* ExtensionTtsController::GetPlatformImpl() { | 332 ExtensionTtsPlatformImpl* ExtensionTtsController::GetPlatformImpl() { |
333 if (!platform_impl_) | 333 if (!platform_impl_) |
334 platform_impl_ = ExtensionTtsPlatformImpl::GetInstance(); | 334 platform_impl_ = ExtensionTtsPlatformImpl::GetInstance(); |
335 return platform_impl_; | 335 return platform_impl_; |
336 } | 336 } |
OLD | NEW |