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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 447 } |
448 CHECK_EQ(item_list_->item_count(), | 448 CHECK_EQ(item_list_->item_count(), |
449 static_cast<size_t>(view_model_.view_size())); | 449 static_cast<size_t>(view_model_.view_size())); |
450 } | 450 } |
451 | 451 |
452 void AppsGridView::SetModel(AppListModel* model) { | 452 void AppsGridView::SetModel(AppListModel* model) { |
453 if (model_) | 453 if (model_) |
454 model_->RemoveObserver(this); | 454 model_->RemoveObserver(this); |
455 | 455 |
456 model_ = model; | 456 model_ = model; |
457 if (model_) | 457 if (model_) { DLOG(ERROR) << "gridView - setmodel"; |
458 model_->AddObserver(this); | 458 model_->AddObserver(this); |
| 459 } |
459 | 460 |
460 Update(); | 461 Update(); |
461 } | 462 } |
462 | 463 |
463 void AppsGridView::SetItemList(AppListItemList* item_list) { | 464 void AppsGridView::SetItemList(AppListItemList* item_list) { |
464 if (item_list_) | 465 if (item_list_) |
465 item_list_->RemoveObserver(this); | 466 item_list_->RemoveObserver(this); |
466 item_list_ = item_list; | 467 item_list_ = item_list; |
467 if (item_list_) | 468 if (item_list_) |
468 item_list_->AddObserver(this); | 469 item_list_->AddObserver(this); |
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 // Must move to target_model_index, the location we expect the target item | 1835 // Must move to target_model_index, the location we expect the target item |
1835 // to be, not the item location we want to insert before. | 1836 // to be, not the item location we want to insert before. |
1836 int current_model_index = view_model_.GetIndexOfView(item_view); | 1837 int current_model_index = view_model_.GetIndexOfView(item_view); |
1837 syncer::StringOrdinal target_position; | 1838 syncer::StringOrdinal target_position; |
1838 if (target_model_index < static_cast<int>(item_list_->item_count())) | 1839 if (target_model_index < static_cast<int>(item_list_->item_count())) |
1839 target_position = item_list_->item_at(target_model_index)->position(); | 1840 target_position = item_list_->item_at(target_model_index)->position(); |
1840 model_->MoveItemToFolderAt(reparent_item, "", target_position); | 1841 model_->MoveItemToFolderAt(reparent_item, "", target_position); |
1841 view_model_.Move(current_model_index, target_model_index); | 1842 view_model_.Move(current_model_index, target_model_index); |
1842 | 1843 |
1843 RemoveLastItemFromReparentItemFolderIfNecessary(source_folder_id); | 1844 RemoveLastItemFromReparentItemFolderIfNecessary(source_folder_id); |
1844 | 1845 DLOG(ERROR) << "gridview reparent"; |
1845 item_list_->AddObserver(this); | 1846 item_list_->AddObserver(this); |
1846 model_->AddObserver(this); | 1847 model_->AddObserver(this); |
1847 UpdatePaging(); | 1848 UpdatePaging(); |
1848 } | 1849 } |
1849 | 1850 |
1850 bool AppsGridView::ReparentItemToAnotherFolder(AppListItemView* item_view, | 1851 bool AppsGridView::ReparentItemToAnotherFolder(AppListItemView* item_view, |
1851 const Index& target) { | 1852 const Index& target) { |
1852 DCHECK(IsDraggingForReparentInRootLevelGridView()); | 1853 DCHECK(IsDraggingForReparentInRootLevelGridView()); |
1853 | 1854 |
1854 AppListItemView* target_view = | 1855 AppListItemView* target_view = |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 | 2170 |
2170 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2171 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
2171 bool is_target_folder) { | 2172 bool is_target_folder) { |
2172 AppListItemView* target_view = | 2173 AppListItemView* target_view = |
2173 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); | 2174 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); |
2174 if (target_view) | 2175 if (target_view) |
2175 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2176 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
2176 } | 2177 } |
2177 | 2178 |
2178 } // namespace app_list | 2179 } // namespace app_list |
OLD | NEW |