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

Side by Side Diff: ash/shelf/shelf_view.cc

Issue 2916983002: shelf: Allow directly dragging items from main shelf to overflow. (Closed)
Patch Set: Created 3 years, 6 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 | ash/shelf/shelf_view_unittest.cc » ('j') | ash/shelf/shelf_view_unittest.cc » ('J')
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 "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/ash_constants.h" 10 #include "ash/ash_constants.h"
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 } 1126 }
1127 1127
1128 bounds_animator_->StopAnimatingView(drag_view_); 1128 bounds_animator_->StopAnimatingView(drag_view_);
1129 int drag_view_index = view_model_->GetIndexOfView(drag_view_); 1129 int drag_view_index = view_model_->GetIndexOfView(drag_view_);
1130 drag_view_->SetBoundsRect(view_model_->ideal_bounds(drag_view_index)); 1130 drag_view_->SetBoundsRect(view_model_->ideal_bounds(drag_view_index));
1131 } 1131 }
1132 // Move our proxy view item. 1132 // Move our proxy view item.
1133 UpdateDragIconProxy(screen_location); 1133 UpdateDragIconProxy(screen_location);
1134 return true; 1134 return true;
1135 } 1135 }
1136 // Check if we are too far away from the shelf to enter the ripped off state. 1136
1137 // Determine the distance to the shelf. 1137 // Determine if we should enter the ripped off state. We should enter if:
msw 2017/06/06 00:27:23 nit: "Mark the item as dragged off the shelf if th
sammiequon 2017/06/06 16:21:26 Done.
1138 // 1) The item is dragged more than |kRipOffDistance| from the shelf.
1139 // 2) We are on the overflow shelf and the item is dragged onto the main
1140 // shelf.
1141 // 3) We are on the main shelf and the item is dragged onto the overflow
1142 // shelf.
1138 int delta = CalculateShelfDistance(screen_location); 1143 int delta = CalculateShelfDistance(screen_location);
1139 if (delta > kRipOffDistance) { 1144 bool enableRipOff = delta > kRipOffDistance;
msw 2017/06/06 00:27:23 Use the unix_hacker naming convention in Chrome's
sammiequon 2017/06/06 16:21:26 Done.
1145 enableRipOff =
1146 enableRipOff ||
msw 2017/06/06 00:27:23 nit: if you keep separate statements like this, th
sammiequon 2017/06/06 16:21:26 Done.
1147 (is_overflow_mode() &&
1148 main_shelf_->GetBoundsForDragInsertInScreen().Contains(screen_location));
1149 enableRipOff = enableRipOff || (!is_overflow_mode() && overflow_bubble_ &&
1150 overflow_bubble_->IsShowing() &&
1151 overflow_bubble_->shelf_view()
1152 ->GetBoundsForDragInsertInScreen()
1153 .Contains(screen_location));
1154
1155 if (enableRipOff) {
1140 // Create a proxy view item which can be moved anywhere. 1156 // Create a proxy view item which can be moved anywhere.
1141 CreateDragIconProxy(event.root_location(), drag_view_->GetImage(), 1157 CreateDragIconProxy(event.root_location(), drag_view_->GetImage(),
1142 drag_view_, gfx::Vector2d(0, 0), 1158 drag_view_, gfx::Vector2d(0, 0),
1143 kDragAndDropProxyScale); 1159 kDragAndDropProxyScale);
1144 drag_view_->layer()->SetOpacity(0.0f); 1160 drag_view_->layer()->SetOpacity(0.0f);
1145 dragged_off_shelf_ = true; 1161 dragged_off_shelf_ = true;
1146 if (RemovableByRipOff(current_index) == REMOVABLE) { 1162 if (RemovableByRipOff(current_index) == REMOVABLE) {
1147 // Move the item to the front of the first panel item and hide it. 1163 // Move the item to the front of the first panel item and hide it.
1148 // ShelfItemMoved() callback will handle the |view_model_| update and 1164 // ShelfItemMoved() callback will handle the |view_model_| update and
1149 // call AnimateToIdealBounds(). 1165 // call AnimateToIdealBounds().
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 if (pointer == TOUCH && 1852 if (pointer == TOUCH &&
1837 (base::TimeTicks::Now() - touch_press_time_) < 1853 (base::TimeTicks::Now() - touch_press_time_) <
1838 base::TimeDelta::FromMilliseconds(kTouchDragTimeThresholdMs)) { 1854 base::TimeDelta::FromMilliseconds(kTouchDragTimeThresholdMs)) {
1839 return false; 1855 return false;
1840 } 1856 }
1841 1857
1842 return true; 1858 return true;
1843 } 1859 }
1844 1860
1845 } // namespace ash 1861 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/shelf_view_unittest.cc » ('j') | ash/shelf/shelf_view_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698