OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/app_list/speech_ui_model.h" |
| 6 |
| 7 namespace app_list { |
| 8 |
| 9 SpeechUIModel::SpeechUIModel() {} |
| 10 |
| 11 SpeechUIModel::~SpeechUIModel() {} |
| 12 |
| 13 void SpeechUIModel::SetSpeechResult(const base::string16& result, |
| 14 bool is_final) { |
| 15 if (result_ == result && is_final_ == is_final) |
| 16 return; |
| 17 |
| 18 result_ = result; |
| 19 is_final_ = is_final; |
| 20 FOR_EACH_OBSERVER(SpeechUIModelObserver, |
| 21 observers_, |
| 22 OnSpeechResult(result, is_final)); |
| 23 } |
| 24 |
| 25 void SpeechUIModel::UpdateSoundLevel(int16 level) { |
| 26 if (sound_level_ == level) |
| 27 return; |
| 28 |
| 29 sound_level_ = level; |
| 30 FOR_EACH_OBSERVER(SpeechUIModelObserver, |
| 31 observers_, |
| 32 OnSpeechSoundLevelChanged(level)); |
| 33 } |
| 34 |
| 35 void SpeechUIModel::SetSpeechRecognitionState( |
| 36 SpeechRecognitionState new_state) { |
| 37 if (state_ == new_state) |
| 38 return; |
| 39 |
| 40 state_ = new_state; |
| 41 FOR_EACH_OBSERVER(SpeechUIModelObserver, |
| 42 observers_, |
| 43 OnSpeechRecognitionStateChanged(new_state)); |
| 44 } |
| 45 |
| 46 void SpeechUIModel::AddObserver(SpeechUIModelObserver* observer) { |
| 47 observers_.AddObserver(observer); |
| 48 } |
| 49 |
| 50 void SpeechUIModel::RemoveObserver(SpeechUIModelObserver* observer) { |
| 51 observers_.RemoveObserver(observer); |
| 52 } |
| 53 |
| 54 } // namespace app_list |
OLD | NEW |