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 #ifndef UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 namespace test { | 44 namespace test { |
45 class AppsGridViewTestApi; | 45 class AppsGridViewTestApi; |
46 } | 46 } |
47 | 47 |
48 class ApplicationDragAndDropHost; | 48 class ApplicationDragAndDropHost; |
49 class AppListItemView; | 49 class AppListItemView; |
50 class AppsGridViewDelegate; | 50 class AppsGridViewDelegate; |
51 class AppsGridViewFolderDelegate; | 51 class AppsGridViewFolderDelegate; |
52 class PageSwitcher; | 52 class PageSwitcher; |
53 class PaginationModel; | 53 class PaginationController; |
54 | 54 |
55 // AppsGridView displays a grid for AppListItemList sub model. | 55 // AppsGridView displays a grid for AppListItemList sub model. |
56 class APP_LIST_EXPORT AppsGridView : public views::View, | 56 class APP_LIST_EXPORT AppsGridView : public views::View, |
57 public views::ButtonListener, | 57 public views::ButtonListener, |
58 public AppListItemListObserver, | 58 public AppListItemListObserver, |
59 public PaginationModelObserver, | 59 public PaginationModelObserver, |
60 public AppListModelObserver, | 60 public AppListModelObserver, |
61 public ui::ImplicitAnimationObserver { | 61 public ui::ImplicitAnimationObserver { |
62 public: | 62 public: |
63 enum Pointer { | 63 enum Pointer { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 private: | 218 private: |
219 friend class test::AppsGridViewTestApi; | 219 friend class test::AppsGridViewTestApi; |
220 | 220 |
221 enum DropAttempt { | 221 enum DropAttempt { |
222 DROP_FOR_NONE, | 222 DROP_FOR_NONE, |
223 DROP_FOR_REORDER, | 223 DROP_FOR_REORDER, |
224 DROP_FOR_FOLDER, | 224 DROP_FOR_FOLDER, |
225 }; | 225 }; |
226 | 226 |
227 enum ScrollAxis { SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL }; | |
228 | |
229 // Represents the index to an item view in the grid. | 227 // Represents the index to an item view in the grid. |
230 struct Index { | 228 struct Index { |
231 Index() : page(-1), slot(-1) {} | 229 Index() : page(-1), slot(-1) {} |
232 Index(int page, int slot) : page(page), slot(slot) {} | 230 Index(int page, int slot) : page(page), slot(slot) {} |
233 | 231 |
234 bool operator==(const Index& other) const { | 232 bool operator==(const Index& other) const { |
235 return page == other.page && slot == other.slot; | 233 return page == other.page && slot == other.slot; |
236 } | 234 } |
237 bool operator!=(const Index& other) const { | 235 bool operator!=(const Index& other) const { |
238 return page != other.page || slot != other.slot; | 236 return page != other.page || slot != other.slot; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 bool IsUnderOEMFolder(); | 452 bool IsUnderOEMFolder(); |
455 | 453 |
456 void StartSettingUpSynchronousDrag(); | 454 void StartSettingUpSynchronousDrag(); |
457 bool RunSynchronousDrag(); | 455 bool RunSynchronousDrag(); |
458 void CleanUpSynchronousDrag(); | 456 void CleanUpSynchronousDrag(); |
459 #if defined(OS_WIN) | 457 #if defined(OS_WIN) |
460 void OnGotShortcutPath(scoped_refptr<SynchronousDrag> drag, | 458 void OnGotShortcutPath(scoped_refptr<SynchronousDrag> drag, |
461 const base::FilePath& path); | 459 const base::FilePath& path); |
462 #endif | 460 #endif |
463 | 461 |
464 // Determines whether the grid view scrolls horizontally or vertically. | |
465 static ScrollAxis GetScrollAxis(); | |
466 | |
467 AppListModel* model_; // Owned by AppListView. | 462 AppListModel* model_; // Owned by AppListView. |
468 AppListItemList* item_list_; // Not owned. | 463 AppListItemList* item_list_; // Not owned. |
469 AppsGridViewDelegate* delegate_; | 464 AppsGridViewDelegate* delegate_; |
470 | 465 |
471 // This can be NULL. Only grid views inside folders have a folder delegate. | 466 // This can be NULL. Only grid views inside folders have a folder delegate. |
472 AppsGridViewFolderDelegate* folder_delegate_; | 467 AppsGridViewFolderDelegate* folder_delegate_; |
473 | 468 |
474 PaginationModel pagination_model_; | 469 PaginationModel pagination_model_; |
| 470 // Must appear after |pagination_model_|. |
| 471 scoped_ptr<PaginationController> pagination_controller_; |
475 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. | 472 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. |
476 | 473 |
477 int cols_; | 474 int cols_; |
478 int rows_per_page_; | 475 int rows_per_page_; |
479 | 476 |
480 // Tracks app item views. There is a view per item in |model_|. | 477 // Tracks app item views. There is a view per item in |model_|. |
481 views::ViewModel view_model_; | 478 views::ViewModel view_model_; |
482 | 479 |
483 // Tracks pulsing block views. | 480 // Tracks pulsing block views. |
484 views::ViewModel pulsing_blocks_model_; | 481 views::ViewModel pulsing_blocks_model_; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 553 |
557 // True if the drag_view_ item is a folder item being dragged for reparenting. | 554 // True if the drag_view_ item is a folder item being dragged for reparenting. |
558 bool dragging_for_reparent_item_; | 555 bool dragging_for_reparent_item_; |
559 | 556 |
560 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 557 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
561 }; | 558 }; |
562 | 559 |
563 } // namespace app_list | 560 } // namespace app_list |
564 | 561 |
565 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 562 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
OLD | NEW |