| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 drag_view_(NULL), | 213 drag_view_(NULL), |
| 214 drag_start_page_(-1), | 214 drag_start_page_(-1), |
| 215 drag_pointer_(NONE), | 215 drag_pointer_(NONE), |
| 216 drop_attempt_(DROP_FOR_NONE), | 216 drop_attempt_(DROP_FOR_NONE), |
| 217 drag_and_drop_host_(NULL), | 217 drag_and_drop_host_(NULL), |
| 218 forward_events_to_drag_and_drop_host_(false), | 218 forward_events_to_drag_and_drop_host_(false), |
| 219 page_flip_target_(-1), | 219 page_flip_target_(-1), |
| 220 page_flip_delay_in_ms_(kPageFlipDelayInMs), | 220 page_flip_delay_in_ms_(kPageFlipDelayInMs), |
| 221 bounds_animator_(this), | 221 bounds_animator_(this), |
| 222 activated_folder_item_view_(NULL), | 222 activated_folder_item_view_(NULL), |
| 223 dragging_for_reparent_item_(false) { | 223 dragging_for_reparent_item_(false), |
| 224 is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) { |
| 224 SetPaintToLayer(); | 225 SetPaintToLayer(); |
| 225 // 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 |
| 226 // 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. |
| 227 layer()->SetMasksToBounds(true); | 228 layer()->SetMasksToBounds(true); |
| 228 layer()->SetFillsBoundsOpaquely(false); | 229 layer()->SetFillsBoundsOpaquely(false); |
| 229 | 230 |
| 230 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, | 231 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, |
| 231 kOverscrollPageTransitionDurationMs); | 232 kOverscrollPageTransitionDurationMs); |
| 232 | 233 |
| 233 pagination_model_.AddObserver(this); | 234 pagination_model_.AddObserver(this); |
| 234 | 235 |
| 235 if (features::IsFullscreenAppListEnabled()) { | 236 if (is_fullscreen_app_list_enabled_) { |
| 236 page_switcher_view_ = new PageSwitcherVertical(&pagination_model_); | 237 page_switcher_view_ = new PageSwitcherVertical(&pagination_model_); |
| 237 pagination_controller_.reset(new PaginationController( | 238 pagination_controller_.reset(new PaginationController( |
| 238 &pagination_model_, PaginationController::SCROLL_AXIS_VERTICAL)); | 239 &pagination_model_, PaginationController::SCROLL_AXIS_VERTICAL)); |
| 239 } else { | 240 } else { |
| 240 page_switcher_view_ = new PageSwitcherHorizontal(&pagination_model_); | 241 page_switcher_view_ = new PageSwitcherHorizontal(&pagination_model_); |
| 241 pagination_controller_.reset(new PaginationController( | 242 pagination_controller_.reset(new PaginationController( |
| 242 &pagination_model_, PaginationController::SCROLL_AXIS_HORIZONTAL)); | 243 &pagination_model_, PaginationController::SCROLL_AXIS_HORIZONTAL)); |
| 243 } | 244 } |
| 244 AddChildView(page_switcher_view_); | 245 AddChildView(page_switcher_view_); |
| 245 } | 246 } |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 drag_and_drop_host_ = drag_and_drop_host; | 634 drag_and_drop_host_ = drag_and_drop_host; |
| 634 } | 635 } |
| 635 | 636 |
| 636 bool AppsGridView::IsAnimatingView(AppListItemView* view) { | 637 bool AppsGridView::IsAnimatingView(AppListItemView* view) { |
| 637 return bounds_animator_.IsAnimating(view); | 638 return bounds_animator_.IsAnimating(view); |
| 638 } | 639 } |
| 639 | 640 |
| 640 gfx::Size AppsGridView::CalculatePreferredSize() const { | 641 gfx::Size AppsGridView::CalculatePreferredSize() const { |
| 641 const gfx::Insets insets(GetInsets()); | 642 const gfx::Insets insets(GetInsets()); |
| 642 gfx::Size size = GetTileGridSize(); | 643 gfx::Size size = GetTileGridSize(); |
| 643 if (features::IsFullscreenAppListEnabled()) { | 644 if (is_fullscreen_app_list_enabled_) { |
| 644 // If we are in a folder, ignore the page switcher for width calculations. | 645 // If we are in a folder, ignore the page switcher for width calculations. |
| 645 int page_switcher_width = | 646 int page_switcher_width = |
| 646 folder_delegate_ ? 0 : page_switcher_view_->GetPreferredSize().width(); | 647 folder_delegate_ ? 0 : page_switcher_view_->GetPreferredSize().width(); |
| 647 size.Enlarge(insets.width() + page_switcher_width, insets.height()); | 648 size.Enlarge(insets.width() + page_switcher_width, insets.height()); |
| 648 } else { | 649 } else { |
| 649 // If we are in a folder, ignore the page switcher for height calculations. | 650 // If we are in a folder, ignore the page switcher for height calculations. |
| 650 int page_switcher_height = | 651 int page_switcher_height = |
| 651 folder_delegate_ ? 0 : page_switcher_view_->GetPreferredSize().height(); | 652 folder_delegate_ ? 0 : page_switcher_view_->GetPreferredSize().height(); |
| 652 size.Enlarge(insets.width(), insets.height() + page_switcher_height); | 653 size.Enlarge(insets.width(), insets.height() + page_switcher_height); |
| 653 } | 654 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 676 | 677 |
| 677 CalculateIdealBounds(); | 678 CalculateIdealBounds(); |
| 678 for (int i = 0; i < view_model_.view_size(); ++i) { | 679 for (int i = 0; i < view_model_.view_size(); ++i) { |
| 679 AppListItemView* view = GetItemViewAt(i); | 680 AppListItemView* view = GetItemViewAt(i); |
| 680 if (view != drag_view_) | 681 if (view != drag_view_) |
| 681 view->SetBoundsRect(view_model_.ideal_bounds(i)); | 682 view->SetBoundsRect(view_model_.ideal_bounds(i)); |
| 682 } | 683 } |
| 683 views::ViewModelUtils::SetViewBoundsToIdealBounds(pulsing_blocks_model_); | 684 views::ViewModelUtils::SetViewBoundsToIdealBounds(pulsing_blocks_model_); |
| 684 | 685 |
| 685 gfx::Rect rect(GetContentsBounds()); | 686 gfx::Rect rect(GetContentsBounds()); |
| 686 if (features::IsFullscreenAppListEnabled()) { | 687 if (is_fullscreen_app_list_enabled_) { |
| 687 const int page_switcher_width = | 688 const int page_switcher_width = |
| 688 page_switcher_view_->GetPreferredSize().width(); | 689 page_switcher_view_->GetPreferredSize().width(); |
| 689 rect.set_x(rect.right() - page_switcher_width); | 690 rect.set_x(rect.right() - page_switcher_width); |
| 690 rect.set_width(page_switcher_width); | 691 rect.set_width(page_switcher_width); |
| 691 } else { | 692 } else { |
| 692 const int page_switcher_height = | 693 const int page_switcher_height = |
| 693 page_switcher_view_->GetPreferredSize().height(); | 694 page_switcher_view_->GetPreferredSize().height(); |
| 694 rect.set_y(rect.bottom() - page_switcher_height); | 695 rect.set_y(rect.bottom() - page_switcher_height); |
| 695 rect.set_height(page_switcher_height); | 696 rect.set_height(page_switcher_height); |
| 696 } | 697 } |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 | 1934 |
| 1934 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 1935 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
| 1935 bool is_target_folder) { | 1936 bool is_target_folder) { |
| 1936 AppListItemView* target_view = | 1937 AppListItemView* target_view = |
| 1937 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); | 1938 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); |
| 1938 if (target_view) | 1939 if (target_view) |
| 1939 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 1940 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
| 1940 } | 1941 } |
| 1941 | 1942 |
| 1942 } // namespace app_list | 1943 } // namespace app_list |
| OLD | NEW |