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

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

Issue 2982453002: New AppListView Scroll Behavior. (Closed)
Patch Set: Addressed comments. 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 side-by-side diff with in-line comments
Download patch
Index: ui/app_list/views/search_box_view.cc
diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc
index 45f30f10e33ed59701d0bb5eb7fc6639b8adf15f..e3b26eba12a719c8d6b462e162b0adcedc8946ce 100644
--- a/ui/app_list/views/search_box_view.cc
+++ b/ui/app_list/views/search_box_view.cc
@@ -29,6 +29,7 @@
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/geometry/insets.h"
+#include "ui/gfx/geometry/vector2d_conversions.h"
oshima 2017/07/14 02:06:47 do you need this?
newcomer 2017/07/14 17:49:33 Not any more. Thanks!
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/shadow_value.h"
#include "ui/strings/grit/ui_strings.h"
@@ -276,20 +277,23 @@ bool SearchBoxView::MoveTabFocus(bool move_backwards) {
case FOCUS_SEARCH_BOX:
if (move_backwards) {
focused_view_ = back_button_ && back_button_->visible()
- ? FOCUS_BACK_BUTTON : FOCUS_SEARCH_BOX;
+ ? FOCUS_BACK_BUTTON
+ : FOCUS_SEARCH_BOX;
} else {
focused_view_ = speech_button_ && speech_button_->visible()
- ? FOCUS_MIC_BUTTON : FOCUS_CONTENTS_VIEW;
+ ? FOCUS_MIC_BUTTON
+ : FOCUS_CONTENTS_VIEW;
}
break;
case FOCUS_MIC_BUTTON:
focused_view_ = move_backwards ? FOCUS_SEARCH_BOX : FOCUS_CONTENTS_VIEW;
break;
case FOCUS_CONTENTS_VIEW:
- focused_view_ = move_backwards
- ? (speech_button_ && speech_button_->visible() ?
- FOCUS_MIC_BUTTON : FOCUS_SEARCH_BOX)
- : FOCUS_CONTENTS_VIEW;
+ focused_view_ =
+ move_backwards
+ ? (speech_button_ && speech_button_->visible() ? FOCUS_MIC_BUTTON
+ : FOCUS_SEARCH_BOX)
+ : FOCUS_CONTENTS_VIEW;
break;
default:
DCHECK(false);
@@ -351,10 +355,20 @@ void SearchBoxView::ShowBackOrGoogleIcon(bool show_back_button) {
content_container_->Layout();
}
+void SearchBoxView::OnMouseEvent(ui::MouseEvent* event) {
+ if (!is_fullscreen_app_list_enabled_)
+ return;
+
+ if (event->type() != ui::ET_MOUSEWHEEL)
+ return;
+
+ if (app_list_view_->HandleScroll(event))
+ event->SetHandled();
+}
+
bool SearchBoxView::OnMouseWheel(const ui::MouseWheelEvent& event) {
if (contents_view_)
return contents_view_->OnMouseWheel(event);
-
return false;
}
@@ -441,6 +455,17 @@ bool SearchBoxView::HandleKeyEvent(views::Textfield* sender,
return false;
}
+bool SearchBoxView::HandleMouseEvent(views::Textfield* sender,
+ const ui::MouseEvent& mouse_event) {
+ if (!is_fullscreen_app_list_enabled_)
+ return false;
+
+ if (mouse_event.type() != ui::ET_MOUSEWHEEL)
+ return false;
+
+ return app_list_view_->HandleScroll(&mouse_event);
+}
+
void SearchBoxView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (back_button_ && sender == back_button_)

Powered by Google App Engine
This is Rietveld 408576698