| 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 "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Possible locations for partial keyboard focus (but note that the search | 24 // Possible locations for partial keyboard focus (but note that the search |
| 25 // box always handles typing). | 25 // box always handles typing). |
| 26 enum SearchBoxFocus { | 26 enum SearchBoxFocus { |
| 27 FOCUS_BACK_BUTTON, // Back button, only responds to ENTER | 27 FOCUS_BACK_BUTTON, // Back button, only responds to ENTER |
| 28 FOCUS_SEARCH_BOX, // Nothing else has partial focus | 28 FOCUS_SEARCH_BOX, // Nothing else has partial focus |
| 29 FOCUS_MIC_BUTTON, // Mic button, only responds to ENTER | 29 FOCUS_MIC_BUTTON, // Mic button, only responds to ENTER |
| 30 FOCUS_CONTENTS_VIEW, // Something outside the SearchBox is selected | 30 FOCUS_CONTENTS_VIEW, // Something outside the SearchBox is selected |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 class AppListModel; | 33 class AppListModel; |
| 34 class AppListView; |
| 34 class AppListViewDelegate; | 35 class AppListViewDelegate; |
| 35 class SearchBoxModel; | 36 class SearchBoxModel; |
| 36 class SearchBoxViewDelegate; | 37 class SearchBoxViewDelegate; |
| 37 class SearchBoxImageButton; | 38 class SearchBoxImageButton; |
| 38 | 39 |
| 39 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data | 40 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data |
| 40 // model that controls what icon to display, what placeholder text to use for | 41 // model that controls what icon to display, what placeholder text to use for |
| 41 // Textfield. The text and selection model part could be set to change the | 42 // Textfield. The text and selection model part could be set to change the |
| 42 // contents and selection model of the Textfield. | 43 // contents and selection model of the Textfield. |
| 43 class APP_LIST_EXPORT SearchBoxView : public views::View, | 44 class APP_LIST_EXPORT SearchBoxView : public views::View, |
| 44 public views::TextfieldController, | 45 public views::TextfieldController, |
| 45 public views::ButtonListener, | 46 public views::ButtonListener, |
| 46 public SearchBoxModelObserver, | 47 public SearchBoxModelObserver, |
| 47 public SpeechUIModelObserver { | 48 public SpeechUIModelObserver { |
| 48 public: | 49 public: |
| 49 SearchBoxView(SearchBoxViewDelegate* delegate, | 50 SearchBoxView(SearchBoxViewDelegate* delegate, |
| 50 AppListViewDelegate* view_delegate); | 51 AppListViewDelegate* view_delegate, |
| 52 AppListView* app_list_view = nullptr); |
| 51 ~SearchBoxView() override; | 53 ~SearchBoxView() override; |
| 52 | 54 |
| 53 void ModelChanged(); | 55 void ModelChanged(); |
| 54 bool HasSearch() const; | 56 bool HasSearch() const; |
| 55 void ClearSearch(); | 57 void ClearSearch(); |
| 56 | 58 |
| 57 // Sets the shadow border of the search box. | 59 // Sets the shadow border of the search box. |
| 58 void SetShadow(const gfx::ShadowValue& shadow); | 60 void SetShadow(const gfx::ShadowValue& shadow); |
| 59 | 61 |
| 60 // Returns the bounds to use for the view (including the shadow) given the | 62 // Returns the bounds to use for the view (including the shadow) given the |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 113 |
| 112 SearchBoxViewDelegate* delegate_; // Not owned. | 114 SearchBoxViewDelegate* delegate_; // Not owned. |
| 113 AppListViewDelegate* view_delegate_; // Not owned. | 115 AppListViewDelegate* view_delegate_; // Not owned. |
| 114 AppListModel* model_; // Owned by the profile-keyed service. | 116 AppListModel* model_; // Owned by the profile-keyed service. |
| 115 | 117 |
| 116 views::View* content_container_; // Owned by views hierarchy. | 118 views::View* content_container_; // Owned by views hierarchy. |
| 117 SearchBoxImageButton* back_button_; // Owned by views hierarchy. | 119 SearchBoxImageButton* back_button_; // Owned by views hierarchy. |
| 118 SearchBoxImageButton* speech_button_; // Owned by views hierarchy. | 120 SearchBoxImageButton* speech_button_; // Owned by views hierarchy. |
| 119 views::Textfield* search_box_; // Owned by views hierarchy. | 121 views::Textfield* search_box_; // Owned by views hierarchy. |
| 120 views::View* contents_view_; // Owned by views hierarchy. | 122 views::View* contents_view_; // Owned by views hierarchy. |
| 123 app_list::AppListView* app_list_view_; // Owned by views hierarchy. |
| 124 |
| 125 const bool is_fullscreen_enabled_; |
| 121 | 126 |
| 122 SearchBoxFocus focused_view_; // Which element has TAB'd focus. | 127 SearchBoxFocus focused_view_; // Which element has TAB'd focus. |
| 123 | 128 |
| 124 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); | 129 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); |
| 125 }; | 130 }; |
| 126 | 131 |
| 127 } // namespace app_list | 132 } // namespace app_list |
| 128 | 133 |
| 129 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ | 134 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ |
| OLD | NEW |