| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SEARCH_BOX_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ |
| 6 #define UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ui/app_list/search_box_model_observer.h" | 10 #include "ui/app_list/search_box_model_observer.h" |
| 11 #include "ui/app_list/speech_ui_model_observer.h" |
| 11 #include "ui/views/controls/button/image_button.h" | 12 #include "ui/views/controls/button/image_button.h" |
| 12 #include "ui/views/controls/button/menu_button_listener.h" | 13 #include "ui/views/controls/button/menu_button_listener.h" |
| 13 #include "ui/views/controls/textfield/textfield_controller.h" | 14 #include "ui/views/controls/textfield/textfield_controller.h" |
| 14 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 class ImageView; | 18 class ImageView; |
| 18 class MenuButton; | 19 class MenuButton; |
| 19 class Textfield; | 20 class Textfield; |
| 20 } // namespace views | 21 } // namespace views |
| 21 | 22 |
| 22 namespace app_list { | 23 namespace app_list { |
| 23 | 24 |
| 24 class AppListMenuViews; | 25 class AppListMenuViews; |
| 25 class AppListModel; | 26 class AppListModel; |
| 26 class AppListViewDelegate; | 27 class AppListViewDelegate; |
| 27 class ContentsView; | 28 class ContentsView; |
| 28 class SearchBoxModel; | 29 class SearchBoxModel; |
| 29 class SearchBoxViewDelegate; | 30 class SearchBoxViewDelegate; |
| 30 | 31 |
| 31 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data | 32 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data |
| 32 // model that controls what icon to display, what placeholder text to use for | 33 // model that controls what icon to display, what placeholder text to use for |
| 33 // Textfield. The text and selection model part could be set to change the | 34 // Textfield. The text and selection model part could be set to change the |
| 34 // contents and selection model of the Textfield. | 35 // contents and selection model of the Textfield. |
| 35 class SearchBoxView : public views::View, | 36 class SearchBoxView : public views::View, |
| 36 public views::TextfieldController, | 37 public views::TextfieldController, |
| 37 public views::ButtonListener, | 38 public views::ButtonListener, |
| 38 public views::MenuButtonListener, | 39 public views::MenuButtonListener, |
| 39 public SearchBoxModelObserver { | 40 public SearchBoxModelObserver, |
| 41 public SpeechUIModelObserver { |
| 40 public: | 42 public: |
| 41 SearchBoxView(SearchBoxViewDelegate* delegate, | 43 SearchBoxView(SearchBoxViewDelegate* delegate, |
| 42 AppListViewDelegate* view_delegate); | 44 AppListViewDelegate* view_delegate); |
| 43 virtual ~SearchBoxView(); | 45 virtual ~SearchBoxView(); |
| 44 | 46 |
| 45 void ModelChanged(); | 47 void ModelChanged(); |
| 46 bool HasSearch() const; | 48 bool HasSearch() const; |
| 47 void ClearSearch(); | 49 void ClearSearch(); |
| 48 void InvalidateMenu(); | 50 void InvalidateMenu(); |
| 49 | 51 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 79 virtual void OnMenuButtonClicked(View* source, | 81 virtual void OnMenuButtonClicked(View* source, |
| 80 const gfx::Point& point) OVERRIDE; | 82 const gfx::Point& point) OVERRIDE; |
| 81 | 83 |
| 82 // Overridden from SearchBoxModelObserver: | 84 // Overridden from SearchBoxModelObserver: |
| 83 virtual void IconChanged() OVERRIDE; | 85 virtual void IconChanged() OVERRIDE; |
| 84 virtual void SpeechRecognitionButtonPropChanged() OVERRIDE; | 86 virtual void SpeechRecognitionButtonPropChanged() OVERRIDE; |
| 85 virtual void HintTextChanged() OVERRIDE; | 87 virtual void HintTextChanged() OVERRIDE; |
| 86 virtual void SelectionModelChanged() OVERRIDE; | 88 virtual void SelectionModelChanged() OVERRIDE; |
| 87 virtual void TextChanged() OVERRIDE; | 89 virtual void TextChanged() OVERRIDE; |
| 88 | 90 |
| 91 // Overridden from SpeechUIModelObserver: |
| 92 virtual void OnSpeechRecognitionStateChanged( |
| 93 SpeechRecognitionState new_state) OVERRIDE; |
| 94 |
| 89 SearchBoxViewDelegate* delegate_; // Not owned. | 95 SearchBoxViewDelegate* delegate_; // Not owned. |
| 90 AppListViewDelegate* view_delegate_; // Not owned. | 96 AppListViewDelegate* view_delegate_; // Not owned. |
| 91 AppListModel* model_; // Owned by the profile-keyed service. | 97 AppListModel* model_; // Owned by the profile-keyed service. |
| 92 | 98 |
| 93 scoped_ptr<AppListMenuViews> menu_; | 99 scoped_ptr<AppListMenuViews> menu_; |
| 94 | 100 |
| 95 views::ImageView* icon_view_; // Owned by views hierarchy. | 101 views::ImageView* icon_view_; // Owned by views hierarchy. |
| 96 views::ImageButton* speech_button_; // Owned by views hierarchy. | 102 views::ImageButton* speech_button_; // Owned by views hierarchy. |
| 97 views::MenuButton* menu_button_; // Owned by views hierarchy. | 103 views::MenuButton* menu_button_; // Owned by views hierarchy. |
| 98 views::Textfield* search_box_; // Owned by views hierarchy. | 104 views::Textfield* search_box_; // Owned by views hierarchy. |
| 99 ContentsView* contents_view_; // Owned by views hierarchy. | 105 ContentsView* contents_view_; // Owned by views hierarchy. |
| 100 | 106 |
| 101 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); | 107 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); |
| 102 }; | 108 }; |
| 103 | 109 |
| 104 } // namespace app_list | 110 } // namespace app_list |
| 105 | 111 |
| 106 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ | 112 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ |
| OLD | NEW |