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.
5 #ifndef UI_APP_LIST_SPEECH_UI_MODEL_H_
6 #define UI_APP_LIST_SPEECH_UI_MODEL_H_
8 #include "base/basictypes.h"
9 #include "base/observer_list.h"
10 #include "base/strings/string16.h"
11 #include "ui/app_list/app_list_export.h"
12 #include "ui/app_list/speech_ui_model_observer.h"
16 // SpeechUIModel provides the interface to update the UI for speech recognition.
17 class APP_LIST_EXPORT SpeechUIModel
{
20 virtual ~SpeechUIModel();
22 void SetSpeechResult(const base::string16
& result
, bool is_final
);
23 void UpdateSoundLevel(int16 level
);
24 void SetSpeechRecognitionState(SpeechRecognitionState new_state
);
26 void AddObserver(SpeechUIModelObserver
* observer
);
27 void RemoveObserver(SpeechUIModelObserver
* observer
);
29 const base::string16
& result() const { return result_
; }
30 bool is_final() const { return is_final_
; }
31 int16
sound_level() const { return sound_level_
; }
32 SpeechRecognitionState
state() const { return state_
; }
35 base::string16 result_
;
38 SpeechRecognitionState state_
;
40 // The sound level range to compute visible sound-level.
41 int16 minimum_sound_level_
;
42 int16 maximum_sound_level_
;
44 ObserverList
<SpeechUIModelObserver
> observers_
;
46 DISALLOW_COPY_AND_ASSIGN(SpeechUIModel
);
49 } // namespace app_list
51 #endif // UI_APP_LIST_SPEECH_UI_MODEL_H_