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

Unified Diff: ui/app_list/views/search_box_view.h

Issue 2952763002: SearchBoxView now enables/disables cursor based on user interaction. (Closed)
Patch Set: Addressed Comments, refactored. 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..83bec262e261895571babe1fca581450f13bfb90 100644
--- a/ui/app_list/views/search_box_view.h
+++ b/ui/app_list/views/search_box_view.h
@@ -81,10 +81,28 @@ 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 search box is active.
+ bool is_search_box_active() const { return is_search_box_active_; }
+
+ // Setting the search box active left aligns the placeholder text, changes
xiyuan 2017/06/27 23:11:10 nit: get rid of one space between "search" and "bo
newcomer 2017/06/30 21:47:23 Done.
+ // the color of the placeholder text, and enables cursor blink. Setting the
+ // search box inactive center aligns the placeholder text, sets the color, and
+ // disables cursor blink.
+ void SetSearchBoxActive(bool active);
+
+ // Closes the |app_list_view_| if the search box gets unfocused.
+ void HandleSearchBoxEvent(ui::LocatedEvent* located_event,
+ ui::EventType type);
+
+ // Handles Gesture and Mouse Events sent from |search_box_|.
+ bool OnTextfieldEvent();
+
// 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 +116,10 @@ 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;
+ bool HandleGestureEvent(views::Textfield* sender,
+ const ui::GestureEvent& gesture_event) override;
// Overridden from views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
@@ -128,6 +150,8 @@ 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 search box is active.
+ bool is_search_box_active_ = false;
DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
};

Powered by Google App Engine
This is Rietveld 408576698