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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 class SynchronousDrag; | 43 class SynchronousDrag; |
44 #endif | 44 #endif |
45 | 45 |
46 namespace test { | 46 namespace test { |
47 class AppsGridViewTestApi; | 47 class AppsGridViewTestApi; |
48 } | 48 } |
49 | 49 |
50 class ApplicationDragAndDropHost; | 50 class ApplicationDragAndDropHost; |
51 class AppListItemView; | 51 class AppListItemView; |
52 class AppsGridViewDelegate; | 52 class AppsGridViewDelegate; |
53 class AppsGridViewFolderDelegate; | |
53 class PageSwitcher; | 54 class PageSwitcher; |
54 class PaginationModel; | 55 class PaginationModel; |
55 | 56 |
56 // AppsGridView displays a grid for AppListItemList sub model. | 57 // AppsGridView displays a grid for AppListItemList sub model. |
57 class APP_LIST_EXPORT AppsGridView : public views::View, | 58 class APP_LIST_EXPORT AppsGridView : public views::View, |
58 public views::ButtonListener, | 59 public views::ButtonListener, |
59 public AppListItemListObserver, | 60 public AppListItemListObserver, |
60 public PaginationModelObserver, | 61 public PaginationModelObserver, |
61 public AppListModelObserver, | 62 public AppListModelObserver, |
62 public ui::ImplicitAnimationObserver { | 63 public ui::ImplicitAnimationObserver { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 const views::ViewModel* view_model_for_test() const { return &view_model_; } | 192 const views::ViewModel* view_model_for_test() const { return &view_model_; } |
192 | 193 |
193 // For test: Return if the drag and drop handler was set. | 194 // For test: Return if the drag and drop handler was set. |
194 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; } | 195 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; } |
195 | 196 |
196 // For test: Return if the drag and drop operation gets dispatched. | 197 // For test: Return if the drag and drop operation gets dispatched. |
197 bool forward_events_to_drag_and_drop_host_for_test() { | 198 bool forward_events_to_drag_and_drop_host_for_test() { |
198 return forward_events_to_drag_and_drop_host_; | 199 return forward_events_to_drag_and_drop_host_; |
199 } | 200 } |
200 | 201 |
201 void set_is_root_level(bool value) { is_root_level_ = value; } | 202 void set_folder_delegate(AppsGridViewFolderDelegate* folder_delegate) { |
203 folder_delegate_ = folder_delegate; | |
204 } | |
202 | 205 |
203 AppListItemView* activated_item_view() const { | 206 AppListItemView* activated_item_view() const { |
204 return activated_item_view_; | 207 return activated_item_view_; |
205 } | 208 } |
206 | 209 |
207 private: | 210 private: |
208 friend class test::AppsGridViewTestApi; | 211 friend class test::AppsGridViewTestApi; |
209 | 212 |
210 enum DropAttempt { | 213 enum DropAttempt { |
211 DROP_FOR_NONE, | 214 DROP_FOR_NONE, |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 bool IsDraggingForReprentInHiddenGridView() const; | 434 bool IsDraggingForReprentInHiddenGridView() const; |
432 | 435 |
433 // Returns the target icon bounds for |drag_item_view| to fly back | 436 // Returns the target icon bounds for |drag_item_view| to fly back |
434 // to its parent |folder_item_view| in animation. | 437 // to its parent |folder_item_view| in animation. |
435 gfx::Rect GetTargetIconRectInFolder(AppListItemView* drag_item_view, | 438 gfx::Rect GetTargetIconRectInFolder(AppListItemView* drag_item_view, |
436 AppListItemView* folder_item_view); | 439 AppListItemView* folder_item_view); |
437 | 440 |
438 AppListModel* model_; // Owned by AppListView. | 441 AppListModel* model_; // Owned by AppListView. |
439 AppListItemList* item_list_; // Not owned. | 442 AppListItemList* item_list_; // Not owned. |
440 AppsGridViewDelegate* delegate_; | 443 AppsGridViewDelegate* delegate_; |
444 AppsGridViewFolderDelegate* folder_delegate_; | |
tapted
2014/03/26 02:53:54
I think this needs a more verbose comment, to say
calamity
2014/03/27 05:14:44
Done.
| |
441 PaginationModel* pagination_model_; // Owned by AppListController. | 445 PaginationModel* pagination_model_; // Owned by AppListController. |
442 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. | 446 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. |
443 views::WebView* start_page_view_; // Owned by views hierarchy. | 447 views::WebView* start_page_view_; // Owned by views hierarchy. |
444 | 448 |
445 gfx::Size icon_size_; | 449 gfx::Size icon_size_; |
446 int cols_; | 450 int cols_; |
447 int rows_per_page_; | 451 int rows_per_page_; |
448 | 452 |
449 // Tracks app item views. There is a view per item in |model_|. | 453 // Tracks app item views. There is a view per item in |model_|. |
450 views::ViewModel view_model_; | 454 views::ViewModel view_model_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 | 510 |
507 // Target page to switch to when |page_flip_timer_| fires. | 511 // Target page to switch to when |page_flip_timer_| fires. |
508 int page_flip_target_; | 512 int page_flip_target_; |
509 | 513 |
510 // Delay in milliseconds of when |page_flip_timer_| should fire after user | 514 // Delay in milliseconds of when |page_flip_timer_| should fire after user |
511 // drags an item near the edges. | 515 // drags an item near the edges. |
512 int page_flip_delay_in_ms_; | 516 int page_flip_delay_in_ms_; |
513 | 517 |
514 views::BoundsAnimator bounds_animator_; | 518 views::BoundsAnimator bounds_animator_; |
515 | 519 |
516 // If true, AppsGridView is rending items at the root level of the app list. | |
517 bool is_root_level_; | |
518 | |
519 // The most recent activated item view. | 520 // The most recent activated item view. |
520 AppListItemView* activated_item_view_; | 521 AppListItemView* activated_item_view_; |
521 | 522 |
522 // Tracks if drag_view_ is dragged out of the folder container bubble | 523 // Tracks if drag_view_ is dragged out of the folder container bubble |
523 // when dragging a item inside a folder. | 524 // when dragging a item inside a folder. |
524 bool drag_out_of_folder_container_; | 525 bool drag_out_of_folder_container_; |
525 | 526 |
526 // True if the drag_view_ item is a folder item being dragged for reparenting. | 527 // True if the drag_view_ item is a folder item being dragged for reparenting. |
527 bool dragging_for_reparent_item_; | 528 bool dragging_for_reparent_item_; |
528 | 529 |
529 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 530 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
530 }; | 531 }; |
531 | 532 |
532 } // namespace app_list | 533 } // namespace app_list |
533 | 534 |
534 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 535 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
OLD | NEW |