| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/arc/tts/arc_tts_service.h" | 5 #include "chrome/browser/chromeos/arc/tts/arc_tts_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/speech/tts_controller.h" | 8 #include "chrome/browser/speech/tts_controller.h" |
| 9 #include "components/arc/arc_bridge_service.h" | 9 #include "components/arc/arc_bridge_service.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 void ArcTtsService::OnInstanceReady() { | 22 void ArcTtsService::OnInstanceReady() { |
| 23 mojom::TtsInstance* tts_instance = | 23 mojom::TtsInstance* tts_instance = |
| 24 arc_bridge_service()->tts()->GetInstanceForMethod("Init"); | 24 arc_bridge_service()->tts()->GetInstanceForMethod("Init"); |
| 25 DCHECK(tts_instance); | 25 DCHECK(tts_instance); |
| 26 tts_instance->Init(binding_.CreateInterfacePtrAndBind()); | 26 tts_instance->Init(binding_.CreateInterfacePtrAndBind()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void ArcTtsService::OnTtsEvent(uint32_t id, | 29 void ArcTtsService::OnTtsEvent(uint32_t id, |
| 30 mojom::TtsEventType event_type, | 30 mojom::TtsEventType event_type, |
| 31 uint32_t char_index, | 31 uint32_t char_index, |
| 32 const mojo::String& error_msg) { | 32 const std::string& error_msg) { |
| 33 if (!TtsController::GetInstance()) | 33 if (!TtsController::GetInstance()) |
| 34 return; | 34 return; |
| 35 | 35 |
| 36 TtsEventType chrome_event_type; | 36 TtsEventType chrome_event_type; |
| 37 switch (event_type) { | 37 switch (event_type) { |
| 38 case mojom::TtsEventType::START: | 38 case mojom::TtsEventType::START: |
| 39 chrome_event_type = TTS_EVENT_START; | 39 chrome_event_type = TTS_EVENT_START; |
| 40 break; | 40 break; |
| 41 case mojom::TtsEventType::END: | 41 case mojom::TtsEventType::END: |
| 42 chrome_event_type = TTS_EVENT_END; | 42 chrome_event_type = TTS_EVENT_END; |
| 43 break; | 43 break; |
| 44 case mojom::TtsEventType::INTERRUPTED: | 44 case mojom::TtsEventType::INTERRUPTED: |
| 45 chrome_event_type = TTS_EVENT_INTERRUPTED; | 45 chrome_event_type = TTS_EVENT_INTERRUPTED; |
| 46 break; | 46 break; |
| 47 case mojom::TtsEventType::ERROR: | 47 case mojom::TtsEventType::ERROR: |
| 48 chrome_event_type = TTS_EVENT_ERROR; | 48 chrome_event_type = TTS_EVENT_ERROR; |
| 49 break; | 49 break; |
| 50 } | 50 } |
| 51 TtsController::GetInstance()->OnTtsEvent(id, chrome_event_type, char_index, | 51 TtsController::GetInstance()->OnTtsEvent(id, chrome_event_type, char_index, |
| 52 error_msg); | 52 error_msg); |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace arc | 55 } // namespace arc |
| OLD | NEW |