OLD | NEW |
---|---|
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 Loading... | |
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 // The drag zones are at the top and bottom of the experimental app list and |
1656 page_switcher_view_->bounds().Contains(drag_point)) { | 1656 // on the sides and page switcher of the normal app list. |
1657 gfx::Point page_switcher_point(drag_point); | 1657 if (switches::IsExperimentalAppListEnabled()) { |
Matt Giuca
2014/09/02 08:26:34
This should be:
if (pagination_controller_->scrol
calamity
2014/09/03 11:25:36
Done.
| |
1658 views::View::ConvertPointToTarget(this, page_switcher_view_, | 1658 if (drag_point.y() < kPageFlipZoneSize) |
Matt Giuca
2014/09/02 08:26:34
I'm confused as to why this code is completely dif
Matt Giuca
2014/09/03 08:02:18
You explained this to me, so ignore it.
calamity
2014/09/03 11:25:36
Acknowledged.
| |
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 Loading... | |
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 |
OLD | NEW |