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 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 | 2170 |
2174 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, | 2171 void AppsGridView::SetAsFolderDroppingTarget(const Index& target_index, |
2175 bool is_target_folder) { | 2172 bool is_target_folder) { |
2176 AppListItemView* target_view = | 2173 AppListItemView* target_view = |
2177 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); | 2174 GetViewDisplayedAtSlotOnCurrentPage(target_index.slot); |
2178 if (target_view) | 2175 if (target_view) |
2179 target_view->SetAsAttemptedFolderTarget(is_target_folder); | 2176 target_view->SetAsAttemptedFolderTarget(is_target_folder); |
2180 } | 2177 } |
2181 | 2178 |
2182 } // namespace app_list | 2179 } // namespace app_list |
OLD | NEW |