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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/app_list/views/search_box_view.h
diff --git a/ui/app_list/views/search_box_view.h b/ui/app_list/views/search_box_view.h
index b03fdc6fd1886065ee1e6406064ccca6a033b74d..ddf22b1f50cf50551b4a51e4094eb52ea9f8ac10 100644
--- a/ui/app_list/views/search_box_view.h
+++ b/ui/app_list/views/search_box_view.h
@@ -81,10 +81,25 @@ class APP_LIST_EXPORT SearchBoxView : public views::View,
// Sets voice label for Back button depending on whether a folder is open.
void SetBackButtonLabel(bool folder);
+ // Whether the cursor is being shown.
+ bool is_cursor_enabled() const { return is_cursor_enabled_; }
+
+ // Aligns the placeholder text to the left/center, changes the colour of the
+ // placeholder text, and enable/disables the cursor.
+ void SetPlaceholderTextAndEnableCursor(bool enable);
+
+ // Passes a mouse event to HandleMouseEvent, used for testing.
+ bool PassMouseEventForTesting(ui::MouseEvent& mouse_event);
+
+ // Disables state change notification that crashes unit tests.
+ 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
+
// Overridden from views::View:
bool OnMouseWheel(const ui::MouseWheelEvent& event) override;
void OnEnabledChanged() override;
const char* GetClassName() const override;
+ void OnGestureEvent(ui::GestureEvent* event) override;
+ void OnMouseEvent(ui::MouseEvent* event) override;
private:
// Updates model text and selection model with current Textfield info.
@@ -98,6 +113,9 @@ class APP_LIST_EXPORT SearchBoxView : public views::View,
const base::string16& new_contents) override;
bool HandleKeyEvent(views::Textfield* sender,
const ui::KeyEvent& key_event) override;
+ bool HandleMouseEvent(views::Textfield* sender,
+ const ui::MouseEvent& mouse_event) override;
+ void NotifyOfGestureEvent() override;
// Overridden from views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
@@ -128,7 +146,10 @@ class APP_LIST_EXPORT SearchBoxView : public views::View,
// Whether the fullscreen app list feature is enabled.
const bool is_fullscreen_app_list_enabled_;
-
+ // Whether the cursor blink is enabled.
+ 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!
+ 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.
+ // blocked
DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
};

Powered by Google App Engine
This is Rietveld 408576698