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