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

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

Issue 2952763002: SearchBoxView now enables/disables cursor based on user interaction. (Closed)
Patch Set: SearchBoxView now enables/disables cursor based on user interaction. Created 3 years, 5 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 // Moves focus forward/backwards in response to TAB. 75 // Moves focus forward/backwards in response to TAB.
76 bool MoveTabFocus(bool move_backwards); 76 bool MoveTabFocus(bool move_backwards);
77 77
78 // Moves focus to contents or SearchBox and unselects buttons. 78 // Moves focus to contents or SearchBox and unselects buttons.
79 void ResetTabFocus(bool on_contents); 79 void ResetTabFocus(bool on_contents);
80 80
81 // Sets voice label for Back button depending on whether a folder is open. 81 // Sets voice label for Back button depending on whether a folder is open.
82 void SetBackButtonLabel(bool folder); 82 void SetBackButtonLabel(bool folder);
83 83
84 // Whether the search box is active.
85 bool is_search_box_active() const { return is_search_box_active_; }
86
87 // Setting the search box active left aligns the placeholder text, changes
88 // the color of the placeholder text, and enables cursor blink. Setting the
89 // search box inactive center aligns the placeholder text, sets the color, and
90 // disables cursor blink.
91 void SetSearchBoxActive(bool active);
92
84 // Overridden from views::View: 93 // Overridden from views::View:
85 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; 94 bool OnMouseWheel(const ui::MouseWheelEvent& event) override;
86 void OnEnabledChanged() override; 95 void OnEnabledChanged() override;
87 const char* GetClassName() const override; 96 const char* GetClassName() const override;
97 void OnGestureEvent(ui::GestureEvent* event) override;
98 void OnMouseEvent(ui::MouseEvent* event) override;
88 99
89 private: 100 private:
90 // Updates model text and selection model with current Textfield info. 101 // Updates model text and selection model with current Textfield info.
91 void UpdateModel(); 102 void UpdateModel();
92 103
93 // Fires query change notification. 104 // Fires query change notification.
94 void NotifyQueryChanged(); 105 void NotifyQueryChanged();
95 106
96 // Overridden from views::TextfieldController: 107 // Overridden from views::TextfieldController:
97 void ContentsChanged(views::Textfield* sender, 108 void ContentsChanged(views::Textfield* sender,
98 const base::string16& new_contents) override; 109 const base::string16& new_contents) override;
99 bool HandleKeyEvent(views::Textfield* sender, 110 bool HandleKeyEvent(views::Textfield* sender,
100 const ui::KeyEvent& key_event) override; 111 const ui::KeyEvent& key_event) override;
112 bool HandleMouseEvent(views::Textfield* sender,
113 const ui::MouseEvent& mouse_event) override;
114 bool HandleGestureEvent(views::Textfield* sender,
115 const ui::GestureEvent& gesture_event) override;
101 116
102 // Overridden from views::ButtonListener: 117 // Overridden from views::ButtonListener:
103 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 118 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
104 119
105 // Overridden from SearchBoxModelObserver: 120 // Overridden from SearchBoxModelObserver:
106 void SpeechRecognitionButtonPropChanged() override; 121 void SpeechRecognitionButtonPropChanged() override;
107 void HintTextChanged() override; 122 void HintTextChanged() override;
108 void SelectionModelChanged() override; 123 void SelectionModelChanged() override;
109 void Update() override; 124 void Update() override;
110 125
(...skipping 10 matching lines...) Expand all
121 SearchBoxImageButton* back_button_; // Owned by views hierarchy. 136 SearchBoxImageButton* back_button_; // Owned by views hierarchy.
122 SearchBoxImageButton* speech_button_; // Owned by views hierarchy. 137 SearchBoxImageButton* speech_button_; // Owned by views hierarchy.
123 views::Textfield* search_box_; // Owned by views hierarchy. 138 views::Textfield* search_box_; // Owned by views hierarchy.
124 views::View* contents_view_; // Owned by views hierarchy. 139 views::View* contents_view_; // Owned by views hierarchy.
125 app_list::AppListView* app_list_view_; // Owned by views hierarchy. 140 app_list::AppListView* app_list_view_; // Owned by views hierarchy.
126 141
127 SearchBoxFocus focused_view_; // Which element has TAB'd focus. 142 SearchBoxFocus focused_view_; // Which element has TAB'd focus.
128 143
129 // Whether the fullscreen app list feature is enabled. 144 // Whether the fullscreen app list feature is enabled.
130 const bool is_fullscreen_app_list_enabled_; 145 const bool is_fullscreen_app_list_enabled_;
146 // Whether the search box is active.
147 bool is_search_box_active_ = false;
131 148
132 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); 149 DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
133 }; 150 };
134 151
135 } // namespace app_list 152 } // namespace app_list
136 153
137 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ 154 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698