| 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/views/controls/button/menu_button_listener.h" | 11 #include "ui/views/controls/button/menu_button_listener.h" |
| 12 #include "ui/views/controls/textfield/textfield_controller.h" | 12 #include "ui/views/controls/textfield/textfield_controller.h" |
| 13 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 14 | 14 |
| 15 struct AvatarMenuItemModel; |
| 16 |
| 15 namespace views { | 17 namespace views { |
| 16 class ImageView; | 18 class ImageView; |
| 17 class MenuButton; | 19 class MenuButton; |
| 18 class Textfield; | 20 class Textfield; |
| 19 } // namespace views | 21 } // namespace views |
| 20 | 22 |
| 21 namespace app_list { | 23 namespace app_list { |
| 22 | 24 |
| 23 class AppListMenuViews; | 25 class AppListMenuViews; |
| 24 class AppListViewDelegate; | 26 class AppListViewDelegate; |
| 25 class SearchBoxModel; | 27 class AppListModel; |
| 26 class SearchBoxViewDelegate; | 28 class SearchBoxViewDelegate; |
| 27 | 29 |
| 28 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data | 30 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data |
| 29 // model that controls what icon to display, what placeholder text to use for | 31 // model that controls what icon to display, what placeholder text to use for |
| 30 // Textfield. The text and selection model part could be set to change the | 32 // Textfield. The text and selection model part could be set to change the |
| 31 // contents and selection model of the Textfield. | 33 // contents and selection model of the Textfield. |
| 32 class SearchBoxView : public views::View, | 34 class SearchBoxView : public views::View, |
| 33 public views::TextfieldController, | 35 public views::TextfieldController, |
| 34 public views::MenuButtonListener, | 36 public views::MenuButtonListener, |
| 35 public SearchBoxModelObserver { | 37 public SearchBoxModelObserver { |
| 36 public: | 38 public: |
| 37 SearchBoxView(SearchBoxViewDelegate* delegate, | 39 SearchBoxView(SearchBoxViewDelegate* delegate, |
| 38 AppListViewDelegate* view_delegate); | 40 AppListViewDelegate* view_delegate); |
| 39 virtual ~SearchBoxView(); | 41 virtual ~SearchBoxView(); |
| 40 | 42 |
| 41 void SetModel(SearchBoxModel* model); | 43 void SetModel(AppListModel* model); |
| 42 | 44 |
| 43 bool HasSearch() const; | 45 bool HasSearch() const; |
| 44 void ClearSearch(); | 46 void ClearSearch(); |
| 45 void InvalidateMenu(); | 47 void InvalidateMenu(); |
| 46 | 48 |
| 47 views::Textfield* search_box() { return search_box_; } | 49 views::Textfield* search_box() { return search_box_; } |
| 48 | 50 |
| 49 void set_contents_view(View* contents_view) { | 51 void set_contents_view(View* contents_view) { |
| 50 contents_view_ = contents_view; | 52 contents_view_ = contents_view; |
| 51 } | 53 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 73 const gfx::Point& point) OVERRIDE; | 75 const gfx::Point& point) OVERRIDE; |
| 74 | 76 |
| 75 // Overridden from SearchBoxModelObserver: | 77 // Overridden from SearchBoxModelObserver: |
| 76 virtual void IconChanged() OVERRIDE; | 78 virtual void IconChanged() OVERRIDE; |
| 77 virtual void HintTextChanged() OVERRIDE; | 79 virtual void HintTextChanged() OVERRIDE; |
| 78 virtual void SelectionModelChanged() OVERRIDE; | 80 virtual void SelectionModelChanged() OVERRIDE; |
| 79 virtual void TextChanged() OVERRIDE; | 81 virtual void TextChanged() OVERRIDE; |
| 80 | 82 |
| 81 SearchBoxViewDelegate* delegate_; // Not owned. | 83 SearchBoxViewDelegate* delegate_; // Not owned. |
| 82 AppListViewDelegate* view_delegate_; // Not owned. | 84 AppListViewDelegate* view_delegate_; // Not owned. |
| 83 SearchBoxModel* model_; // Owned by AppListModel. | 85 AppListModel* model_; // Not owned. |
| 84 | 86 |
| 85 scoped_ptr<AppListMenuViews> menu_; | 87 scoped_ptr<AppListMenuViews> menu_; |
| 86 | 88 |
| 87 views::ImageView* icon_view_; // Owned by views hierarchy. | 89 views::ImageView* icon_view_; // Owned by views hierarchy. |
| 88 views::MenuButton* menu_button_; // Owned by views hierarchy. | 90 views::MenuButton* menu_button_; // Owned by views hierarchy. |
| 89 views::Textfield* search_box_; // Owned by views hierarchy. | 91 views::Textfield* search_box_; // Owned by views hierarchy. |
| 90 views::View* contents_view_; // Owned by views hierarchy. | 92 views::View* contents_view_; // Owned by views hierarchy. |
| 91 | 93 |
| 92 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); | 94 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); |
| 93 }; | 95 }; |
| 94 | 96 |
| 95 } // namespace app_list | 97 } // namespace app_list |
| 96 | 98 |
| 97 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ | 99 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ |
| OLD | NEW |