Chromium Code Reviews| 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 #ifndef UI_APP_LIST_SPEECH_UI_MODEL_H_ | 5 #ifndef UI_APP_LIST_SPEECH_UI_MODEL_H_ |
| 6 #define UI_APP_LIST_SPEECH_UI_MODEL_H_ | 6 #define UI_APP_LIST_SPEECH_UI_MODEL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "ui/app_list/app_list_export.h" | 11 #include "ui/app_list/app_list_export.h" |
| 12 #include "ui/app_list/speech_ui_model_observer.h" | 12 #include "ui/app_list/speech_ui_model_observer.h" |
| 13 #include "ui/gfx/image/image_skia.h" | |
| 13 | 14 |
| 14 namespace app_list { | 15 namespace app_list { |
| 15 | 16 |
| 16 // SpeechUIModel provides the interface to update the UI for speech recognition. | 17 // SpeechUIModel provides the interface to update the UI for speech recognition. |
| 17 class APP_LIST_EXPORT SpeechUIModel { | 18 class APP_LIST_EXPORT SpeechUIModel { |
| 18 public: | 19 public: |
| 19 explicit SpeechUIModel(SpeechRecognitionState initial_state); | 20 explicit SpeechUIModel(SpeechRecognitionState initial_state); |
| 20 virtual ~SpeechUIModel(); | 21 virtual ~SpeechUIModel(); |
| 21 | 22 |
| 22 void SetSpeechResult(const base::string16& result, bool is_final); | 23 void SetSpeechResult(const base::string16& result, bool is_final); |
| 23 void UpdateSoundLevel(int16 level); | 24 void UpdateSoundLevel(int16 level); |
| 24 void SetSpeechRecognitionState(SpeechRecognitionState new_state); | 25 void SetSpeechRecognitionState(SpeechRecognitionState new_state); |
| 25 | 26 |
| 26 void AddObserver(SpeechUIModelObserver* observer); | 27 void AddObserver(SpeechUIModelObserver* observer); |
| 27 void RemoveObserver(SpeechUIModelObserver* observer); | 28 void RemoveObserver(SpeechUIModelObserver* observer); |
| 28 | 29 |
| 29 const base::string16& result() const { return result_; } | 30 const base::string16& result() const { return result_; } |
| 30 bool is_final() const { return is_final_; } | 31 bool is_final() const { return is_final_; } |
| 31 int16 sound_level() const { return sound_level_; } | 32 int16 sound_level() const { return sound_level_; } |
| 32 SpeechRecognitionState state() const { return state_; } | 33 SpeechRecognitionState state() const { return state_; } |
| 34 const gfx::ImageSkia& logo() const { return logo_; } | |
| 35 void set_logo(const gfx::ImageSkia& logo) { logo_ = logo; } | |
|
oshima
2014/02/06 01:05:41
do you really need this in model? Isn't it simpler
Jun Mukai
2014/02/06 01:10:14
SpeechView is in ui/app_list which can't depend on
| |
| 33 | 36 |
| 34 private: | 37 private: |
| 35 base::string16 result_; | 38 base::string16 result_; |
| 36 bool is_final_; | 39 bool is_final_; |
| 37 int16 sound_level_; | 40 int16 sound_level_; |
| 38 SpeechRecognitionState state_; | 41 SpeechRecognitionState state_; |
| 39 | 42 |
| 43 // The logo image which the speech UI will show at the top-left. | |
| 44 gfx::ImageSkia logo_; | |
| 45 | |
| 40 // The sound level range to compute visible sound-level. | 46 // The sound level range to compute visible sound-level. |
| 41 int16 minimum_sound_level_; | 47 int16 minimum_sound_level_; |
| 42 int16 maximum_sound_level_; | 48 int16 maximum_sound_level_; |
| 43 | 49 |
| 44 ObserverList<SpeechUIModelObserver> observers_; | 50 ObserverList<SpeechUIModelObserver> observers_; |
| 45 | 51 |
| 46 DISALLOW_COPY_AND_ASSIGN(SpeechUIModel); | 52 DISALLOW_COPY_AND_ASSIGN(SpeechUIModel); |
| 47 }; | 53 }; |
| 48 | 54 |
| 49 } // namespace app_list | 55 } // namespace app_list |
| 50 | 56 |
| 51 #endif // UI_APP_LIST_SPEECH_UI_MODEL_H_ | 57 #endif // UI_APP_LIST_SPEECH_UI_MODEL_H_ |
| OLD | NEW |