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

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

Issue 600393002: AppListModel / AppsGridView: Better error handling for corner cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@appsgridview-static-casts
Patch Set: Comment. Created 6 years, 2 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 | « ui/app_list/app_list_model_unittest.cc ('k') | 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 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 1730
1731 if (pagination_model_.selected_page() != target.page) 1731 if (pagination_model_.selected_page() != target.page)
1732 pagination_model_.SelectPage(target.page, false); 1732 pagination_model_.SelectPage(target.page, false);
1733 } 1733 }
1734 1734
1735 void AppsGridView::MoveItemToFolder(AppListItemView* item_view, 1735 void AppsGridView::MoveItemToFolder(AppListItemView* item_view,
1736 const Index& target) { 1736 const Index& target) {
1737 const std::string& source_item_id = item_view->item()->id(); 1737 const std::string& source_item_id = item_view->item()->id();
1738 AppListItemView* target_view = 1738 AppListItemView* target_view =
1739 GetViewDisplayedAtSlotOnCurrentPage(target.slot); 1739 GetViewDisplayedAtSlotOnCurrentPage(target.slot);
1740 DCHECK(target_view);
1740 const std::string& target_view_item_id = target_view->item()->id(); 1741 const std::string& target_view_item_id = target_view->item()->id();
1741 1742
1743 // Check that the item is not being dropped onto itself; this should not
1744 // happen, but it can if something allows multiple views to share an
1745 // item (e.g., if a folder drop does not clean up properly).
1746 DCHECK_NE(source_item_id, target_view_item_id);
1747
1742 // Make change to data model. 1748 // Make change to data model.
1743 item_list_->RemoveObserver(this); 1749 item_list_->RemoveObserver(this);
1744 std::string folder_item_id = 1750 std::string folder_item_id =
1745 model_->MergeItems(target_view_item_id, source_item_id); 1751 model_->MergeItems(target_view_item_id, source_item_id);
1746 item_list_->AddObserver(this); 1752 item_list_->AddObserver(this);
1747 if (folder_item_id.empty()) { 1753 if (folder_item_id.empty()) {
1748 LOG(ERROR) << "Unable to merge into item id: " << target_view_item_id; 1754 LOG(ERROR) << "Unable to merge into item id: " << target_view_item_id;
1749 return; 1755 return;
1750 } 1756 }
1751 if (folder_item_id != target_view_item_id) { 1757 if (folder_item_id != target_view_item_id) {
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
2140 2146
2141 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, 2147 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index,
2142 bool is_target_folder) { 2148 bool is_target_folder) {
2143 AppListItemView* target_view = 2149 AppListItemView* target_view =
2144 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); 2150 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot);
2145 if (target_view) 2151 if (target_view)
2146 target_view->SetAsAttemptedFolderTarget(is_target_folder); 2152 target_view->SetAsAttemptedFolderTarget(is_target_folder);
2147 } 2153 }
2148 2154
2149 } // namespace app_list 2155 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list_model_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698