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

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, 6 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 cursor is being shown.
85 bool is_cursor_enabled() const { return is_cursor_enabled_; }
86
87 // Aligns the placeholder text to the left/center, changes the colour of the
88 // placeholder text, and enable/disables the cursor.
89 void SetPlaceholderTextAndEnableCursor(bool enable);
90
91 // Passes a mouse event to HandleMouseEvent, used for testing.
92 bool PassMouseEventForTesting(ui::MouseEvent& mouse_event);
93
94 // Disables state change notification that crashes unit tests.
95 void UnitTestsRunning() { unit_tests_running_ = true; }
vadimt 2017/06/22 00:53:05 First SetUnitTestsRunning, second, please stop by
newcomer 2017/06/22 16:17:21 Fixed by checking if app_list_view_ has been set b
96
84 // Overridden from views::View: 97 // Overridden from views::View:
85 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; 98 bool OnMouseWheel(const ui::MouseWheelEvent& event) override;
86 void OnEnabledChanged() override; 99 void OnEnabledChanged() override;
87 const char* GetClassName() const override; 100 const char* GetClassName() const override;
101 void OnGestureEvent(ui::GestureEvent* event) override;
102 void OnMouseEvent(ui::MouseEvent* event) override;
88 103
89 private: 104 private:
90 // Updates model text and selection model with current Textfield info. 105 // Updates model text and selection model with current Textfield info.
91 void UpdateModel(); 106 void UpdateModel();
92 107
93 // Fires query change notification. 108 // Fires query change notification.
94 void NotifyQueryChanged(); 109 void NotifyQueryChanged();
95 110
96 // Overridden from views::TextfieldController: 111 // Overridden from views::TextfieldController:
97 void ContentsChanged(views::Textfield* sender, 112 void ContentsChanged(views::Textfield* sender,
98 const base::string16& new_contents) override; 113 const base::string16& new_contents) override;
99 bool HandleKeyEvent(views::Textfield* sender, 114 bool HandleKeyEvent(views::Textfield* sender,
100 const ui::KeyEvent& key_event) override; 115 const ui::KeyEvent& key_event) override;
116 bool HandleMouseEvent(views::Textfield* sender,
117 const ui::MouseEvent& mouse_event) override;
118 void NotifyOfGestureEvent() override;
101 119
102 // Overridden from views::ButtonListener: 120 // Overridden from views::ButtonListener:
103 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 121 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
104 122
105 // Overridden from SearchBoxModelObserver: 123 // Overridden from SearchBoxModelObserver:
106 void SpeechRecognitionButtonPropChanged() override; 124 void SpeechRecognitionButtonPropChanged() override;
107 void HintTextChanged() override; 125 void HintTextChanged() override;
108 void SelectionModelChanged() override; 126 void SelectionModelChanged() override;
109 void Update() override; 127 void Update() override;
110 128
(...skipping 10 matching lines...) Expand all
121 SearchBoxImageButton* back_button_; // Owned by views hierarchy. 139 SearchBoxImageButton* back_button_; // Owned by views hierarchy.
122 SearchBoxImageButton* speech_button_; // Owned by views hierarchy. 140 SearchBoxImageButton* speech_button_; // Owned by views hierarchy.
123 views::Textfield* search_box_; // Owned by views hierarchy. 141 views::Textfield* search_box_; // Owned by views hierarchy.
124 views::View* contents_view_; // Owned by views hierarchy. 142 views::View* contents_view_; // Owned by views hierarchy.
125 app_list::AppListView* app_list_view_; // Owned by views hierarchy. 143 app_list::AppListView* app_list_view_; // Owned by views hierarchy.
126 144
127 SearchBoxFocus focused_view_; // Which element has TAB'd focus. 145 SearchBoxFocus focused_view_; // Which element has TAB'd focus.
128 146
129 // Whether the fullscreen app list feature is enabled. 147 // Whether the fullscreen app list feature is enabled.
130 const bool is_fullscreen_app_list_enabled_; 148 const bool is_fullscreen_app_list_enabled_;
131 149 // Whether the cursor blink is enabled.
150 bool is_cursor_enabled_;
vadimt 2017/06/22 00:53:05 (false)
newcomer 2017/06/22 16:17:21 This is done in the constructor.
vadimt 2017/06/22 22:47:40 And the preferred way is to initialize in the head
newcomer 2017/06/23 23:59:36 Done!
151 bool unit_tests_running_; // Whether the state change notification should be
vadimt 2017/06/22 00:53:05 Comment into line before.
newcomer 2017/06/22 16:17:21 Removed this bool as a side effect.
152 // blocked
132 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); 153 DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
133 }; 154 };
134 155
135 } // namespace app_list 156 } // namespace app_list
136 157
137 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ 158 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698