OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_controller_impl.h" | 5 #include "chrome/browser/speech/tts_controller_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/speech/tts_platform.h" | 12 #include "chrome/browser/speech/tts_platform.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 // A value to be used to indicate that there is no char index available. | 15 // A value to be used to indicate that there is no char index available. |
16 const int kInvalidCharIndex = -1; | 16 const int kInvalidCharIndex = -1; |
17 | 17 |
18 // Given a language/region code of the form 'fr-FR', returns just the basic | 18 // Given a language/region code of the form 'fr-FR', returns just the basic |
19 // language portion, e.g. 'fr'. | 19 // language portion, e.g. 'fr'. |
20 std::string TrimLanguageCode(std::string lang) { | 20 std::string TrimLanguageCode(const std::string& lang) { |
21 if (lang.size() >= 5 && lang[2] == '-') | 21 if (lang.size() >= 5 && lang[2] == '-') |
22 return lang.substr(0, 2); | 22 return lang.substr(0, 2); |
23 else | 23 else |
24 return lang; | 24 return lang; |
25 } | 25 } |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 bool IsFinalTtsEventType(TtsEventType event_type) { | 29 bool IsFinalTtsEventType(TtsEventType event_type) { |
30 return (event_type == TTS_EVENT_END || | 30 return (event_type == TTS_EVENT_END || |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 } | 481 } |
482 | 482 |
483 void TtsControllerImpl::SetTtsEngineDelegate( | 483 void TtsControllerImpl::SetTtsEngineDelegate( |
484 TtsEngineDelegate* delegate) { | 484 TtsEngineDelegate* delegate) { |
485 tts_engine_delegate_ = delegate; | 485 tts_engine_delegate_ = delegate; |
486 } | 486 } |
487 | 487 |
488 TtsEngineDelegate* TtsControllerImpl::GetTtsEngineDelegate() { | 488 TtsEngineDelegate* TtsControllerImpl::GetTtsEngineDelegate() { |
489 return tts_engine_delegate_; | 489 return tts_engine_delegate_; |
490 } | 490 } |
OLD | NEW |