Chromium Code Reviews| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "ui/app_list/app_list_export.h" | 14 #include "ui/app_list/app_list_export.h" |
| 15 #include "ui/app_list/app_list_model.h" | 15 #include "ui/app_list/app_list_model.h" |
| 16 #include "ui/app_list/app_list_model_observer.h" | 16 #include "ui/app_list/app_list_model_observer.h" |
| 17 #include "ui/app_list/pagination_model.h" | |
| 17 #include "ui/app_list/pagination_model_observer.h" | 18 #include "ui/app_list/pagination_model_observer.h" |
| 18 #include "ui/base/models/list_model_observer.h" | 19 #include "ui/base/models/list_model_observer.h" |
| 19 #include "ui/compositor/layer_animation_observer.h" | 20 #include "ui/compositor/layer_animation_observer.h" |
| 20 #include "ui/gfx/image/image_skia_operations.h" | 21 #include "ui/gfx/image/image_skia_operations.h" |
| 21 #include "ui/views/animation/bounds_animator.h" | 22 #include "ui/views/animation/bounds_animator.h" |
| 22 #include "ui/views/controls/button/button.h" | 23 #include "ui/views/controls/button/button.h" |
| 23 #include "ui/views/controls/image_view.h" | 24 #include "ui/views/controls/image_view.h" |
| 24 #include "ui/views/view.h" | 25 #include "ui/views/view.h" |
| 25 #include "ui/views/view_model.h" | 26 #include "ui/views/view_model.h" |
| 26 | 27 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 public AppListModelObserver, | 64 public AppListModelObserver, |
| 64 public ui::ImplicitAnimationObserver { | 65 public ui::ImplicitAnimationObserver { |
| 65 public: | 66 public: |
| 66 enum Pointer { | 67 enum Pointer { |
| 67 NONE, | 68 NONE, |
| 68 MOUSE, | 69 MOUSE, |
| 69 TOUCH, | 70 TOUCH, |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 // Constructs the app icon grid view. |delegate| is the delegate of this | 73 // Constructs the app icon grid view. |delegate| is the delegate of this |
| 73 // view, which usually is the hosting AppListView. |pagination_model| is | 74 // view, which usually is the hosting AppListView. |
| 74 // the paging info shared within the launcher UI. | 75 AppsGridView(AppsGridViewDelegate* delegate); |
|
xiyuan
2014/06/02 17:02:08
nit: explicit
Matt Giuca
2014/06/03 01:52:36
Done.
| |
| 75 AppsGridView(AppsGridViewDelegate* delegate, | |
| 76 PaginationModel* pagination_model); | |
| 77 virtual ~AppsGridView(); | 76 virtual ~AppsGridView(); |
| 78 | 77 |
| 79 // Sets fixed layout parameters. After setting this, CalculateLayout below | 78 // Sets fixed layout parameters. After setting this, CalculateLayout below |
| 80 // is no longer called to dynamically choosing those layout params. | 79 // is no longer called to dynamically choosing those layout params. |
| 81 void SetLayout(int icon_size, int cols, int rows_per_page); | 80 void SetLayout(int icon_size, int cols, int rows_per_page); |
| 82 | 81 |
| 83 int cols() { return cols_; } | 82 int cols() { return cols_; } |
| 84 int rows_per_page() { return rows_per_page_; } | 83 int rows_per_page() { return rows_per_page_; } |
| 85 | 84 |
| 86 // This resets the grid view to a fresh state for showing the app list. | 85 // This resets the grid view to a fresh state for showing the app list. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 | 123 |
| 125 // Prerenders the icons on and around |page_index|. | 124 // Prerenders the icons on and around |page_index|. |
| 126 void Prerender(int page_index); | 125 void Prerender(int page_index); |
| 127 | 126 |
| 128 // Return true if the |bounds_animator_| is animating |view|. | 127 // Return true if the |bounds_animator_| is animating |view|. |
| 129 bool IsAnimatingView(views::View* view); | 128 bool IsAnimatingView(views::View* view); |
| 130 | 129 |
| 131 bool has_dragged_view() const { return drag_view_ != NULL; } | 130 bool has_dragged_view() const { return drag_view_ != NULL; } |
| 132 bool dragging() const { return drag_pointer_ != NONE; } | 131 bool dragging() const { return drag_pointer_ != NONE; } |
| 133 | 132 |
| 133 // Gets the PaginationModel used for the grid view. | |
| 134 PaginationModel* pagination_model() { return &pagination_model_; } | |
| 135 | |
| 134 // Overridden from views::View: | 136 // Overridden from views::View: |
| 135 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 137 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
| 136 virtual void Layout() OVERRIDE; | 138 virtual void Layout() OVERRIDE; |
| 137 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 139 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| 138 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; | 140 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; |
| 139 virtual void ViewHierarchyChanged( | 141 virtual void ViewHierarchyChanged( |
| 140 const ViewHierarchyChangedDetails& details) OVERRIDE; | 142 const ViewHierarchyChangedDetails& details) OVERRIDE; |
| 141 virtual bool GetDropFormats( | 143 virtual bool GetDropFormats( |
| 142 int* formats, | 144 int* formats, |
| 143 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 145 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 const base::FilePath& path); | 456 const base::FilePath& path); |
| 455 #endif | 457 #endif |
| 456 | 458 |
| 457 AppListModel* model_; // Owned by AppListView. | 459 AppListModel* model_; // Owned by AppListView. |
| 458 AppListItemList* item_list_; // Not owned. | 460 AppListItemList* item_list_; // Not owned. |
| 459 AppsGridViewDelegate* delegate_; | 461 AppsGridViewDelegate* delegate_; |
| 460 | 462 |
| 461 // This can be NULL. Only grid views inside folders have a folder delegate. | 463 // This can be NULL. Only grid views inside folders have a folder delegate. |
| 462 AppsGridViewFolderDelegate* folder_delegate_; | 464 AppsGridViewFolderDelegate* folder_delegate_; |
| 463 | 465 |
| 464 PaginationModel* pagination_model_; // Owned by AppListController. | 466 PaginationModel pagination_model_; |
| 465 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. | 467 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. |
| 466 | 468 |
| 467 gfx::Size icon_size_; | 469 gfx::Size icon_size_; |
| 468 int cols_; | 470 int cols_; |
| 469 int rows_per_page_; | 471 int rows_per_page_; |
| 470 | 472 |
| 471 // Tracks app item views. There is a view per item in |model_|. | 473 // Tracks app item views. There is a view per item in |model_|. |
| 472 views::ViewModel view_model_; | 474 views::ViewModel view_model_; |
| 473 | 475 |
| 474 // Tracks pulsing block views. | 476 // Tracks pulsing block views. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 | 549 |
| 548 // True if the drag_view_ item is a folder item being dragged for reparenting. | 550 // True if the drag_view_ item is a folder item being dragged for reparenting. |
| 549 bool dragging_for_reparent_item_; | 551 bool dragging_for_reparent_item_; |
| 550 | 552 |
| 551 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 553 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
| 552 }; | 554 }; |
| 553 | 555 |
| 554 } // namespace app_list | 556 } // namespace app_list |
| 555 | 557 |
| 556 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 558 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
| OLD | NEW |