| 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 "ash/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/aura/wm_window_aura.h" | 10 #include "ash/aura/wm_window_aura.h" |
| 11 #include "ash/common/ash_constants.h" | 11 #include "ash/common/ash_constants.h" |
| 12 #include "ash/common/ash_switches.h" | 12 #include "ash/common/ash_switches.h" |
| 13 #include "ash/common/shelf/app_list_button.h" | 13 #include "ash/common/shelf/app_list_button.h" |
| 14 #include "ash/common/shelf/overflow_bubble.h" | 14 #include "ash/common/shelf/overflow_bubble.h" |
| 15 #include "ash/common/shelf/overflow_bubble_view.h" | 15 #include "ash/common/shelf/overflow_bubble_view.h" |
| 16 #include "ash/common/shelf/overflow_button.h" | 16 #include "ash/common/shelf/overflow_button.h" |
| 17 #include "ash/common/shelf/shelf_constants.h" | 17 #include "ash/common/shelf/shelf_constants.h" |
| 18 #include "ash/common/shelf/shelf_item_delegate_manager.h" | |
| 19 #include "ash/common/shelf/shelf_menu_model.h" | 18 #include "ash/common/shelf/shelf_menu_model.h" |
| 20 #include "ash/common/shelf/shelf_model.h" | 19 #include "ash/common/shelf/shelf_model.h" |
| 21 #include "ash/common/shell_delegate.h" | 20 #include "ash/common/shell_delegate.h" |
| 22 #include "ash/common/wm/root_window_finder.h" | 21 #include "ash/common/wm/root_window_finder.h" |
| 23 #include "ash/common/wm_shell.h" | 22 #include "ash/common/wm_shell.h" |
| 24 #include "ash/drag_drop/drag_image_view.h" | 23 #include "ash/drag_drop/drag_image_view.h" |
| 25 #include "ash/scoped_target_root_window.h" | 24 #include "ash/scoped_target_root_window.h" |
| 26 #include "ash/shelf/shelf.h" | 25 #include "ash/shelf/shelf.h" |
| 27 #include "ash/shelf/shelf_button.h" | 26 #include "ash/shelf/shelf_button.h" |
| 28 #include "ash/shelf/shelf_delegate.h" | 27 #include "ash/shelf/shelf_delegate.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 context_menu_id_(0), | 377 context_menu_id_(0), |
| 379 leading_inset_(kDefaultLeadingInset), | 378 leading_inset_(kDefaultLeadingInset), |
| 380 cancelling_drag_model_changed_(false), | 379 cancelling_drag_model_changed_(false), |
| 381 last_hidden_index_(0), | 380 last_hidden_index_(0), |
| 382 closing_event_time_(base::TimeTicks()), | 381 closing_event_time_(base::TimeTicks()), |
| 383 drag_and_drop_item_pinned_(false), | 382 drag_and_drop_item_pinned_(false), |
| 384 drag_and_drop_shelf_id_(0), | 383 drag_and_drop_shelf_id_(0), |
| 385 drag_replaced_view_(nullptr), | 384 drag_replaced_view_(nullptr), |
| 386 dragged_off_shelf_(false), | 385 dragged_off_shelf_(false), |
| 387 snap_back_from_rip_off_view_(nullptr), | 386 snap_back_from_rip_off_view_(nullptr), |
| 388 item_manager_(Shell::GetInstance()->shelf_item_delegate_manager()), | |
| 389 overflow_mode_(false), | 387 overflow_mode_(false), |
| 390 main_shelf_(nullptr), | 388 main_shelf_(nullptr), |
| 391 dragged_off_from_overflow_to_shelf_(false), | 389 dragged_off_from_overflow_to_shelf_(false), |
| 392 is_repost_event_on_same_item_(false), | 390 is_repost_event_on_same_item_(false), |
| 393 last_pressed_index_(-1) { | 391 last_pressed_index_(-1) { |
| 394 DCHECK(model_); | 392 DCHECK(model_); |
| 395 DCHECK(wm_shelf_); | 393 DCHECK(wm_shelf_); |
| 396 bounds_animator_.reset(new views::BoundsAnimator(this)); | 394 bounds_animator_.reset(new views::BoundsAnimator(this)); |
| 397 bounds_animator_->AddObserver(this); | 395 bounds_animator_->AddObserver(this); |
| 398 set_context_menu_controller(this); | 396 set_context_menu_controller(this); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 529 } |
| 532 | 530 |
| 533 bool ShelfView::ShouldShowTooltipForView(const views::View* view) const { | 531 bool ShelfView::ShouldShowTooltipForView(const views::View* view) const { |
| 534 if (view == GetAppListButton() && | 532 if (view == GetAppListButton() && |
| 535 WmShell::Get()->GetAppListTargetVisibility()) { | 533 WmShell::Get()->GetAppListTargetVisibility()) { |
| 536 return false; | 534 return false; |
| 537 } | 535 } |
| 538 const ShelfItem* item = ShelfItemForView(view); | 536 const ShelfItem* item = ShelfItemForView(view); |
| 539 if (!item) | 537 if (!item) |
| 540 return false; | 538 return false; |
| 541 return item_manager_->GetShelfItemDelegate(item->id)->ShouldShowTooltip(); | 539 return model_->GetShelfItemDelegate(item->id)->ShouldShowTooltip(); |
| 542 } | 540 } |
| 543 | 541 |
| 544 base::string16 ShelfView::GetTitleForView(const views::View* view) const { | 542 base::string16 ShelfView::GetTitleForView(const views::View* view) const { |
| 545 const ShelfItem* item = ShelfItemForView(view); | 543 const ShelfItem* item = ShelfItemForView(view); |
| 546 if (!item || !item_manager_->GetShelfItemDelegate(item->id)) | 544 if (!item || !model_->GetShelfItemDelegate(item->id)) |
| 547 return base::string16(); | 545 return base::string16(); |
| 548 return item_manager_->GetShelfItemDelegate(item->id)->GetTitle(); | 546 return model_->GetShelfItemDelegate(item->id)->GetTitle(); |
| 549 } | 547 } |
| 550 | 548 |
| 551 gfx::Rect ShelfView::GetVisibleItemsBoundsInScreen() { | 549 gfx::Rect ShelfView::GetVisibleItemsBoundsInScreen() { |
| 552 gfx::Size preferred_size = GetPreferredSize(); | 550 gfx::Size preferred_size = GetPreferredSize(); |
| 553 gfx::Point origin(GetMirroredXWithWidthInView(0, preferred_size.width()), 0); | 551 gfx::Point origin(GetMirroredXWithWidthInView(0, preferred_size.width()), 0); |
| 554 ConvertPointToScreen(this, &origin); | 552 ConvertPointToScreen(this, &origin); |
| 555 return gfx::Rect(origin, preferred_size); | 553 return gfx::Rect(origin, preferred_size); |
| 556 } | 554 } |
| 557 | 555 |
| 558 //////////////////////////////////////////////////////////////////////////////// | 556 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 Pointer pointer, | 733 Pointer pointer, |
| 736 const ui::LocatedEvent& event) { | 734 const ui::LocatedEvent& event) { |
| 737 if (drag_view_) | 735 if (drag_view_) |
| 738 return; | 736 return; |
| 739 | 737 |
| 740 int index = view_model_->GetIndexOfView(view); | 738 int index = view_model_->GetIndexOfView(view); |
| 741 if (index == -1 || view_model_->view_size() <= 1) | 739 if (index == -1 || view_model_->view_size() <= 1) |
| 742 return; // View is being deleted, ignore request. | 740 return; // View is being deleted, ignore request. |
| 743 | 741 |
| 744 ShelfItemDelegate* item_delegate = | 742 ShelfItemDelegate* item_delegate = |
| 745 item_manager_->GetShelfItemDelegate(model_->items()[index].id); | 743 model_->GetShelfItemDelegate(model_->items()[index].id); |
| 746 if (!item_delegate->IsDraggable()) | 744 if (!item_delegate->IsDraggable()) |
| 747 return; // View is not draggable, ignore request. | 745 return; // View is not draggable, ignore request. |
| 748 | 746 |
| 749 // Only when the repost event occurs on the same shelf item, we should ignore | 747 // Only when the repost event occurs on the same shelf item, we should ignore |
| 750 // the call in ShelfView::ButtonPressed(...). | 748 // the call in ShelfView::ButtonPressed(...). |
| 751 is_repost_event_on_same_item_ = | 749 is_repost_event_on_same_item_ = |
| 752 IsRepostEvent(event) && (last_pressed_index_ == index); | 750 IsRepostEvent(event) && (last_pressed_index_ == index); |
| 753 | 751 |
| 754 CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName()); | 752 CHECK_EQ(ShelfButton::kViewClassName, view->GetClassName()); |
| 755 drag_view_ = static_cast<ShelfButton*>(view); | 753 drag_view_ = static_cast<ShelfButton*>(view); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 DCHECK(drag_view_); | 1040 DCHECK(drag_view_); |
| 1043 drag_pointer_ = pointer; | 1041 drag_pointer_ = pointer; |
| 1044 start_drag_index_ = view_model_->GetIndexOfView(drag_view_); | 1042 start_drag_index_ = view_model_->GetIndexOfView(drag_view_); |
| 1045 | 1043 |
| 1046 if (start_drag_index_ == -1) { | 1044 if (start_drag_index_ == -1) { |
| 1047 CancelDrag(-1); | 1045 CancelDrag(-1); |
| 1048 return; | 1046 return; |
| 1049 } | 1047 } |
| 1050 | 1048 |
| 1051 // If the item is no longer draggable, bail out. | 1049 // If the item is no longer draggable, bail out. |
| 1052 ShelfItemDelegate* item_delegate = item_manager_->GetShelfItemDelegate( | 1050 ShelfItemDelegate* item_delegate = |
| 1053 model_->items()[start_drag_index_].id); | 1051 model_->GetShelfItemDelegate(model_->items()[start_drag_index_].id); |
| 1054 if (!item_delegate->IsDraggable()) { | 1052 if (!item_delegate->IsDraggable()) { |
| 1055 CancelDrag(-1); | 1053 CancelDrag(-1); |
| 1056 return; | 1054 return; |
| 1057 } | 1055 } |
| 1058 | 1056 |
| 1059 // Move the view to the front so that it appears on top of other views. | 1057 // Move the view to the front so that it appears on top of other views. |
| 1060 ReorderChildView(drag_view_, -1); | 1058 ReorderChildView(drag_view_, -1); |
| 1061 bounds_animator_->StopAnimatingView(drag_view_); | 1059 bounds_animator_->StopAnimatingView(drag_view_); |
| 1062 | 1060 |
| 1063 drag_view_->OnDragStarted(&event); | 1061 drag_view_->OnDragStarted(&event); |
| 1064 } | 1062 } |
| 1065 | 1063 |
| 1066 void ShelfView::ContinueDrag(const ui::LocatedEvent& event) { | 1064 void ShelfView::ContinueDrag(const ui::LocatedEvent& event) { |
| 1067 // Due to a syncing operation the application might have been removed. | 1065 // Due to a syncing operation the application might have been removed. |
| 1068 // Bail if it is gone. | 1066 // Bail if it is gone. |
| 1069 int current_index = view_model_->GetIndexOfView(drag_view_); | 1067 int current_index = view_model_->GetIndexOfView(drag_view_); |
| 1070 DCHECK_NE(-1, current_index); | 1068 DCHECK_NE(-1, current_index); |
| 1071 | 1069 |
| 1072 ShelfItemDelegate* item_delegate = | 1070 ShelfItemDelegate* item_delegate = |
| 1073 item_manager_->GetShelfItemDelegate(model_->items()[current_index].id); | 1071 model_->GetShelfItemDelegate(model_->items()[current_index].id); |
| 1074 if (!item_delegate->IsDraggable()) { | 1072 if (!item_delegate->IsDraggable()) { |
| 1075 CancelDrag(-1); | 1073 CancelDrag(-1); |
| 1076 return; | 1074 return; |
| 1077 } | 1075 } |
| 1078 | 1076 |
| 1079 // If this is not a drag and drop host operation and not the app list item, | 1077 // If this is not a drag and drop host operation and not the app list item, |
| 1080 // check if the item got ripped off the shelf - if it did we are done. | 1078 // check if the item got ripped off the shelf - if it did we are done. |
| 1081 if (!drag_and_drop_shelf_id_ && | 1079 if (!drag_and_drop_shelf_id_ && |
| 1082 RemovableByRipOff(current_index) != NOT_REMOVABLE) { | 1080 RemovableByRipOff(current_index) != NOT_REMOVABLE) { |
| 1083 if (HandleRipOffDrag(event)) | 1081 if (HandleRipOffDrag(event)) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 int target_index = views::ViewModelUtils::DetermineMoveIndex( | 1121 int target_index = views::ViewModelUtils::DetermineMoveIndex( |
| 1124 *view_model_, drag_view_, | 1122 *view_model_, drag_view_, |
| 1125 shelf_->IsHorizontalAlignment() ? views::ViewModelUtils::HORIZONTAL | 1123 shelf_->IsHorizontalAlignment() ? views::ViewModelUtils::HORIZONTAL |
| 1126 : views::ViewModelUtils::VERTICAL, | 1124 : views::ViewModelUtils::VERTICAL, |
| 1127 x, y); | 1125 x, y); |
| 1128 target_index = | 1126 target_index = |
| 1129 std::min(indices.second, std::max(target_index, indices.first)); | 1127 std::min(indices.second, std::max(target_index, indices.first)); |
| 1130 | 1128 |
| 1131 int first_draggable_item = 0; | 1129 int first_draggable_item = 0; |
| 1132 while (first_draggable_item < static_cast<int>(model_->items().size()) && | 1130 while (first_draggable_item < static_cast<int>(model_->items().size()) && |
| 1133 !item_manager_ | 1131 !model_->GetShelfItemDelegate(model_->items()[first_draggable_item].id) |
| 1134 ->GetShelfItemDelegate(model_->items()[first_draggable_item].id) | |
| 1135 ->IsDraggable()) { | 1132 ->IsDraggable()) { |
| 1136 first_draggable_item++; | 1133 first_draggable_item++; |
| 1137 } | 1134 } |
| 1138 | 1135 |
| 1139 target_index = std::max(target_index, first_draggable_item); | 1136 target_index = std::max(target_index, first_draggable_item); |
| 1140 | 1137 |
| 1141 if (target_index == current_index) | 1138 if (target_index == current_index) |
| 1142 return; | 1139 return; |
| 1143 | 1140 |
| 1144 // Change the model, the ShelfItemMoved() callback will handle the | 1141 // Change the model, the ShelfItemMoved() callback will handle the |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 } | 1304 } |
| 1308 | 1305 |
| 1309 ShelfView::RemovableState ShelfView::RemovableByRipOff(int index) const { | 1306 ShelfView::RemovableState ShelfView::RemovableByRipOff(int index) const { |
| 1310 DCHECK(index >= 0 && index < model_->item_count()); | 1307 DCHECK(index >= 0 && index < model_->item_count()); |
| 1311 ShelfItemType type = model_->items()[index].type; | 1308 ShelfItemType type = model_->items()[index].type; |
| 1312 if (type == TYPE_APP_LIST || type == TYPE_DIALOG) | 1309 if (type == TYPE_APP_LIST || type == TYPE_DIALOG) |
| 1313 return NOT_REMOVABLE; | 1310 return NOT_REMOVABLE; |
| 1314 | 1311 |
| 1315 std::string app_id = delegate_->GetAppIDForShelfID(model_->items()[index].id); | 1312 std::string app_id = delegate_->GetAppIDForShelfID(model_->items()[index].id); |
| 1316 ShelfItemDelegate* item_delegate = | 1313 ShelfItemDelegate* item_delegate = |
| 1317 item_manager_->GetShelfItemDelegate(model_->items()[index].id); | 1314 model_->GetShelfItemDelegate(model_->items()[index].id); |
| 1318 if (!item_delegate->CanPin()) | 1315 if (!item_delegate->CanPin()) |
| 1319 return NOT_REMOVABLE; | 1316 return NOT_REMOVABLE; |
| 1320 // Note: Only pinned app shortcuts can be removed! | 1317 // Note: Only pinned app shortcuts can be removed! |
| 1321 return (type == TYPE_APP_SHORTCUT && delegate_->IsAppPinned(app_id)) | 1318 return (type == TYPE_APP_SHORTCUT && delegate_->IsAppPinned(app_id)) |
| 1322 ? REMOVABLE | 1319 ? REMOVABLE |
| 1323 : DRAGGABLE; | 1320 : DRAGGABLE; |
| 1324 } | 1321 } |
| 1325 | 1322 |
| 1326 bool ShelfView::SameDragType(ShelfItemType typea, ShelfItemType typeb) const { | 1323 bool ShelfView::SameDragType(ShelfItemType typea, ShelfItemType typeb) const { |
| 1327 switch (typea) { | 1324 switch (typea) { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 void ShelfView::ShelfItemMoved(int start_index, int target_index) { | 1671 void ShelfView::ShelfItemMoved(int start_index, int target_index) { |
| 1675 view_model_->Move(start_index, target_index); | 1672 view_model_->Move(start_index, target_index); |
| 1676 // When cancelling a drag due to a shelf item being added, the currently | 1673 // When cancelling a drag due to a shelf item being added, the currently |
| 1677 // dragged item is moved back to its initial position. AnimateToIdealBounds | 1674 // dragged item is moved back to its initial position. AnimateToIdealBounds |
| 1678 // will be called again when the new item is added to the |view_model_| but | 1675 // will be called again when the new item is added to the |view_model_| but |
| 1679 // at this time the |view_model_| is inconsistent with the |model_|. | 1676 // at this time the |view_model_| is inconsistent with the |model_|. |
| 1680 if (!cancelling_drag_model_changed_) | 1677 if (!cancelling_drag_model_changed_) |
| 1681 AnimateToIdealBounds(); | 1678 AnimateToIdealBounds(); |
| 1682 } | 1679 } |
| 1683 | 1680 |
| 1681 void ShelfView::OnSetShelfItemDelegate(ShelfID id, |
| 1682 ShelfItemDelegate* item_delegate) {} |
| 1683 |
| 1684 void ShelfView::ButtonPressed(views::Button* sender, | 1684 void ShelfView::ButtonPressed(views::Button* sender, |
| 1685 const ui::Event& event, | 1685 const ui::Event& event, |
| 1686 views::InkDrop* ink_drop) { | 1686 views::InkDrop* ink_drop) { |
| 1687 if (sender == overflow_button_) { | 1687 if (sender == overflow_button_) { |
| 1688 ToggleOverflowBubble(); | 1688 ToggleOverflowBubble(); |
| 1689 shelf_button_pressed_metric_tracker_.ButtonPressed( | 1689 shelf_button_pressed_metric_tracker_.ButtonPressed( |
| 1690 event, sender, ShelfItemDelegate::kNoAction); | 1690 event, sender, ShelfItemDelegate::kNoAction); |
| 1691 return; | 1691 return; |
| 1692 } | 1692 } |
| 1693 | 1693 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 case TYPE_DIALOG: | 1727 case TYPE_DIALOG: |
| 1728 case TYPE_IME_MENU: | 1728 case TYPE_IME_MENU: |
| 1729 break; | 1729 break; |
| 1730 | 1730 |
| 1731 case TYPE_UNDEFINED: | 1731 case TYPE_UNDEFINED: |
| 1732 NOTREACHED() << "ShelfItemType must be set."; | 1732 NOTREACHED() << "ShelfItemType must be set."; |
| 1733 break; | 1733 break; |
| 1734 } | 1734 } |
| 1735 | 1735 |
| 1736 ShelfItemDelegate::PerformedAction performed_action = | 1736 ShelfItemDelegate::PerformedAction performed_action = |
| 1737 item_manager_ | 1737 model_->GetShelfItemDelegate(model_->items()[last_pressed_index_].id) |
| 1738 ->GetShelfItemDelegate(model_->items()[last_pressed_index_].id) | |
| 1739 ->ItemSelected(event); | 1738 ->ItemSelected(event); |
| 1740 | 1739 |
| 1741 shelf_button_pressed_metric_tracker_.ButtonPressed(event, sender, | 1740 shelf_button_pressed_metric_tracker_.ButtonPressed(event, sender, |
| 1742 performed_action); | 1741 performed_action); |
| 1743 | 1742 |
| 1744 // For the app list menu no TRIGGERED ink drop effect is needed and it | 1743 // For the app list menu no TRIGGERED ink drop effect is needed and it |
| 1745 // handles its own ACTIVATED/DEACTIVATED states. | 1744 // handles its own ACTIVATED/DEACTIVATED states. |
| 1746 if (performed_action == ShelfItemDelegate::kNewWindowCreated || | 1745 if (performed_action == ShelfItemDelegate::kNewWindowCreated || |
| 1747 (performed_action != ShelfItemDelegate::kAppListMenuShown && | 1746 (performed_action != ShelfItemDelegate::kAppListMenuShown && |
| 1748 !ShowListMenuForView(model_->items()[last_pressed_index_], sender, event, | 1747 !ShowListMenuForView(model_->items()[last_pressed_index_], sender, event, |
| 1749 ink_drop))) { | 1748 ink_drop))) { |
| 1750 ink_drop->AnimateToState(views::InkDropState::ACTION_TRIGGERED); | 1749 ink_drop->AnimateToState(views::InkDropState::ACTION_TRIGGERED); |
| 1751 } | 1750 } |
| 1752 // Allow the menu to clear |scoped_target_root_window_| during OnMenuClosed. | 1751 // Allow the menu to clear |scoped_target_root_window_| during OnMenuClosed. |
| 1753 if (!IsShowingMenu()) | 1752 if (!IsShowingMenu()) |
| 1754 scoped_target_root_window_.reset(); | 1753 scoped_target_root_window_.reset(); |
| 1755 } | 1754 } |
| 1756 | 1755 |
| 1757 bool ShelfView::ShowListMenuForView(const ShelfItem& item, | 1756 bool ShelfView::ShowListMenuForView(const ShelfItem& item, |
| 1758 views::View* source, | 1757 views::View* source, |
| 1759 const ui::Event& event, | 1758 const ui::Event& event, |
| 1760 views::InkDrop* ink_drop) { | 1759 views::InkDrop* ink_drop) { |
| 1761 ShelfItemDelegate* item_delegate = | 1760 ShelfItemDelegate* item_delegate = model_->GetShelfItemDelegate(item.id); |
| 1762 item_manager_->GetShelfItemDelegate(item.id); | |
| 1763 std::unique_ptr<ui::MenuModel> list_menu_model( | 1761 std::unique_ptr<ui::MenuModel> list_menu_model( |
| 1764 item_delegate->CreateApplicationMenu(event.flags())); | 1762 item_delegate->CreateApplicationMenu(event.flags())); |
| 1765 | 1763 |
| 1766 // Make sure we have a menu and it has at least two items in addition to the | 1764 // Make sure we have a menu and it has at least two items in addition to the |
| 1767 // application title and the 3 spacing separators. | 1765 // application title and the 3 spacing separators. |
| 1768 if (!list_menu_model.get() || list_menu_model->GetItemCount() <= 5) | 1766 if (!list_menu_model.get() || list_menu_model->GetItemCount() <= 5) |
| 1769 return false; | 1767 return false; |
| 1770 | 1768 |
| 1771 ink_drop->AnimateToState(views::InkDropState::ACTIVATED); | 1769 ink_drop->AnimateToState(views::InkDropState::ACTIVATED); |
| 1772 context_menu_id_ = item.id; | 1770 context_menu_id_ = item.id; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 | 1906 |
| 1909 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1907 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1910 const gfx::Rect bounds = GetBoundsInScreen(); | 1908 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1911 int distance = shelf_->SelectValueForShelfAlignment( | 1909 int distance = shelf_->SelectValueForShelfAlignment( |
| 1912 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1910 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1913 bounds.x() - coordinate.x()); | 1911 bounds.x() - coordinate.x()); |
| 1914 return distance > 0 ? distance : 0; | 1912 return distance > 0 ? distance : 0; |
| 1915 } | 1913 } |
| 1916 | 1914 |
| 1917 } // namespace ash | 1915 } // namespace ash |
| OLD | NEW |