| 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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class SynchronousDrag; | 44 class SynchronousDrag; |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 namespace test { | 47 namespace test { |
| 48 class AppsGridViewTestApi; | 48 class AppsGridViewTestApi; |
| 49 } | 49 } |
| 50 | 50 |
| 51 class ApplicationDragAndDropHost; | 51 class ApplicationDragAndDropHost; |
| 52 class AppListItemView; | 52 class AppListItemView; |
| 53 class AppsGridViewDelegate; | 53 class AppsGridViewDelegate; |
| 54 class AppsGridViewFolderDelegate; |
| 54 class PageSwitcher; | 55 class PageSwitcher; |
| 55 class PaginationModel; | 56 class PaginationModel; |
| 56 | 57 |
| 57 // AppsGridView displays a grid for AppListItemList sub model. | 58 // AppsGridView displays a grid for AppListItemList sub model. |
| 58 class APP_LIST_EXPORT AppsGridView : public views::View, | 59 class APP_LIST_EXPORT AppsGridView : public views::View, |
| 59 public views::ButtonListener, | 60 public views::ButtonListener, |
| 60 public AppListItemListObserver, | 61 public AppListItemListObserver, |
| 61 public PaginationModelObserver, | 62 public PaginationModelObserver, |
| 62 public AppListModelObserver, | 63 public AppListModelObserver, |
| 63 public ui::ImplicitAnimationObserver { | 64 public ui::ImplicitAnimationObserver { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 const views::ViewModel* view_model_for_test() const { return &view_model_; } | 190 const views::ViewModel* view_model_for_test() const { return &view_model_; } |
| 190 | 191 |
| 191 // For test: Return if the drag and drop handler was set. | 192 // For test: Return if the drag and drop handler was set. |
| 192 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; } | 193 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; } |
| 193 | 194 |
| 194 // For test: Return if the drag and drop operation gets dispatched. | 195 // For test: Return if the drag and drop operation gets dispatched. |
| 195 bool forward_events_to_drag_and_drop_host_for_test() { | 196 bool forward_events_to_drag_and_drop_host_for_test() { |
| 196 return forward_events_to_drag_and_drop_host_; | 197 return forward_events_to_drag_and_drop_host_; |
| 197 } | 198 } |
| 198 | 199 |
| 199 void set_is_root_level(bool value) { is_root_level_ = value; } | 200 void set_folder_delegate(AppsGridViewFolderDelegate* folder_delegate) { |
| 201 folder_delegate_ = folder_delegate; |
| 202 } |
| 200 | 203 |
| 201 AppListItemView* activated_item_view() const { | 204 AppListItemView* activated_item_view() const { |
| 202 return activated_item_view_; | 205 return activated_item_view_; |
| 203 } | 206 } |
| 204 | 207 |
| 205 private: | 208 private: |
| 206 friend class test::AppsGridViewTestApi; | 209 friend class test::AppsGridViewTestApi; |
| 207 | 210 |
| 208 enum DropAttempt { | 211 enum DropAttempt { |
| 209 DROP_FOR_NONE, | 212 DROP_FOR_NONE, |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // Updates drag state for dragging inside a folder's grid view. | 423 // Updates drag state for dragging inside a folder's grid view. |
| 421 void UpdateDragStateInsideFolder(Pointer pointer, | 424 void UpdateDragStateInsideFolder(Pointer pointer, |
| 422 const ui::LocatedEvent& event); | 425 const ui::LocatedEvent& event); |
| 423 | 426 |
| 424 // Returns true if drag event is happening in the root level AppsGridView | 427 // Returns true if drag event is happening in the root level AppsGridView |
| 425 // for reparenting a folder item. | 428 // for reparenting a folder item. |
| 426 bool IsDraggingForReparentInRootLevelGridView() const; | 429 bool IsDraggingForReparentInRootLevelGridView() const; |
| 427 | 430 |
| 428 // Returns true if drag event is happening in the hidden AppsGridView of the | 431 // Returns true if drag event is happening in the hidden AppsGridView of the |
| 429 // folder during reparenting a folder item. | 432 // folder during reparenting a folder item. |
| 430 bool IsDraggingForReprentInHiddenGridView() const; | 433 bool IsDraggingForReparentInHiddenGridView() const; |
| 431 | 434 |
| 432 // Returns the target icon bounds for |drag_item_view| to fly back | 435 // Returns the target icon bounds for |drag_item_view| to fly back |
| 433 // to its parent |folder_item_view| in animation. | 436 // to its parent |folder_item_view| in animation. |
| 434 gfx::Rect GetTargetIconRectInFolder(AppListItemView* drag_item_view, | 437 gfx::Rect GetTargetIconRectInFolder(AppListItemView* drag_item_view, |
| 435 AppListItemView* folder_item_view); | 438 AppListItemView* folder_item_view); |
| 436 | 439 |
| 437 // Returns true if the grid view is under an OEM folder. | 440 // Returns true if the grid view is under an OEM folder. |
| 438 bool IsUnderOEMFolder(); | 441 bool IsUnderOEMFolder(); |
| 439 | 442 |
| 440 AppListModel* model_; // Owned by AppListView. | 443 AppListModel* model_; // Owned by AppListView. |
| 441 AppListItemList* item_list_; // Not owned. | 444 AppListItemList* item_list_; // Not owned. |
| 442 AppsGridViewDelegate* delegate_; | 445 AppsGridViewDelegate* delegate_; |
| 446 |
| 447 // This can be NULL. Only grid views inside folders have a folder delegate. |
| 448 AppsGridViewFolderDelegate* folder_delegate_; |
| 449 |
| 443 PaginationModel* pagination_model_; // Owned by AppListController. | 450 PaginationModel* pagination_model_; // Owned by AppListController. |
| 444 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. | 451 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. |
| 445 | 452 |
| 446 gfx::Size icon_size_; | 453 gfx::Size icon_size_; |
| 447 int cols_; | 454 int cols_; |
| 448 int rows_per_page_; | 455 int rows_per_page_; |
| 449 | 456 |
| 450 // Tracks app item views. There is a view per item in |model_|. | 457 // Tracks app item views. There is a view per item in |model_|. |
| 451 views::ViewModel view_model_; | 458 views::ViewModel view_model_; |
| 452 | 459 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 514 |
| 508 // Target page to switch to when |page_flip_timer_| fires. | 515 // Target page to switch to when |page_flip_timer_| fires. |
| 509 int page_flip_target_; | 516 int page_flip_target_; |
| 510 | 517 |
| 511 // Delay in milliseconds of when |page_flip_timer_| should fire after user | 518 // Delay in milliseconds of when |page_flip_timer_| should fire after user |
| 512 // drags an item near the edges. | 519 // drags an item near the edges. |
| 513 int page_flip_delay_in_ms_; | 520 int page_flip_delay_in_ms_; |
| 514 | 521 |
| 515 views::BoundsAnimator bounds_animator_; | 522 views::BoundsAnimator bounds_animator_; |
| 516 | 523 |
| 517 // If true, AppsGridView is rending items at the root level of the app list. | |
| 518 bool is_root_level_; | |
| 519 | |
| 520 // The most recent activated item view. | 524 // The most recent activated item view. |
| 521 AppListItemView* activated_item_view_; | 525 AppListItemView* activated_item_view_; |
| 522 | 526 |
| 523 // Tracks if drag_view_ is dragged out of the folder container bubble | 527 // Tracks if drag_view_ is dragged out of the folder container bubble |
| 524 // when dragging a item inside a folder. | 528 // when dragging a item inside a folder. |
| 525 bool drag_out_of_folder_container_; | 529 bool drag_out_of_folder_container_; |
| 526 | 530 |
| 527 // True if the drag_view_ item is a folder item being dragged for reparenting. | 531 // True if the drag_view_ item is a folder item being dragged for reparenting. |
| 528 bool dragging_for_reparent_item_; | 532 bool dragging_for_reparent_item_; |
| 529 | 533 |
| 530 base::WeakPtrFactory<AppsGridView> weak_factory_; | 534 base::WeakPtrFactory<AppsGridView> weak_factory_; |
| 531 | 535 |
| 532 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 536 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
| 533 }; | 537 }; |
| 534 | 538 |
| 535 } // namespace app_list | 539 } // namespace app_list |
| 536 | 540 |
| 537 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 541 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
| OLD | NEW |