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_VIEWS_SPEECH_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_SPEECH_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_SPEECH_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_SPEECH_VIEW_H_ |
7 | 7 |
| 8 #include "ui/app_list/app_list_export.h" |
8 #include "ui/app_list/speech_ui_model_observer.h" | 9 #include "ui/app_list/speech_ui_model_observer.h" |
9 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
10 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
11 | 12 |
12 namespace views { | 13 namespace views { |
13 class BoundsAnimator; | 14 class BoundsAnimator; |
14 class ImageButton; | 15 class ImageButton; |
15 class ImageView; | 16 class ImageView; |
16 class Label; | 17 class Label; |
17 } | 18 } |
18 | 19 |
19 namespace app_list { | 20 namespace app_list { |
20 | 21 |
21 class AppListViewDelegate; | 22 class AppListViewDelegate; |
22 class SpeechCardView; | 23 class SpeechCardView; |
23 | 24 |
24 // SpeechView provides the card-like UI for the search-by-speech. | 25 // SpeechView provides the card-like UI for the search-by-speech. |
25 class SpeechView : public views::View, | 26 class APP_LIST_EXPORT SpeechView : public views::View, |
26 public views::ButtonListener, | 27 public views::ButtonListener, |
27 public SpeechUIModelObserver { | 28 public SpeechUIModelObserver { |
28 public: | 29 public: |
29 explicit SpeechView(AppListViewDelegate* delegate); | 30 explicit SpeechView(AppListViewDelegate* delegate); |
30 virtual ~SpeechView(); | 31 virtual ~SpeechView(); |
31 | 32 |
32 // Reset to the original state. | 33 // Reset to the original state. |
33 void Reset(); | 34 void Reset(); |
34 | 35 |
35 // Overridden from views::View: | 36 // Overridden from views::View: |
36 virtual void Layout() OVERRIDE; | 37 virtual void Layout() OVERRIDE; |
37 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 38 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
38 | 39 |
| 40 views::ImageButton* mic_button() { return mic_button_; } |
| 41 |
39 private: | 42 private: |
40 int GetIndicatorRadius(uint8 level); | 43 int GetIndicatorRadius(uint8 level); |
41 | 44 |
42 // Overridden from views::ButtonListener: | 45 // Overridden from views::ButtonListener: |
43 virtual void ButtonPressed(views::Button* sender, | 46 virtual void ButtonPressed(views::Button* sender, |
44 const ui::Event& event) OVERRIDE; | 47 const ui::Event& event) OVERRIDE; |
45 | 48 |
46 // Overridden from SpeechUIModelObserver: | 49 // Overridden from SpeechUIModelObserver: |
47 virtual void OnSpeechSoundLevelChanged(uint8 level) OVERRIDE; | 50 virtual void OnSpeechSoundLevelChanged(uint8 level) OVERRIDE; |
48 virtual void OnSpeechResult(const base::string16& result, | 51 virtual void OnSpeechResult(const base::string16& result, |
49 bool is_final) OVERRIDE; | 52 bool is_final) OVERRIDE; |
50 virtual void OnSpeechRecognitionStateChanged( | 53 virtual void OnSpeechRecognitionStateChanged( |
51 SpeechRecognitionState new_state) OVERRIDE; | 54 SpeechRecognitionState new_state) OVERRIDE; |
52 | 55 |
53 AppListViewDelegate* delegate_; | 56 AppListViewDelegate* delegate_; |
54 | 57 |
55 views::ImageView* logo_; | 58 views::ImageView* logo_; |
56 views::View* indicator_; | 59 views::View* indicator_; |
57 views::ImageButton* mic_button_; | 60 views::ImageButton* mic_button_; |
58 views::Label* speech_result_; | 61 views::Label* speech_result_; |
59 scoped_ptr<views::BoundsAnimator> indicator_animator_; | 62 scoped_ptr<views::BoundsAnimator> indicator_animator_; |
60 | 63 |
61 DISALLOW_COPY_AND_ASSIGN(SpeechView); | 64 DISALLOW_COPY_AND_ASSIGN(SpeechView); |
62 }; | 65 }; |
63 | 66 |
64 } // namespace app_list | 67 } // namespace app_list |
65 | 68 |
66 #endif // UI_APP_LIST_VIEWS_SPEECH_VIEW_H_ | 69 #endif // UI_APP_LIST_VIEWS_SPEECH_VIEW_H_ |
OLD | NEW |