| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 content::WebContents* start_page_contents); | 71 content::WebContents* start_page_contents); |
| 72 virtual ~AppsGridView(); | 72 virtual ~AppsGridView(); |
| 73 | 73 |
| 74 // Sets fixed layout parameters. After setting this, CalculateLayout below | 74 // Sets fixed layout parameters. After setting this, CalculateLayout below |
| 75 // is no longer called to dynamically choosing those layout params. | 75 // is no longer called to dynamically choosing those layout params. |
| 76 void SetLayout(int icon_size, int cols, int rows_per_page); | 76 void SetLayout(int icon_size, int cols, int rows_per_page); |
| 77 | 77 |
| 78 // Sets |model| to use. Note this does not take ownership of |model|. | 78 // Sets |model| to use. Note this does not take ownership of |model|. |
| 79 void SetModel(AppListModel* model); | 79 void SetModel(AppListModel* model); |
| 80 | 80 |
| 81 // Set |apps| to renders. Note this does not take ownership of |apps|. | |
| 82 void SetApps(AppListModel::Apps* apps); | |
| 83 | |
| 84 void SetSelectedView(views::View* view); | 81 void SetSelectedView(views::View* view); |
| 85 void ClearSelectedView(views::View* view); | 82 void ClearSelectedView(views::View* view); |
| 86 bool IsSelectedView(const views::View* view) const; | 83 bool IsSelectedView(const views::View* view) const; |
| 87 | 84 |
| 88 // Ensures the view is visible. Note that if there is a running page | 85 // Ensures the view is visible. Note that if there is a running page |
| 89 // transition, this does nothing. | 86 // transition, this does nothing. |
| 90 void EnsureViewVisible(const views::View* view); | 87 void EnsureViewVisible(const views::View* view); |
| 91 | 88 |
| 92 void InitiateDrag(AppListItemView* view, | 89 void InitiateDrag(AppListItemView* view, |
| 93 Pointer pointer, | 90 Pointer pointer, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 const ViewHierarchyChangedDetails& details) OVERRIDE; | 124 const ViewHierarchyChangedDetails& details) OVERRIDE; |
| 128 virtual bool GetDropFormats( | 125 virtual bool GetDropFormats( |
| 129 int* formats, | 126 int* formats, |
| 130 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 127 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; |
| 131 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE; | 128 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE; |
| 132 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 129 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
| 133 | 130 |
| 134 // Stops the timer that triggers a page flip during a drag. | 131 // Stops the timer that triggers a page flip during a drag. |
| 135 void StopPageFlipTimer(); | 132 void StopPageFlipTimer(); |
| 136 | 133 |
| 134 // Get the last grid view which was created. |
| 135 static AppsGridView* GetLastGridViewForTest(); |
| 136 |
| 137 // Return the view model for test purposes. | 137 // Return the view model for test purposes. |
| 138 const views::ViewModel* view_model_for_test() const { return &view_model_; } | 138 const views::ViewModel* view_model_for_test() const { return &view_model_; } |
| 139 | 139 |
| 140 // For test: Return if the drag and drop handler was set. | 140 // For test: Return if the drag and drop handler was set. |
| 141 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; } | 141 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; } |
| 142 | 142 |
| 143 // For test: Return if the drag and drop operation gets dispatched. | 143 // For test: Return if the drag and drop operation gets dispatched. |
| 144 bool forward_events_to_drag_and_drop_host_for_test() { | 144 bool forward_events_to_drag_and_drop_host_for_test() { |
| 145 return forward_events_to_drag_and_drop_host_; | 145 return forward_events_to_drag_and_drop_host_; |
| 146 } | 146 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // Overridden from AppListModelObserver: | 265 // Overridden from AppListModelObserver: |
| 266 virtual void OnAppListModelStatusChanged() OVERRIDE; | 266 virtual void OnAppListModelStatusChanged() OVERRIDE; |
| 267 | 267 |
| 268 // Hide a given view temporarily without losing (mouse) events and / or | 268 // Hide a given view temporarily without losing (mouse) events and / or |
| 269 // changing the size of it. If |immediate| is set the change will be | 269 // changing the size of it. If |immediate| is set the change will be |
| 270 // immediately applied - otherwise it will change gradually. | 270 // immediately applied - otherwise it will change gradually. |
| 271 // If |hide| is set the view will get hidden, otherwise it gets shown. | 271 // If |hide| is set the view will get hidden, otherwise it gets shown. |
| 272 void SetViewHidden(views::View* view, bool hide, bool immediate); | 272 void SetViewHidden(views::View* view, bool hide, bool immediate); |
| 273 | 273 |
| 274 AppListModel* model_; // Owned by AppListView. | 274 AppListModel* model_; // Owned by AppListView. |
| 275 AppListModel::Apps* apps_; // Not owned. | |
| 276 AppsGridViewDelegate* delegate_; | 275 AppsGridViewDelegate* delegate_; |
| 277 PaginationModel* pagination_model_; // Owned by AppListController. | 276 PaginationModel* pagination_model_; // Owned by AppListController. |
| 278 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. | 277 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. |
| 279 views::WebView* start_page_view_; // Owned by views hierarchy. | 278 views::WebView* start_page_view_; // Owned by views hierarchy. |
| 280 | 279 |
| 281 gfx::Size icon_size_; | 280 gfx::Size icon_size_; |
| 282 int cols_; | 281 int cols_; |
| 283 int rows_per_page_; | 282 int rows_per_page_; |
| 284 | 283 |
| 285 // Tracks app item views. There is a view per item in |model_|. | 284 // Tracks app item views. There is a view per item in |model_|. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 int page_flip_delay_in_ms_; | 333 int page_flip_delay_in_ms_; |
| 335 | 334 |
| 336 views::BoundsAnimator bounds_animator_; | 335 views::BoundsAnimator bounds_animator_; |
| 337 | 336 |
| 338 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 337 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
| 339 }; | 338 }; |
| 340 | 339 |
| 341 } // namespace app_list | 340 } // namespace app_list |
| 342 | 341 |
| 343 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 342 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
| OLD | NEW |