Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Side by Side Diff: ui/app_list/views/apps_grid_view.h

Issue 140203003: Implement animation UI for opening/closing an app list folder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "ui/app_list/app_list_export.h" 13 #include "ui/app_list/app_list_export.h"
14 #include "ui/app_list/app_list_model.h" 14 #include "ui/app_list/app_list_model.h"
15 #include "ui/app_list/app_list_model_observer.h" 15 #include "ui/app_list/app_list_model_observer.h"
16 #include "ui/app_list/pagination_model_observer.h" 16 #include "ui/app_list/pagination_model_observer.h"
17 #include "ui/base/models/list_model_observer.h" 17 #include "ui/base/models/list_model_observer.h"
18 #include "ui/compositor/layer_animation_observer.h"
18 #include "ui/views/animation/bounds_animator.h" 19 #include "ui/views/animation/bounds_animator.h"
19 #include "ui/views/controls/button/button.h" 20 #include "ui/views/controls/button/button.h"
20 #include "ui/views/view.h" 21 #include "ui/views/view.h"
21 #include "ui/views/view_model.h" 22 #include "ui/views/view_model.h"
22 23
23 #if defined(OS_WIN) 24 #if defined(OS_WIN)
24 #include "ui/base/dragdrop/drag_source_win.h" 25 #include "ui/base/dragdrop/drag_source_win.h"
25 #endif 26 #endif
26 27
27 namespace content { 28 namespace content {
(...skipping 20 matching lines...) Expand all
48 class AppListItemView; 49 class AppListItemView;
49 class AppsGridViewDelegate; 50 class AppsGridViewDelegate;
50 class PageSwitcher; 51 class PageSwitcher;
51 class PaginationModel; 52 class PaginationModel;
52 53
53 // AppsGridView displays a grid for AppListItemList sub model. 54 // AppsGridView displays a grid for AppListItemList sub model.
54 class APP_LIST_EXPORT AppsGridView : public views::View, 55 class APP_LIST_EXPORT AppsGridView : public views::View,
55 public views::ButtonListener, 56 public views::ButtonListener,
56 public AppListItemListObserver, 57 public AppListItemListObserver,
57 public PaginationModelObserver, 58 public PaginationModelObserver,
58 public AppListModelObserver { 59 public AppListModelObserver,
60 public ui::ImplicitAnimationObserver {
59 public: 61 public:
60 enum Pointer { 62 enum Pointer {
61 NONE, 63 NONE,
62 MOUSE, 64 MOUSE,
63 TOUCH, 65 TOUCH,
64 }; 66 };
65 67
66 // Constructs the app icon grid view. |delegate| is the delegate of this 68 // Constructs the app icon grid view. |delegate| is the delegate of this
67 // view, which usually is the hosting AppListView. |pagination_model| is 69 // view, which usually is the hosting AppListView. |pagination_model| is
68 // the paging info shared within the launcher UI. |start_page_contents| is 70 // the paging info shared within the launcher UI. |start_page_contents| is
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 const ViewHierarchyChangedDetails& details) OVERRIDE; 133 const ViewHierarchyChangedDetails& details) OVERRIDE;
132 virtual bool GetDropFormats( 134 virtual bool GetDropFormats(
133 int* formats, 135 int* formats,
134 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; 136 std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE;
135 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE; 137 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE;
136 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; 138 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE;
137 139
138 // Stops the timer that triggers a page flip during a drag. 140 // Stops the timer that triggers a page flip during a drag.
139 void StopPageFlipTimer(); 141 void StopPageFlipTimer();
140 142
143 // Returns the item view of the item at |index|.
144 AppListItemView* GetItemViewAt(int index) const;
145
146 // Show or hide the top item views.
147 void ShowTopItemViews(bool show);
xiyuan 2014/01/16 01:46:48 nit: ShowTopItemViews -> SetTopItemsVisible
jennyz 2014/01/16 17:49:52 Done.
148
149 void ScheduleAnimationToShow(bool show);
150
141 // Return the view model for test purposes. 151 // Return the view model for test purposes.
142 const views::ViewModel* view_model_for_test() const { return &view_model_; } 152 const views::ViewModel* view_model_for_test() const { return &view_model_; }
143 153
144 // For test: Return if the drag and drop handler was set. 154 // For test: Return if the drag and drop handler was set.
145 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; } 155 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; }
146 156
147 // For test: Return if the drag and drop operation gets dispatched. 157 // For test: Return if the drag and drop operation gets dispatched.
148 bool forward_events_to_drag_and_drop_host_for_test() { 158 bool forward_events_to_drag_and_drop_host_for_test() {
149 return forward_events_to_drag_and_drop_host_; 159 return forward_events_to_drag_and_drop_host_;
150 } 160 }
151 161
152 void set_is_root_level(bool value) { is_root_level_ = value; } 162 void set_is_root_level(bool value) { is_root_level_ = value; }
153 163
164 AppListItemView* activated_item_view() const {
165 return activated_item_view_;
166 }
167
154 private: 168 private:
155 friend class test::AppsGridViewTestApi; 169 friend class test::AppsGridViewTestApi;
156 170
157 enum DropAttempt { 171 enum DropAttempt {
158 DROP_FOR_NONE, 172 DROP_FOR_NONE,
159 DROP_FOR_REORDER, 173 DROP_FOR_REORDER,
160 DROP_FOR_FOLDER, 174 DROP_FOR_FOLDER,
161 }; 175 };
162 176
163 // Represents the index to an item view in the grid. 177 // Represents the index to an item view in the grid.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 298
285 // Overridden from PaginationModelObserver: 299 // Overridden from PaginationModelObserver:
286 virtual void TotalPagesChanged() OVERRIDE; 300 virtual void TotalPagesChanged() OVERRIDE;
287 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; 301 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE;
288 virtual void TransitionStarted() OVERRIDE; 302 virtual void TransitionStarted() OVERRIDE;
289 virtual void TransitionChanged() OVERRIDE; 303 virtual void TransitionChanged() OVERRIDE;
290 304
291 // Overridden from AppListModelObserver: 305 // Overridden from AppListModelObserver:
292 virtual void OnAppListModelStatusChanged() OVERRIDE; 306 virtual void OnAppListModelStatusChanged() OVERRIDE;
293 307
308 // ui::ImplicitAnimationObserver overrides:
309 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
310
294 // Hide a given view temporarily without losing (mouse) events and / or 311 // Hide a given view temporarily without losing (mouse) events and / or
295 // changing the size of it. If |immediate| is set the change will be 312 // changing the size of it. If |immediate| is set the change will be
296 // immediately applied - otherwise it will change gradually. 313 // immediately applied - otherwise it will change gradually.
297 // If |hide| is set the view will get hidden, otherwise it gets shown. 314 // If |hide| is set the view will get hidden, otherwise it gets shown.
298 void SetViewHidden(views::View* view, bool hide, bool immediate); 315 void SetViewHidden(views::View* view, bool hide, bool immediate);
299 316
300 // Whether the folder drag-and-drop UI should be enabled. 317 // Whether the folder drag-and-drop UI should be enabled.
301 bool EnableFolderDragDropUI(); 318 bool EnableFolderDragDropUI();
302 319
303 // Whether target specified by |drap_target| can accept more items to be 320 // Whether target specified by |drap_target| can accept more items to be
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 423
407 // Delay in milliseconds of when |page_flip_timer_| should fire after user 424 // Delay in milliseconds of when |page_flip_timer_| should fire after user
408 // drags an item near the edges. 425 // drags an item near the edges.
409 int page_flip_delay_in_ms_; 426 int page_flip_delay_in_ms_;
410 427
411 views::BoundsAnimator bounds_animator_; 428 views::BoundsAnimator bounds_animator_;
412 429
413 // If true, AppsGridView is rending items at the root level of the app list. 430 // If true, AppsGridView is rending items at the root level of the app list.
414 bool is_root_level_; 431 bool is_root_level_;
415 432
433 // The most recent activated item view.
434 AppListItemView* activated_item_view_;
435
436 // Animated to show or hide the view.
437 bool animate_to_show_;
438
416 DISALLOW_COPY_AND_ASSIGN(AppsGridView); 439 DISALLOW_COPY_AND_ASSIGN(AppsGridView);
417 }; 440 };
418 441
419 } // namespace app_list 442 } // namespace app_list
420 443
421 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ 444 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698