Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: ui/app_list/views/search_box_view.h

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: fix cros build Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 24 matching lines...) Expand all
35 class SearchBoxModel; 35 class SearchBoxModel;
36 class SearchBoxViewDelegate; 36 class SearchBoxViewDelegate;
37 class SearchBoxImageButton; 37 class SearchBoxImageButton;
38 38
39 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data 39 // 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 40 // 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 41 // Textfield. The text and selection model part could be set to change the
42 // contents and selection model of the Textfield. 42 // contents and selection model of the Textfield.
43 class APP_LIST_EXPORT SearchBoxView : public views::View, 43 class APP_LIST_EXPORT SearchBoxView : public views::View,
44 public views::TextfieldController, 44 public views::TextfieldController,
45 public views::ButtonListener, 45 public views::ImageButtonDelegate,
46 public SearchBoxModelObserver, 46 public SearchBoxModelObserver,
47 public SpeechUIModelObserver { 47 public SpeechUIModelObserver {
48 public: 48 public:
49 SearchBoxView(SearchBoxViewDelegate* delegate, 49 SearchBoxView(SearchBoxViewDelegate* delegate,
50 AppListViewDelegate* view_delegate); 50 AppListViewDelegate* view_delegate);
51 ~SearchBoxView() override; 51 ~SearchBoxView() override;
52 52
53 void ModelChanged(); 53 void ModelChanged();
54 bool HasSearch() const; 54 bool HasSearch() const;
55 void ClearSearch(); 55 void ClearSearch();
(...skipping 15 matching lines...) Expand all
71 71
72 // Moves focus forward/backwards in response to TAB. 72 // Moves focus forward/backwards in response to TAB.
73 bool MoveTabFocus(bool move_backwards); 73 bool MoveTabFocus(bool move_backwards);
74 74
75 // Moves focus to contents or SearchBox and unselects buttons. 75 // Moves focus to contents or SearchBox and unselects buttons.
76 void ResetTabFocus(bool on_contents); 76 void ResetTabFocus(bool on_contents);
77 77
78 // Sets voice label for Back button depending on whether a folder is open. 78 // Sets voice label for Back button depending on whether a folder is open.
79 void SetBackButtonLabel(bool folder); 79 void SetBackButtonLabel(bool folder);
80 80
81 // Overridden from views::View: 81 // views::View:
82 gfx::Size GetPreferredSize() const override; 82 gfx::Size GetPreferredSize() const override;
83 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; 83 bool OnMouseWheel(const ui::MouseWheelEvent& event) override;
84 void OnEnabledChanged() override; 84 void OnEnabledChanged() override;
85 85
86 private: 86 private:
87 // Updates model text and selection model with current Textfield info. 87 // Updates model text and selection model with current Textfield info.
88 void UpdateModel(); 88 void UpdateModel();
89 89
90 // Fires query change notification. 90 // Fires query change notification.
91 void NotifyQueryChanged(); 91 void NotifyQueryChanged();
92 92
93 // Overridden from views::TextfieldController: 93 // views::TextfieldController:
94 void ContentsChanged(views::Textfield* sender, 94 void ContentsChanged(views::Textfield* sender,
95 const base::string16& new_contents) override; 95 const base::string16& new_contents) override;
96 bool HandleKeyEvent(views::Textfield* sender, 96 bool HandleKeyEvent(views::Textfield* sender,
97 const ui::KeyEvent& key_event) override; 97 const ui::KeyEvent& key_event) override;
98 98
99 // Overridden from views::ButtonListener: 99 // views::ImageButtonDelegate:
100 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 100 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
101 101
102 // Overridden from SearchBoxModelObserver: 102 // SearchBoxModelObserver:
103 void SpeechRecognitionButtonPropChanged() override; 103 void SpeechRecognitionButtonPropChanged() override;
104 void HintTextChanged() override; 104 void HintTextChanged() override;
105 void SelectionModelChanged() override; 105 void SelectionModelChanged() override;
106 void TextChanged() override; 106 void TextChanged() override;
107 107
108 // Overridden from SpeechUIModelObserver: 108 // SpeechUIModelObserver:
109 void OnSpeechRecognitionStateChanged( 109 void OnSpeechRecognitionStateChanged(
110 SpeechRecognitionState new_state) override; 110 SpeechRecognitionState new_state) override;
111 111
112 SearchBoxViewDelegate* delegate_; // Not owned. 112 SearchBoxViewDelegate* delegate_; // Not owned.
113 AppListViewDelegate* view_delegate_; // Not owned. 113 AppListViewDelegate* view_delegate_; // Not owned.
114 AppListModel* model_; // Owned by the profile-keyed service. 114 AppListModel* model_; // Owned by the profile-keyed service.
115 115
116 views::View* content_container_; // Owned by views hierarchy. 116 views::View* content_container_; // Owned by views hierarchy.
117 SearchBoxImageButton* back_button_; // Owned by views hierarchy. 117 SearchBoxImageButton* back_button_; // Owned by views hierarchy.
118 SearchBoxImageButton* speech_button_; // Owned by views hierarchy. 118 SearchBoxImageButton* speech_button_; // Owned by views hierarchy.
119 views::Textfield* search_box_; // Owned by views hierarchy. 119 views::Textfield* search_box_; // Owned by views hierarchy.
120 views::View* contents_view_; // Owned by views hierarchy. 120 views::View* contents_view_; // Owned by views hierarchy.
121 121
122 SearchBoxFocus focused_view_; // Which element has TAB'd focus. 122 SearchBoxFocus focused_view_; // Which element has TAB'd focus.
123 123
124 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); 124 DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
125 }; 125 };
126 126
127 } // namespace app_list 127 } // namespace app_list
128 128
129 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ 129 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698