| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 drag_start_page_(-1), | 215 drag_start_page_(-1), |
| 216 drag_pointer_(NONE), | 216 drag_pointer_(NONE), |
| 217 drop_attempt_(DROP_FOR_NONE), | 217 drop_attempt_(DROP_FOR_NONE), |
| 218 drag_and_drop_host_(NULL), | 218 drag_and_drop_host_(NULL), |
| 219 forward_events_to_drag_and_drop_host_(false), | 219 forward_events_to_drag_and_drop_host_(false), |
| 220 page_flip_target_(-1), | 220 page_flip_target_(-1), |
| 221 page_flip_delay_in_ms_(kPageFlipDelayInMs), | 221 page_flip_delay_in_ms_(kPageFlipDelayInMs), |
| 222 bounds_animator_(this), | 222 bounds_animator_(this), |
| 223 activated_folder_item_view_(NULL), | 223 activated_folder_item_view_(NULL), |
| 224 dragging_for_reparent_item_(false) { | 224 dragging_for_reparent_item_(false) { |
| 225 SetPaintToLayer(true); | 225 SetPaintToLayer(); |
| 226 // Clip any icons that are outside the grid view's bounds. These icons would | 226 // Clip any icons that are outside the grid view's bounds. These icons would |
| 227 // otherwise be visible to the user when the grid view is off screen. | 227 // otherwise be visible to the user when the grid view is off screen. |
| 228 layer()->SetMasksToBounds(true); | 228 layer()->SetMasksToBounds(true); |
| 229 layer()->SetFillsBoundsOpaquely(false); | 229 layer()->SetFillsBoundsOpaquely(false); |
| 230 | 230 |
| 231 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, | 231 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, |
| 232 kOverscrollPageTransitionDurationMs); | 232 kOverscrollPageTransitionDurationMs); |
| 233 | 233 |
| 234 pagination_model_.AddObserver(this); | 234 pagination_model_.AddObserver(this); |
| 235 pagination_controller_.reset(new PaginationController( | 235 pagination_controller_.reset(new PaginationController( |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 // Since the item is new, its placeholder is conceptually at the back of the | 552 // Since the item is new, its placeholder is conceptually at the back of the |
| 553 // entire apps grid. | 553 // entire apps grid. |
| 554 reorder_placeholder_ = GetLastViewIndex(); | 554 reorder_placeholder_ = GetLastViewIndex(); |
| 555 | 555 |
| 556 // Create a new AppListItemView to duplicate the original_drag_view in the | 556 // Create a new AppListItemView to duplicate the original_drag_view in the |
| 557 // folder's grid view. | 557 // folder's grid view. |
| 558 AppListItemView* view = new AppListItemView(this, original_drag_view->item()); | 558 AppListItemView* view = new AppListItemView(this, original_drag_view->item()); |
| 559 AddChildView(view); | 559 AddChildView(view); |
| 560 drag_view_ = view; | 560 drag_view_ = view; |
| 561 drag_view_->SetPaintToLayer(true); | 561 drag_view_->SetPaintToLayer(); |
| 562 drag_view_->layer()->SetFillsBoundsOpaquely(false); | 562 drag_view_->layer()->SetFillsBoundsOpaquely(false); |
| 563 drag_view_->SetBoundsRect(drag_view_rect); | 563 drag_view_->SetBoundsRect(drag_view_rect); |
| 564 drag_view_->SetDragUIState(); // Hide the title of the drag_view_. | 564 drag_view_->SetDragUIState(); // Hide the title of the drag_view_. |
| 565 | 565 |
| 566 // Hide the drag_view_ for drag icon proxy when a native drag is responsible | 566 // Hide the drag_view_ for drag icon proxy when a native drag is responsible |
| 567 // for showing the icon. | 567 // for showing the icon. |
| 568 if (has_native_drag) | 568 if (has_native_drag) |
| 569 SetViewHidden(drag_view_, true /* hide */, true /* no animate */); | 569 SetViewHidden(drag_view_, true /* hide */, true /* no animate */); |
| 570 | 570 |
| 571 // Add drag_view_ to the end of the view_model_. | 571 // Add drag_view_ to the end of the view_model_. |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 AddChildView(view); | 818 AddChildView(view); |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 | 821 |
| 822 AppListItemView* AppsGridView::CreateViewForItemAtIndex(size_t index) { | 822 AppListItemView* AppsGridView::CreateViewForItemAtIndex(size_t index) { |
| 823 // The drag_view_ might be pending for deletion, therefore view_model_ | 823 // The drag_view_ might be pending for deletion, therefore view_model_ |
| 824 // may have one more item than item_list_. | 824 // may have one more item than item_list_. |
| 825 DCHECK_LE(index, item_list_->item_count()); | 825 DCHECK_LE(index, item_list_->item_count()); |
| 826 AppListItemView* view = new AppListItemView(this, | 826 AppListItemView* view = new AppListItemView(this, |
| 827 item_list_->item_at(index)); | 827 item_list_->item_at(index)); |
| 828 view->SetPaintToLayer(true); | 828 view->SetPaintToLayer(); |
| 829 view->layer()->SetFillsBoundsOpaquely(false); | 829 view->layer()->SetFillsBoundsOpaquely(false); |
| 830 return view; | 830 return view; |
| 831 } | 831 } |
| 832 | 832 |
| 833 AppsGridView::Index AppsGridView::GetIndexFromModelIndex( | 833 AppsGridView::Index AppsGridView::GetIndexFromModelIndex( |
| 834 int model_index) const { | 834 int model_index) const { |
| 835 return Index(model_index / tiles_per_page(), model_index % tiles_per_page()); | 835 return Index(model_index / tiles_per_page(), model_index % tiles_per_page()); |
| 836 } | 836 } |
| 837 | 837 |
| 838 int AppsGridView::GetModelIndexFromIndex(const Index& index) const { | 838 int AppsGridView::GetModelIndexFromIndex(const Index& index) const { |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 | 1915 |
| 1916 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 1916 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
| 1917 bool is_target_folder) { | 1917 bool is_target_folder) { |
| 1918 AppListItemView* target_view = | 1918 AppListItemView* target_view = |
| 1919 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); | 1919 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); |
| 1920 if (target_view) | 1920 if (target_view) |
| 1921 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 1921 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
| 1922 } | 1922 } |
| 1923 | 1923 |
| 1924 } // namespace app_list | 1924 } // namespace app_list |
| OLD | NEW |