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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "ui/app_list/pagination_model_observer.h" | 23 #include "ui/app_list/pagination_model_observer.h" |
24 #include "ui/base/models/list_model_observer.h" | 24 #include "ui/base/models/list_model_observer.h" |
25 #include "ui/compositor/layer_animation_observer.h" | 25 #include "ui/compositor/layer_animation_observer.h" |
26 #include "ui/gfx/image/image_skia_operations.h" | 26 #include "ui/gfx/image/image_skia_operations.h" |
27 #include "ui/views/animation/bounds_animator.h" | 27 #include "ui/views/animation/bounds_animator.h" |
28 #include "ui/views/controls/button/button.h" | 28 #include "ui/views/controls/button/button.h" |
29 #include "ui/views/controls/image_view.h" | 29 #include "ui/views/controls/image_view.h" |
30 #include "ui/views/view.h" | 30 #include "ui/views/view.h" |
31 #include "ui/views/view_model.h" | 31 #include "ui/views/view_model.h" |
32 | 32 |
33 #if defined(OS_WIN) | |
34 #include <wrl/client.h> | |
35 #include "ui/base/dragdrop/drag_source_win.h" | |
36 #endif | |
37 | |
38 namespace views { | 33 namespace views { |
39 class ButtonListener; | 34 class ButtonListener; |
40 class DragImageView; | 35 class DragImageView; |
41 } | 36 } |
42 | 37 |
43 namespace app_list { | 38 namespace app_list { |
44 | 39 |
45 #if defined(OS_WIN) | |
46 class SynchronousDrag; | |
47 #endif | |
48 | |
49 namespace test { | 40 namespace test { |
50 class AppsGridViewTestApi; | 41 class AppsGridViewTestApi; |
51 } | 42 } |
52 | 43 |
53 class ApplicationDragAndDropHost; | 44 class ApplicationDragAndDropHost; |
54 class AppListItemView; | 45 class AppListItemView; |
55 class AppsGridViewDelegate; | 46 class AppsGridViewDelegate; |
56 class AppsGridViewFolderDelegate; | 47 class AppsGridViewFolderDelegate; |
57 class PageSwitcher; | 48 class PageSwitcher; |
58 class PaginationController; | 49 class PaginationController; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void UpdateDrag(Pointer pointer, const gfx::Point& point); | 107 void UpdateDrag(Pointer pointer, const gfx::Point& point); |
117 void EndDrag(bool cancel); | 108 void EndDrag(bool cancel); |
118 bool IsDraggedView(const AppListItemView* view) const; | 109 bool IsDraggedView(const AppListItemView* view) const; |
119 void ClearDragState(); | 110 void ClearDragState(); |
120 void SetDragViewVisible(bool visible); | 111 void SetDragViewVisible(bool visible); |
121 | 112 |
122 // Set the drag and drop host for application links. | 113 // Set the drag and drop host for application links. |
123 void SetDragAndDropHostOfCurrentAppList( | 114 void SetDragAndDropHostOfCurrentAppList( |
124 ApplicationDragAndDropHost* drag_and_drop_host); | 115 ApplicationDragAndDropHost* drag_and_drop_host); |
125 | 116 |
126 // Prerenders the icons on and around the currently selected page. | |
127 void Prerender(); | |
128 | |
129 // Return true if the |bounds_animator_| is animating |view|. | 117 // Return true if the |bounds_animator_| is animating |view|. |
130 bool IsAnimatingView(AppListItemView* view); | 118 bool IsAnimatingView(AppListItemView* view); |
131 | 119 |
132 bool has_dragged_view() const { return drag_view_ != nullptr; } | 120 bool has_dragged_view() const { return drag_view_ != nullptr; } |
133 bool dragging() const { return drag_pointer_ != NONE; } | 121 bool dragging() const { return drag_pointer_ != NONE; } |
134 | 122 |
135 // Gets the PaginationModel used for the grid view. | 123 // Gets the PaginationModel used for the grid view. |
136 PaginationModel* pagination_model() { return &pagination_model_; } | 124 PaginationModel* pagination_model() { return &pagination_model_; } |
137 | 125 |
138 // Overridden from views::View: | 126 // Overridden from views::View: |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 bool IsDraggingForReparentInHiddenGridView() const; | 443 bool IsDraggingForReparentInHiddenGridView() const; |
456 | 444 |
457 // Returns the target icon bounds for |drag_item_view| to fly back | 445 // Returns the target icon bounds for |drag_item_view| to fly back |
458 // to its parent |folder_item_view| in animation. | 446 // to its parent |folder_item_view| in animation. |
459 gfx::Rect GetTargetIconRectInFolder(AppListItemView* drag_item_view, | 447 gfx::Rect GetTargetIconRectInFolder(AppListItemView* drag_item_view, |
460 AppListItemView* folder_item_view); | 448 AppListItemView* folder_item_view); |
461 | 449 |
462 // Returns true if the grid view is under an OEM folder. | 450 // Returns true if the grid view is under an OEM folder. |
463 bool IsUnderOEMFolder(); | 451 bool IsUnderOEMFolder(); |
464 | 452 |
465 void StartSettingUpSynchronousDrag(); | |
466 bool RunSynchronousDrag(); | |
467 void CleanUpSynchronousDrag(); | |
468 #if defined(OS_WIN) | |
469 void OnGotShortcutPath(Microsoft::WRL::ComPtr<SynchronousDrag> drag, | |
470 const base::FilePath& path); | |
471 #endif | |
472 | |
473 AppListModel* model_; // Owned by AppListView. | 453 AppListModel* model_; // Owned by AppListView. |
474 AppListItemList* item_list_; // Not owned. | 454 AppListItemList* item_list_; // Not owned. |
475 AppsGridViewDelegate* delegate_; | 455 AppsGridViewDelegate* delegate_; |
476 | 456 |
477 // This can be NULL. Only grid views inside folders have a folder delegate. | 457 // This can be NULL. Only grid views inside folders have a folder delegate. |
478 AppsGridViewFolderDelegate* folder_delegate_; | 458 AppsGridViewFolderDelegate* folder_delegate_; |
479 | 459 |
480 PaginationModel pagination_model_; | 460 PaginationModel pagination_model_; |
481 // Must appear after |pagination_model_|. | 461 // Must appear after |pagination_model_|. |
482 std::unique_ptr<PaginationController> pagination_controller_; | 462 std::unique_ptr<PaginationController> pagination_controller_; |
(...skipping 20 matching lines...) Expand all Loading... |
503 | 483 |
504 // The point where the drag started in GridView coordinates. | 484 // The point where the drag started in GridView coordinates. |
505 gfx::Point drag_start_grid_view_; | 485 gfx::Point drag_start_grid_view_; |
506 | 486 |
507 // The location of |drag_view_| when the drag started. | 487 // The location of |drag_view_| when the drag started. |
508 gfx::Point drag_view_start_; | 488 gfx::Point drag_view_start_; |
509 | 489 |
510 // Page the drag started on. | 490 // Page the drag started on. |
511 int drag_start_page_; | 491 int drag_start_page_; |
512 | 492 |
513 #if defined(OS_WIN) | |
514 // Created when a drag is started (ie: drag exceeds the drag threshold), but | |
515 // not Run() until supplied with a shortcut path. | |
516 Microsoft::WRL::ComPtr<SynchronousDrag> synchronous_drag_; | |
517 | |
518 // Whether to use SynchronousDrag to support dropping to task bar etc. | |
519 bool use_synchronous_drag_; | |
520 #endif | |
521 | |
522 Pointer drag_pointer_; | 493 Pointer drag_pointer_; |
523 | 494 |
524 // The most recent reorder drop target. | 495 // The most recent reorder drop target. |
525 Index reorder_drop_target_; | 496 Index reorder_drop_target_; |
526 | 497 |
527 // The most recent folder drop target. | 498 // The most recent folder drop target. |
528 Index folder_drop_target_; | 499 Index folder_drop_target_; |
529 | 500 |
530 // The index where an empty slot has been left as a placeholder for the | 501 // The index where an empty slot has been left as a placeholder for the |
531 // reorder drop target. This updates when the reorder animation triggers. | 502 // reorder drop target. This updates when the reorder animation triggers. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 546 |
576 // True if the drag_view_ item is a folder item being dragged for reparenting. | 547 // True if the drag_view_ item is a folder item being dragged for reparenting. |
577 bool dragging_for_reparent_item_; | 548 bool dragging_for_reparent_item_; |
578 | 549 |
579 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 550 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
580 }; | 551 }; |
581 | 552 |
582 } // namespace app_list | 553 } // namespace app_list |
583 | 554 |
584 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 555 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
OLD | NEW |