Chromium Code Reviews| 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" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 enum SearchBoxFocus { | 28 enum SearchBoxFocus { |
| 29 FOCUS_BACK_BUTTON, // Back button, only responds to ENTER | 29 FOCUS_BACK_BUTTON, // Back button, only responds to ENTER |
| 30 FOCUS_SEARCH_BOX, // Nothing else has partial focus | 30 FOCUS_SEARCH_BOX, // Nothing else has partial focus |
| 31 FOCUS_MIC_BUTTON, // Mic button, only responds to ENTER | 31 FOCUS_MIC_BUTTON, // Mic button, only responds to ENTER |
| 32 FOCUS_CONTENTS_VIEW, // Something outside the SearchBox is selected | 32 FOCUS_CONTENTS_VIEW, // Something outside the SearchBox is selected |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class AppListMenuViews; | 35 class AppListMenuViews; |
| 36 class AppListModel; | 36 class AppListModel; |
| 37 class AppListViewDelegate; | 37 class AppListViewDelegate; |
| 38 class ContentsView; | |
| 38 class SearchBoxModel; | 39 class SearchBoxModel; |
| 39 class SearchBoxViewDelegate; | 40 class SearchBoxViewDelegate; |
| 40 class SearchBoxImageButton; | 41 class SearchBoxImageButton; |
| 41 | 42 |
| 42 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data | 43 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data |
| 43 // model that controls what icon to display, what placeholder text to use for | 44 // model that controls what icon to display, what placeholder text to use for |
| 44 // Textfield. The text and selection model part could be set to change the | 45 // Textfield. The text and selection model part could be set to change the |
| 45 // contents and selection model of the Textfield. | 46 // contents and selection model of the Textfield. |
| 46 class APP_LIST_EXPORT SearchBoxView : public views::View, | 47 class APP_LIST_EXPORT SearchBoxView : public views::View, |
| 47 public views::TextfieldController, | 48 public views::TextfieldController, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 63 void SetShadow(const gfx::ShadowValue& shadow); | 64 void SetShadow(const gfx::ShadowValue& shadow); |
| 64 | 65 |
| 65 // Returns the bounds to use for the view (including the shadow) given the | 66 // Returns the bounds to use for the view (including the shadow) given the |
| 66 // desired bounds of the search box contents. | 67 // desired bounds of the search box contents. |
| 67 gfx::Rect GetViewBoundsForSearchBoxContentsBounds( | 68 gfx::Rect GetViewBoundsForSearchBoxContentsBounds( |
| 68 const gfx::Rect& rect) const; | 69 const gfx::Rect& rect) const; |
| 69 | 70 |
| 70 views::ImageButton* back_button(); | 71 views::ImageButton* back_button(); |
| 71 views::Textfield* search_box() { return search_box_; } | 72 views::Textfield* search_box() { return search_box_; } |
| 72 | 73 |
| 73 void set_contents_view(views::View* contents_view) { | 74 void set_contents_view(ContentsView* contents_view) { |
|
calamity
2015/02/20 03:45:25
This will break tests.
Matt Giuca
2015/02/20 05:15:16
Fixed. (As discussed, we just have to use text.emp
| |
| 74 contents_view_ = contents_view; | 75 contents_view_ = contents_view; |
| 75 } | 76 } |
| 76 | 77 |
| 77 // Moves focus forward/backwards in response to TAB. | 78 // Moves focus forward/backwards in response to TAB. |
| 78 bool MoveTabFocus(bool move_backwards); | 79 bool MoveTabFocus(bool move_backwards); |
| 79 | 80 |
| 80 // Moves focus to contents or SearchBox and unselects buttons. | 81 // Moves focus to contents or SearchBox and unselects buttons. |
| 81 void ResetTabFocus(bool on_contents); | 82 void ResetTabFocus(bool on_contents); |
| 82 | 83 |
| 83 // Overridden from views::View: | 84 // Overridden from views::View: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 AppListModel* model_; // Owned by the profile-keyed service. | 121 AppListModel* model_; // Owned by the profile-keyed service. |
| 121 | 122 |
| 122 scoped_ptr<AppListMenuViews> menu_; | 123 scoped_ptr<AppListMenuViews> menu_; |
| 123 | 124 |
| 124 views::View* content_container_; // Owned by views hierarchy. | 125 views::View* content_container_; // Owned by views hierarchy. |
| 125 views::ImageView* icon_view_; // Owned by views hierarchy. | 126 views::ImageView* icon_view_; // Owned by views hierarchy. |
| 126 SearchBoxImageButton* back_button_; // Owned by views hierarchy. | 127 SearchBoxImageButton* back_button_; // Owned by views hierarchy. |
| 127 SearchBoxImageButton* speech_button_; // Owned by views hierarchy. | 128 SearchBoxImageButton* speech_button_; // Owned by views hierarchy. |
| 128 views::MenuButton* menu_button_; // Owned by views hierarchy. | 129 views::MenuButton* menu_button_; // Owned by views hierarchy. |
| 129 views::Textfield* search_box_; // Owned by views hierarchy. | 130 views::Textfield* search_box_; // Owned by views hierarchy. |
| 130 views::View* contents_view_; // Owned by views hierarchy. | 131 ContentsView* contents_view_; // Owned by views hierarchy. |
| 131 | 132 |
| 132 SearchBoxFocus focused_view_; // Which element has TAB'd focus. | 133 SearchBoxFocus focused_view_; // Which element has TAB'd focus. |
| 133 | 134 |
| 134 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); | 135 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 } // namespace app_list | 138 } // namespace app_list |
| 138 | 139 |
| 139 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ | 140 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ |
| OLD | NEW |