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 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 kLeftRightPadding = 23; | |
| 64 const int kTopPadding = 1; | 63 const int kTopPadding = 1; |
| 64 const int kBottomPadding = 1; | |
| 65 | 65 |
| 66 // Padding space in pixels between pages. | 66 // Padding space in pixels between pages. |
| 67 const int kPagePadding = 40; | 67 const int kPagePadding = 40; |
| 68 | 68 |
| 69 // Preferred tile size when showing in fixed layout. | 69 // Preferred tile size when showing in fixed layout. |
| 70 const int kPreferredTileWidth = 88; | 70 const int kPreferredTileWidth = 88; |
| 71 const int kPreferredTileHeight = 98; | 71 const int kPreferredTileHeight = 98; |
| 72 | 72 |
| 73 const int kExperimentalPreferredTileWidth = 90; | 73 const int kExperimentalPreferredTileWidth = 90; |
| 74 const int kExperimentalPrefferedTileHeight = 90; | 74 const int kExperimentalPreferredTileHeight = 90; |
|
Matt Giuca
2014/10/23 05:16:34
lol.
| |
| 75 | 75 |
| 76 // Padding on each side of a tile. | 76 // Padding on each side of a tile. |
| 77 const int kExperimentalTileLeftRightPadding = 15; | 77 const int kExperimentalTileLeftRightPadding = 15; |
| 78 const int kExperimentalTileTopBottomPadding = 11; | 78 const int kExperimentalTileTopBottomPadding = 11; |
| 79 | 79 |
| 80 // Width in pixels of the area on the sides that triggers a page flip. | 80 // Width in pixels of the area on the sides that triggers a page flip. |
| 81 const int kPageFlipZoneSize = 40; | 81 const int kPageFlipZoneSize = 40; |
| 82 | 82 |
| 83 // Delay in milliseconds to do the page flip. | 83 // Delay in milliseconds to do the page flip. |
| 84 const int kPageFlipDelayInMs = 1000; | 84 const int kPageFlipDelayInMs = 1000; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 99 const int kFolderItemReparentDelay = 50; | 99 const int kFolderItemReparentDelay = 50; |
| 100 | 100 |
| 101 // Radius of the circle, in which if entered, show folder dropping preview | 101 // Radius of the circle, in which if entered, show folder dropping preview |
| 102 // UI. | 102 // UI. |
| 103 const int kFolderDroppingCircleRadius = 39; | 103 const int kFolderDroppingCircleRadius = 39; |
| 104 | 104 |
| 105 // Returns the size of a tile view excluding its padding. | 105 // Returns the size of a tile view excluding its padding. |
| 106 gfx::Size GetTileViewSize() { | 106 gfx::Size GetTileViewSize() { |
| 107 return switches::IsExperimentalAppListEnabled() | 107 return switches::IsExperimentalAppListEnabled() |
| 108 ? gfx::Size(kExperimentalPreferredTileWidth, | 108 ? gfx::Size(kExperimentalPreferredTileWidth, |
| 109 kExperimentalPrefferedTileHeight) | 109 kExperimentalPreferredTileHeight) |
| 110 : gfx::Size(kPreferredTileWidth, kPreferredTileHeight); | 110 : gfx::Size(kPreferredTileWidth, kPreferredTileHeight); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Returns the size of a tile view inccluding its padding. | 113 // Returns the size of a tile view inccluding its padding. |
| 114 gfx::Size GetTotalTileSize() { | 114 gfx::Size GetTotalTileSize() { |
| 115 gfx::Size size = GetTileViewSize(); | 115 gfx::Size size = GetTileViewSize(); |
| 116 if (switches::IsExperimentalAppListEnabled()) | 116 if (switches::IsExperimentalAppListEnabled()) |
| 117 size.Enlarge(2 * kExperimentalTileLeftRightPadding, | 117 size.Enlarge(2 * kExperimentalTileLeftRightPadding, |
| 118 2 * kExperimentalTileTopBottomPadding); | 118 2 * kExperimentalTileTopBottomPadding); |
| 119 return size; | 119 return size; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 view_model_.Clear(); | 419 view_model_.Clear(); |
| 420 RemoveAllChildViews(true); | 420 RemoveAllChildViews(true); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void AppsGridView::SetLayout(int cols, int rows_per_page) { | 423 void AppsGridView::SetLayout(int cols, int rows_per_page) { |
| 424 cols_ = cols; | 424 cols_ = cols; |
| 425 rows_per_page_ = rows_per_page; | 425 rows_per_page_ = rows_per_page; |
| 426 | 426 |
| 427 SetBorder(views::Border::CreateEmptyBorder( | 427 SetBorder(views::Border::CreateEmptyBorder( |
| 428 switches::IsExperimentalAppListEnabled() ? 0 : kTopPadding, | 428 switches::IsExperimentalAppListEnabled() ? 0 : kTopPadding, |
| 429 kLeftRightPadding, | 429 kExperimentalWindowPadding, |
|
Matt Giuca
2014/10/23 05:16:34
This seems to be that the old app list will use kE
calamity
2014/10/23 05:50:35
Hmm. Fair enough. Done.
| |
| 430 0, | 430 kBottomPadding, |
| 431 kLeftRightPadding)); | 431 kExperimentalWindowPadding)); |
| 432 } | 432 } |
| 433 | 433 |
| 434 void AppsGridView::ResetForShowApps() { | 434 void AppsGridView::ResetForShowApps() { |
| 435 activated_folder_item_view_ = NULL; | 435 activated_folder_item_view_ = NULL; |
| 436 ClearDragState(); | 436 ClearDragState(); |
| 437 layer()->SetOpacity(1.0f); | 437 layer()->SetOpacity(1.0f); |
| 438 SetVisible(true); | 438 SetVisible(true); |
| 439 // Set all views to visible in case they weren't made visible again by an | 439 // Set all views to visible in case they weren't made visible again by an |
| 440 // incomplete animation. | 440 // incomplete animation. |
| 441 for (int i = 0; i < view_model_.view_size(); ++i) { | 441 for (int i = 0; i < view_model_.view_size(); ++i) { |
| (...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2151 | 2151 |
| 2152 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2152 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
| 2153 bool is_target_folder) { | 2153 bool is_target_folder) { |
| 2154 AppListItemView* target_view = | 2154 AppListItemView* target_view = |
| 2155 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); | 2155 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); |
| 2156 if (target_view) | 2156 if (target_view) |
| 2157 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2157 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
| 2158 } | 2158 } |
| 2159 | 2159 |
| 2160 } // namespace app_list | 2160 } // namespace app_list |
| OLD | NEW |