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 |
81 void SetSelectedView(views::View* view); | 84 void SetSelectedView(views::View* view); |
82 void ClearSelectedView(views::View* view); | 85 void ClearSelectedView(views::View* view); |
83 bool IsSelectedView(const views::View* view) const; | 86 bool IsSelectedView(const views::View* view) const; |
84 | 87 |
85 // Ensures the view is visible. Note that if there is a running page | 88 // Ensures the view is visible. Note that if there is a running page |
86 // transition, this does nothing. | 89 // transition, this does nothing. |
87 void EnsureViewVisible(const views::View* view); | 90 void EnsureViewVisible(const views::View* view); |
88 | 91 |
89 void InitiateDrag(AppListItemView* view, | 92 void InitiateDrag(AppListItemView* view, |
90 Pointer pointer, | 93 Pointer pointer, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 const ViewHierarchyChangedDetails& details) OVERRIDE; | 127 const ViewHierarchyChangedDetails& details) OVERRIDE; |
125 virtual bool GetDropFormats( | 128 virtual bool GetDropFormats( |
126 int* formats, | 129 int* formats, |
127 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 130 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; |
128 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE; | 131 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE; |
129 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 132 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
130 | 133 |
131 // Stops the timer that triggers a page flip during a drag. | 134 // Stops the timer that triggers a page flip during a drag. |
132 void StopPageFlipTimer(); | 135 void StopPageFlipTimer(); |
133 | 136 |
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. |
275 AppsGridViewDelegate* delegate_; | 276 AppsGridViewDelegate* delegate_; |
276 PaginationModel* pagination_model_; // Owned by AppListController. | 277 PaginationModel* pagination_model_; // Owned by AppListController. |
277 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. | 278 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. |
278 views::WebView* start_page_view_; // Owned by views hierarchy. | 279 views::WebView* start_page_view_; // Owned by views hierarchy. |
279 | 280 |
280 gfx::Size icon_size_; | 281 gfx::Size icon_size_; |
281 int cols_; | 282 int cols_; |
282 int rows_per_page_; | 283 int rows_per_page_; |
283 | 284 |
284 // Tracks app item views. There is a view per item in |model_|. | 285 // 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... |
333 int page_flip_delay_in_ms_; | 334 int page_flip_delay_in_ms_; |
334 | 335 |
335 views::BoundsAnimator bounds_animator_; | 336 views::BoundsAnimator bounds_animator_; |
336 | 337 |
337 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 338 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
338 }; | 339 }; |
339 | 340 |
340 } // namespace app_list | 341 } // namespace app_list |
341 | 342 |
342 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 343 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
OLD | NEW |