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_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/app_list_export.h" |
| 9 #include "ui/app_list/speech_ui_model_observer.h" | 9 #include "ui/app_list/speech_ui_model_observer.h" |
| 10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
| 11 #include "ui/views/controls/button/image_button.h" | |
| 12 #include "ui/views/masked_targeter_delegate.h" | |
| 11 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 12 | 14 |
| 13 namespace views { | 15 namespace views { |
| 14 class BoundsAnimator; | 16 class BoundsAnimator; |
| 15 class ImageButton; | |
| 16 class ImageView; | 17 class ImageView; |
| 17 class Label; | 18 class Label; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace app_list { | 21 namespace app_list { |
| 21 | 22 |
| 22 class AppListViewDelegate; | 23 class AppListViewDelegate; |
| 23 class SpeechCardView; | 24 class SpeechCardView; |
| 24 | 25 |
| 26 // MicButton is an image button with circular hit area. | |
| 27 class APP_LIST_EXPORT MicButton : public views::ImageButton, | |
|
sky
2014/07/09 19:26:04
I would keep this in the .cc. That way it's clear
tdanderson
2014/07/09 20:05:11
Done. Moving it back into the .cc requires me to u
| |
| 28 public views::MaskedTargeterDelegate { | |
| 29 public: | |
| 30 explicit MicButton(views::ButtonListener* listener); | |
| 31 virtual ~MicButton(); | |
| 32 | |
| 33 private: | |
| 34 // views::MaskedTargeterDelegate: | |
| 35 virtual bool GetHitTestMask(gfx::Path* mask) const OVERRIDE; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(MicButton); | |
| 38 }; | |
| 39 | |
| 25 // SpeechView provides the card-like UI for the search-by-speech. | 40 // SpeechView provides the card-like UI for the search-by-speech. |
| 26 class APP_LIST_EXPORT SpeechView : public views::View, | 41 class APP_LIST_EXPORT SpeechView : public views::View, |
| 27 public views::ButtonListener, | 42 public views::ButtonListener, |
| 28 public SpeechUIModelObserver { | 43 public SpeechUIModelObserver { |
| 29 public: | 44 public: |
| 30 explicit SpeechView(AppListViewDelegate* delegate); | 45 explicit SpeechView(AppListViewDelegate* delegate); |
| 31 virtual ~SpeechView(); | 46 virtual ~SpeechView(); |
| 32 | 47 |
| 33 // Reset to the original state. | 48 // Reset to the original state. |
| 34 void Reset(); | 49 void Reset(); |
| 35 | 50 |
| 36 // Overridden from views::View: | 51 // Overridden from views::View: |
| 37 virtual void Layout() OVERRIDE; | 52 virtual void Layout() OVERRIDE; |
| 38 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 53 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
| 39 | 54 |
| 40 views::ImageButton* mic_button() { return mic_button_; } | 55 MicButton* mic_button() { return mic_button_; } |
| 41 | 56 |
| 42 private: | 57 private: |
| 43 int GetIndicatorRadius(uint8 level); | 58 int GetIndicatorRadius(uint8 level); |
| 44 | 59 |
| 45 // Overridden from views::ButtonListener: | 60 // Overridden from views::ButtonListener: |
| 46 virtual void ButtonPressed(views::Button* sender, | 61 virtual void ButtonPressed(views::Button* sender, |
| 47 const ui::Event& event) OVERRIDE; | 62 const ui::Event& event) OVERRIDE; |
| 48 | 63 |
| 49 // Overridden from SpeechUIModelObserver: | 64 // Overridden from SpeechUIModelObserver: |
| 50 virtual void OnSpeechSoundLevelChanged(uint8 level) OVERRIDE; | 65 virtual void OnSpeechSoundLevelChanged(uint8 level) OVERRIDE; |
| 51 virtual void OnSpeechResult(const base::string16& result, | 66 virtual void OnSpeechResult(const base::string16& result, |
| 52 bool is_final) OVERRIDE; | 67 bool is_final) OVERRIDE; |
| 53 virtual void OnSpeechRecognitionStateChanged( | 68 virtual void OnSpeechRecognitionStateChanged( |
| 54 SpeechRecognitionState new_state) OVERRIDE; | 69 SpeechRecognitionState new_state) OVERRIDE; |
| 55 | 70 |
| 56 AppListViewDelegate* delegate_; | 71 AppListViewDelegate* delegate_; |
| 57 | 72 |
| 58 views::ImageView* logo_; | 73 views::ImageView* logo_; |
| 59 views::View* indicator_; | 74 views::View* indicator_; |
| 60 views::ImageButton* mic_button_; | 75 MicButton* mic_button_; |
| 61 views::Label* speech_result_; | 76 views::Label* speech_result_; |
| 62 scoped_ptr<views::BoundsAnimator> indicator_animator_; | 77 scoped_ptr<views::BoundsAnimator> indicator_animator_; |
| 63 | 78 |
| 64 DISALLOW_COPY_AND_ASSIGN(SpeechView); | 79 DISALLOW_COPY_AND_ASSIGN(SpeechView); |
| 65 }; | 80 }; |
| 66 | 81 |
| 67 } // namespace app_list | 82 } // namespace app_list |
| 68 | 83 |
| 69 #endif // UI_APP_LIST_VIEWS_SPEECH_VIEW_H_ | 84 #endif // UI_APP_LIST_VIEWS_SPEECH_VIEW_H_ |
| OLD | NEW |