Chromium Code Reviews| 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) { |