| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 namespace { | 54 namespace { |
| 55 | 55 |
| 56 // Distance a drag needs to be from the app grid to be considered 'outside', at | 56 // Distance a drag needs to be from the app grid to be considered 'outside', at |
| 57 // which point we rearrange the apps to their pre-drag configuration, as a drop | 57 // which point we rearrange the apps to their pre-drag configuration, as a drop |
| 58 // then would be canceled. We have a buffer to make it easier to drag apps to | 58 // then would be canceled. We have a buffer to make it easier to drag apps to |
| 59 // other pages. | 59 // other pages. |
| 60 const int kDragBufferPx = 20; | 60 const int kDragBufferPx = 20; |
| 61 | 61 |
| 62 // Padding space in pixels for fixed layout. | 62 // Padding space in pixels for fixed layout. |
| 63 const int kTopPadding = 1; | 63 const int kBottomPadding = 3; |
| 64 const int kBottomPadding = 1; | |
| 65 const int kLeftRightPadding = 24; | 64 const int kLeftRightPadding = 24; |
| 66 | 65 |
| 67 // Padding space in pixels between pages. | 66 // Padding space in pixels between pages. |
| 68 const int kPagePadding = 40; | 67 const int kPagePadding = 40; |
| 69 | 68 |
| 70 // Preferred tile size when showing in fixed layout. | 69 // Preferred tile size when showing in fixed layout. |
| 71 const int kPreferredTileWidth = 88; | 70 const int kPreferredTileWidth = 88; |
| 72 const int kPreferredTileHeight = 98; | 71 const int kPreferredTileHeight = 98; |
| 73 | 72 |
| 74 const int kExperimentalPreferredTileWidth = 90; | 73 const int kExperimentalPreferredTileWidth = 90; |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 // Make sure |page_switcher_view_| is deleted before |pagination_model_|. | 418 // Make sure |page_switcher_view_| is deleted before |pagination_model_|. |
| 420 view_model_.Clear(); | 419 view_model_.Clear(); |
| 421 RemoveAllChildViews(true); | 420 RemoveAllChildViews(true); |
| 422 } | 421 } |
| 423 | 422 |
| 424 void AppsGridView::SetLayout(int cols, int rows_per_page) { | 423 void AppsGridView::SetLayout(int cols, int rows_per_page) { |
| 425 cols_ = cols; | 424 cols_ = cols; |
| 426 rows_per_page_ = rows_per_page; | 425 rows_per_page_ = rows_per_page; |
| 427 | 426 |
| 428 if (switches::IsExperimentalAppListEnabled()) { | 427 if (switches::IsExperimentalAppListEnabled()) { |
| 429 SetBorder(views::Border::CreateEmptyBorder(0, | 428 SetBorder(views::Border::CreateEmptyBorder( |
| 430 kExperimentalWindowPadding, | 429 0, kExperimentalWindowPadding, 0, kExperimentalWindowPadding)); |
| 431 kBottomPadding, | |
| 432 kExperimentalWindowPadding)); | |
| 433 } else { | 430 } else { |
| 434 SetBorder(views::Border::CreateEmptyBorder( | 431 SetBorder(views::Border::CreateEmptyBorder( |
| 435 kTopPadding, kLeftRightPadding, kBottomPadding, kLeftRightPadding)); | 432 0, kLeftRightPadding, kBottomPadding, kLeftRightPadding)); |
| 436 } | 433 } |
| 437 } | 434 } |
| 438 | 435 |
| 439 void AppsGridView::ResetForShowApps() { | 436 void AppsGridView::ResetForShowApps() { |
| 440 activated_folder_item_view_ = NULL; | 437 activated_folder_item_view_ = NULL; |
| 441 ClearDragState(); | 438 ClearDragState(); |
| 442 layer()->SetOpacity(1.0f); | 439 layer()->SetOpacity(1.0f); |
| 443 SetVisible(true); | 440 SetVisible(true); |
| 444 // Set all views to visible in case they weren't made visible again by an | 441 // Set all views to visible in case they weren't made visible again by an |
| 445 // incomplete animation. | 442 // incomplete animation. |
| (...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 | 2153 |
| 2157 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2154 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
| 2158 bool is_target_folder) { | 2155 bool is_target_folder) { |
| 2159 AppListItemView* target_view = | 2156 AppListItemView* target_view = |
| 2160 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); | 2157 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); |
| 2161 if (target_view) | 2158 if (target_view) |
| 2162 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2159 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
| 2163 } | 2160 } |
| 2164 | 2161 |
| 2165 } // namespace app_list | 2162 } // namespace app_list |
| OLD | NEW |