Chromium Code Reviews| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 | 366 |
| 367 void AppsGridView::SetLayout(int icon_size, int cols, int rows_per_page) { | 367 void AppsGridView::SetLayout(int icon_size, int cols, int rows_per_page) { |
| 368 icon_size_.SetSize(icon_size, icon_size); | 368 icon_size_.SetSize(icon_size, icon_size); |
| 369 cols_ = cols; | 369 cols_ = cols; |
| 370 rows_per_page_ = rows_per_page; | 370 rows_per_page_ = rows_per_page; |
| 371 | 371 |
| 372 SetBorder(views::Border::CreateEmptyBorder( | 372 SetBorder(views::Border::CreateEmptyBorder( |
| 373 kTopPadding, kLeftRightPadding, 0, kLeftRightPadding)); | 373 kTopPadding, kLeftRightPadding, 0, kLeftRightPadding)); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void AppsGridView::ResetForShow() { | |
| 377 activated_item_view_ = NULL; | |
| 378 layer()->SetOpacity(1.0f); | |
| 379 SetVisible(true); | |
| 380 // Set all views to visible in case they weren't made visible again by an | |
| 381 // incomplete animation. | |
| 382 for (int i = 0; i < view_model_.view_size(); ++i) { | |
| 383 view_model_.view_at(i)->SetVisible(true); | |
| 384 } | |
| 385 } | |
| 386 | |
| 376 void AppsGridView::SetModel(AppListModel* model) { | 387 void AppsGridView::SetModel(AppListModel* model) { |
| 377 if (model_) | 388 if (model_) |
| 378 model_->RemoveObserver(this); | 389 model_->RemoveObserver(this); |
| 379 | 390 |
| 380 model_ = model; | 391 model_ = model; |
| 381 if (model_) | 392 if (model_) |
| 382 model_->AddObserver(this); | 393 model_->AddObserver(this); |
| 383 | 394 |
| 384 Update(); | 395 Update(); |
| 385 } | 396 } |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1818 UpdatePulsingBlockViews(); | 1829 UpdatePulsingBlockViews(); |
| 1819 Layout(); | 1830 Layout(); |
| 1820 SchedulePaint(); | 1831 SchedulePaint(); |
| 1821 } | 1832 } |
| 1822 | 1833 |
| 1823 void AppsGridView::OnListItemRemoved(size_t index, AppListItem* item) { | 1834 void AppsGridView::OnListItemRemoved(size_t index, AppListItem* item) { |
| 1824 EndDrag(true); | 1835 EndDrag(true); |
| 1825 | 1836 |
| 1826 views::View* view = view_model_.view_at(index); | 1837 views::View* view = view_model_.view_at(index); |
| 1827 view_model_.Remove(index); | 1838 view_model_.Remove(index); |
| 1839 if (activated_item_view_ == view) | |
| 1840 activated_item_view_ = NULL; | |
|
jennyz
2014/03/28 16:59:46
Thanks!
| |
| 1828 delete view; | 1841 delete view; |
| 1829 | 1842 |
| 1830 UpdatePaging(); | 1843 UpdatePaging(); |
| 1831 UpdatePulsingBlockViews(); | 1844 UpdatePulsingBlockViews(); |
| 1832 Layout(); | 1845 Layout(); |
| 1833 SchedulePaint(); | 1846 SchedulePaint(); |
| 1834 } | 1847 } |
| 1835 | 1848 |
| 1836 void AppsGridView::OnListItemMoved(size_t from_index, | 1849 void AppsGridView::OnListItemMoved(size_t from_index, |
| 1837 size_t to_index, | 1850 size_t to_index, |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2075 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2088 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
| 2076 bool is_target_folder) { | 2089 bool is_target_folder) { |
| 2077 AppListItemView* target_view = | 2090 AppListItemView* target_view = |
| 2078 static_cast<AppListItemView*>( | 2091 static_cast<AppListItemView*>( |
| 2079 GetViewAtSlotOnCurrentPage(target_index.slot)); | 2092 GetViewAtSlotOnCurrentPage(target_index.slot)); |
| 2080 if (target_view) | 2093 if (target_view) |
| 2081 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2094 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
| 2082 } | 2095 } |
| 2083 | 2096 |
| 2084 } // namespace app_list | 2097 } // namespace app_list |
| OLD | NEW |