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

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

Issue 913133007: Allow scroll events to open custom launcher pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« ui/app_list/views/app_list_view.cc ('K') | « ui/app_list/views/start_page_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/start_page_view.cc
diff --git a/ui/app_list/views/start_page_view.cc b/ui/app_list/views/start_page_view.cc
index 98400d152baf7f477c2685dcd47adf464fbe92c9..a2671b3e55654d66e1843db0aae5f2dfcbb8c340 100644
--- a/ui/app_list/views/start_page_view.cc
+++ b/ui/app_list/views/start_page_view.cc
@@ -232,6 +232,14 @@ void StartPageView::UpdateForTesting() {
tiles_container_->Update();
}
+void StartPageView::OpenCustomLauncherPage() {
+ // Switch to the custom page.
+ ContentsView* contents_view = app_list_main_view_->contents_view();
+ int custom_page_index = contents_view->GetPageIndexForState(
+ AppListModel::STATE_CUSTOM_LAUNCHER_PAGE);
+ contents_view->SetActivePage(custom_page_index);
+}
+
const std::vector<SearchResultTileItemView*>& StartPageView::tile_views()
const {
return tiles_container_->tile_views();
@@ -242,15 +250,10 @@ TileItemView* StartPageView::all_apps_button() const {
}
void StartPageView::OnShow() {
- UpdateCustomPageClickzoneVisibility();
tiles_container_->Update();
tiles_container_->ClearSelectedIndex();
}
-void StartPageView::OnHide() {
- UpdateCustomPageClickzoneVisibility();
-}
-
void StartPageView::Layout() {
gfx::Rect bounds(GetContentsBounds());
bounds.set_height(instant_container_->GetHeightForWidth(bounds.width()));
@@ -306,24 +309,30 @@ bool StartPageView::OnKeyPressed(const ui::KeyEvent& event) {
return false;
}
-gfx::Rect StartPageView::GetSearchBoxBounds() const {
- return search_box_spacer_view_->bounds();
+bool StartPageView::OnMousePressed(const ui::MouseEvent& event) {
+ ContentsView* contents_view = app_list_main_view_->contents_view();
+ if (!contents_view->GetCustomPageCollapsedBounds().Contains(event.location()))
+ return false;
+
+ OpenCustomLauncherPage();
+ return true;
}
-void StartPageView::UpdateCustomPageClickzoneVisibility() {
- // This can get called before InitWidgets(), so we cannot guarantee that
- // custom_page_clickzone_ will not be null.
- views::Widget* custom_page_clickzone =
- app_list_main_view_->GetCustomPageClickzone();
- if (!custom_page_clickzone)
- return;
-
- if (app_list_main_view_->contents_view()->ShouldShowCustomPageClickzone()) {
- custom_page_clickzone->ShowInactive();
- return;
+bool StartPageView::OnMouseWheel(const ui::MouseWheelEvent& event) {
+ if (event.y_offset() > 0) {
calamity 2015/02/12 04:32:24 I don't know if we want mousewheel/gesture everywh
tapted 2015/02/13 04:18:41 Done.
+ OpenCustomLauncherPage();
+ return true;
}
+ return false;
+}
- custom_page_clickzone->Hide();
+void StartPageView::OnGestureEvent(ui::GestureEvent* event) {
+ if (event->details().scroll_y() > 0)
+ OpenCustomLauncherPage();
+}
calamity 2015/02/12 04:32:24 I think these all need to be gated by app_list_ma
tapted 2015/02/13 04:18:41 Done.
+
+gfx::Rect StartPageView::GetSearchBoxBounds() const {
+ return search_box_spacer_view_->bounds();
}
TileItemView* StartPageView::GetTileItemView(size_t index) {
« ui/app_list/views/app_list_view.cc ('K') | « ui/app_list/views/start_page_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698