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

Side by Side Diff: ui/app_list/views/apps_grid_view.cc

Issue 518673008: Make page switch on drag happen at top and bottom for experimental app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ares_remove_page_switcher
Patch Set: address comment Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/app_list/views/apps_grid_view.h" 5 #include "ui/app_list/views/apps_grid_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 } 1645 }
1646 } 1646 }
1647 } 1647 }
1648 } 1648 }
1649 1649
1650 void AppsGridView::MaybeStartPageFlipTimer(const gfx::Point& drag_point) { 1650 void AppsGridView::MaybeStartPageFlipTimer(const gfx::Point& drag_point) {
1651 if (!IsPointWithinDragBuffer(drag_point)) 1651 if (!IsPointWithinDragBuffer(drag_point))
1652 StopPageFlipTimer(); 1652 StopPageFlipTimer();
1653 int new_page_flip_target = -1; 1653 int new_page_flip_target = -1;
1654 1654
1655 if (page_switcher_view_ && 1655 // Drag zones are at the edges of the scroll axis.
1656 page_switcher_view_->bounds().Contains(drag_point)) { 1656 if (pagination_controller_->scroll_axis() ==
1657 gfx::Point page_switcher_point(drag_point); 1657 PaginationController::SCROLL_AXIS_VERTICAL) {
1658 views::View::ConvertPointToTarget(this, page_switcher_view_, 1658 if (drag_point.y() < kPageFlipZoneSize)
1659 &page_switcher_point); 1659 new_page_flip_target = pagination_model_.selected_page() - 1;
1660 new_page_flip_target = 1660 else if (drag_point.y() > height() - kPageFlipZoneSize)
1661 page_switcher_view_->GetPageForPoint(page_switcher_point); 1661 new_page_flip_target = pagination_model_.selected_page() + 1;
1662 } 1662 } else {
1663 if (page_switcher_view_->bounds().Contains(drag_point)) {
1664 gfx::Point page_switcher_point(drag_point);
1665 views::View::ConvertPointToTarget(
1666 this, page_switcher_view_, &page_switcher_point);
1667 new_page_flip_target =
1668 page_switcher_view_->GetPageForPoint(page_switcher_point);
1669 }
1663 1670
1664 // TODO(xiyuan): Fix this for RTL. 1671 // TODO(xiyuan): Fix this for RTL.
1665 if (new_page_flip_target == -1 && drag_point.x() < kPageFlipZoneSize) 1672 if (new_page_flip_target == -1 && drag_point.x() < kPageFlipZoneSize)
1666 new_page_flip_target = pagination_model_.selected_page() - 1; 1673 new_page_flip_target = pagination_model_.selected_page() - 1;
1667 1674
1668 if (new_page_flip_target == -1 && 1675 if (new_page_flip_target == -1 &&
1669 drag_point.x() > width() - kPageFlipZoneSize) { 1676 drag_point.x() > width() - kPageFlipZoneSize) {
1670 new_page_flip_target = pagination_model_.selected_page() + 1; 1677 new_page_flip_target = pagination_model_.selected_page() + 1;
1678 }
1671 } 1679 }
1672 1680
1673 if (new_page_flip_target == page_flip_target_) 1681 if (new_page_flip_target == page_flip_target_)
1674 return; 1682 return;
1675 1683
1676 StopPageFlipTimer(); 1684 StopPageFlipTimer();
1677 if (pagination_model_.is_valid_page(new_page_flip_target)) { 1685 if (pagination_model_.is_valid_page(new_page_flip_target)) {
1678 page_flip_target_ = new_page_flip_target; 1686 page_flip_target_ = new_page_flip_target;
1679 1687
1680 if (page_flip_target_ != pagination_model_.selected_page()) { 1688 if (page_flip_target_ != pagination_model_.selected_page()) {
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, 2235 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index,
2228 bool is_target_folder) { 2236 bool is_target_folder) {
2229 AppListItemView* target_view = 2237 AppListItemView* target_view =
2230 static_cast<AppListItemView*>( 2238 static_cast<AppListItemView*>(
2231 GetViewAtSlotOnCurrentPage(target_index.slot)); 2239 GetViewAtSlotOnCurrentPage(target_index.slot));
2232 if (target_view) 2240 if (target_view)
2233 target_view->SetAsAttemptedFolderTarget(is_target_folder); 2241 target_view->SetAsAttemptedFolderTarget(is_target_folder);
2234 } 2242 }
2235 2243
2236 } // namespace app_list 2244 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698