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

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

Issue 221903007: Check if the drag state is still valid when folder reparent folder timer fires. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // The drag and drop proxy should get scaled by this factor. 82 // The drag and drop proxy should get scaled by this factor.
83 const float kDragAndDropProxyScale = 1.5f; 83 const float kDragAndDropProxyScale = 1.5f;
84 84
85 // Delays in milliseconds to show folder dropping preview circle. 85 // Delays in milliseconds to show folder dropping preview circle.
86 const int kFolderDroppingDelay = 150; 86 const int kFolderDroppingDelay = 150;
87 87
88 // Delays in milliseconds to show re-order preview. 88 // Delays in milliseconds to show re-order preview.
89 const int kReorderDelay = 120; 89 const int kReorderDelay = 120;
90 90
91 // Delays in milliseconds to show folder item reparent UI. 91 // Delays in milliseconds to show folder item reparent UI.
92 const int kFolderItemReparentDealy = 50; 92 const int kFolderItemReparentDelay = 50;
93 93
94 // Radius of the circle, in which if entered, show folder dropping preview 94 // Radius of the circle, in which if entered, show folder dropping preview
95 // UI. 95 // UI.
96 const int kFolderDroppingCircleRadius = 15; 96 const int kFolderDroppingCircleRadius = 15;
97 97
98 98
99 // RowMoveAnimationDelegate is used when moving an item into a different row. 99 // RowMoveAnimationDelegate is used when moving an item into a different row.
100 // Before running the animation, the item's layer is re-created and kept in 100 // Before running the animation, the item's layer is re-created and kept in
101 // the original position, then the item is moved to just before its target 101 // the original position, then the item is moved to just before its target
102 // position and opacity set to 0. When the animation runs, this delegate moves 102 // position and opacity set to 0. When the animation runs, this delegate moves
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 } 1280 }
1281 } 1281 }
1282 1282
1283 void AppsGridView::OnReorderTimer() { 1283 void AppsGridView::OnReorderTimer() {
1284 if (drop_attempt_ == DROP_FOR_REORDER) 1284 if (drop_attempt_ == DROP_FOR_REORDER)
1285 AnimateToIdealBounds(); 1285 AnimateToIdealBounds();
1286 } 1286 }
1287 1287
1288 void AppsGridView::OnFolderItemReparentTimer() { 1288 void AppsGridView::OnFolderItemReparentTimer() {
1289 DCHECK(folder_delegate_); 1289 DCHECK(folder_delegate_);
1290 if (drag_out_of_folder_container_) { 1290 if (drag_out_of_folder_container_ && drag_view_) {
1291 folder_delegate_->ReparentItem(drag_view_, last_drag_point_); 1291 folder_delegate_->ReparentItem(drag_view_, last_drag_point_);
1292 1292
1293 // Set the flag in the folder's grid view. 1293 // Set the flag in the folder's grid view.
1294 dragging_for_reparent_item_ = true; 1294 dragging_for_reparent_item_ = true;
1295 1295
1296 // Do not observe any data change since it is going to be hidden. 1296 // Do not observe any data change since it is going to be hidden.
1297 item_list_->RemoveObserver(this); 1297 item_list_->RemoveObserver(this);
1298 item_list_ = NULL; 1298 item_list_ = NULL;
1299 } 1299 }
1300 } 1300 }
(...skipping 19 matching lines...) Expand all
1320 folder_delegate_->UpdateFolderViewBackground(true); 1320 folder_delegate_->UpdateFolderViewBackground(true);
1321 1321
1322 // Calculate if the drag_view_ is dragged out of the folder's container 1322 // Calculate if the drag_view_ is dragged out of the folder's container
1323 // ink bubble. 1323 // ink bubble.
1324 gfx::Rect bounds_to_folder_view = ConvertRectToParent(drag_view_->bounds()); 1324 gfx::Rect bounds_to_folder_view = ConvertRectToParent(drag_view_->bounds());
1325 gfx::Point pt = bounds_to_folder_view.CenterPoint(); 1325 gfx::Point pt = bounds_to_folder_view.CenterPoint();
1326 bool is_item_dragged_out_of_folder = 1326 bool is_item_dragged_out_of_folder =
1327 folder_delegate_->IsPointOutsideOfFolderBoundary(pt); 1327 folder_delegate_->IsPointOutsideOfFolderBoundary(pt);
1328 if (is_item_dragged_out_of_folder) { 1328 if (is_item_dragged_out_of_folder) {
1329 if (!drag_out_of_folder_container_) { 1329 if (!drag_out_of_folder_container_) {
1330 folder_item_reparent_timer_.Start(FROM_HERE, 1330 folder_item_reparent_timer_.Start(
1331 base::TimeDelta::FromMilliseconds(kFolderItemReparentDealy), 1331 FROM_HERE,
1332 this, &AppsGridView::OnFolderItemReparentTimer); 1332 base::TimeDelta::FromMilliseconds(kFolderItemReparentDelay),
1333 this,
1334 &AppsGridView::OnFolderItemReparentTimer);
1333 drag_out_of_folder_container_ = true; 1335 drag_out_of_folder_container_ = true;
1334 } 1336 }
1335 } else { 1337 } else {
1336 folder_item_reparent_timer_.Stop(); 1338 folder_item_reparent_timer_.Stop();
1337 drag_out_of_folder_container_ = false; 1339 drag_out_of_folder_container_ = false;
1338 } 1340 }
1339 } 1341 }
1340 1342
1341 bool AppsGridView::IsDraggingForReparentInRootLevelGridView() const { 1343 bool AppsGridView::IsDraggingForReparentInRootLevelGridView() const {
1342 return (!folder_delegate_ && dragging_for_reparent_item_); 1344 return (!folder_delegate_ && dragging_for_reparent_item_);
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, 2100 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index,
2099 bool is_target_folder) { 2101 bool is_target_folder) {
2100 AppListItemView* target_view = 2102 AppListItemView* target_view =
2101 static_cast<AppListItemView*>( 2103 static_cast<AppListItemView*>(
2102 GetViewAtSlotOnCurrentPage(target_index.slot)); 2104 GetViewAtSlotOnCurrentPage(target_index.slot));
2103 if (target_view) 2105 if (target_view)
2104 target_view->SetAsAttemptedFolderTarget(is_target_folder); 2106 target_view->SetAsAttemptedFolderTarget(is_target_folder);
2105 } 2107 }
2106 2108
2107 } // namespace app_list 2109 } // 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