OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/app_list/speech_ui_model.h" | 5 #include "ui/app_list/speech_ui_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 namespace app_list { | 9 namespace app_list { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 // The default sound level, just gotten from the developer device. | 13 // The default sound level, just gotten from the developer device. |
14 const int16 kDefaultSoundLevel = 200; | 14 const int16 kDefaultSoundLevel = 200; |
15 | 15 |
16 } // namespace | 16 } // namespace |
17 | 17 |
18 SpeechUIModel::SpeechUIModel(SpeechRecognitionState initial_state) | 18 SpeechUIModel::SpeechUIModel() |
19 : state_(initial_state), | 19 : is_final_(false), |
| 20 sound_level_(0), |
| 21 state_(app_list::SPEECH_RECOGNITION_OFF), |
20 minimum_sound_level_(kDefaultSoundLevel), | 22 minimum_sound_level_(kDefaultSoundLevel), |
21 maximum_sound_level_(kDefaultSoundLevel) {} | 23 maximum_sound_level_(kDefaultSoundLevel) { |
| 24 } |
22 | 25 |
23 SpeechUIModel::~SpeechUIModel() {} | 26 SpeechUIModel::~SpeechUIModel() {} |
24 | 27 |
25 void SpeechUIModel::SetSpeechResult(const base::string16& result, | 28 void SpeechUIModel::SetSpeechResult(const base::string16& result, |
26 bool is_final) { | 29 bool is_final) { |
27 if (result_ == result && is_final_ == is_final) | 30 if (result_ == result && is_final_ == is_final) |
28 return; | 31 return; |
29 | 32 |
30 result_ = result; | 33 result_ = result; |
31 is_final_ = is_final; | 34 is_final_ = is_final; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 93 |
91 void SpeechUIModel::AddObserver(SpeechUIModelObserver* observer) { | 94 void SpeechUIModel::AddObserver(SpeechUIModelObserver* observer) { |
92 observers_.AddObserver(observer); | 95 observers_.AddObserver(observer); |
93 } | 96 } |
94 | 97 |
95 void SpeechUIModel::RemoveObserver(SpeechUIModelObserver* observer) { | 98 void SpeechUIModel::RemoveObserver(SpeechUIModelObserver* observer) { |
96 observers_.RemoveObserver(observer); | 99 observers_.RemoveObserver(observer); |
97 } | 100 } |
98 | 101 |
99 } // namespace app_list | 102 } // namespace app_list |
OLD | NEW |