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

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: Address code review comments. 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
« no previous file with comments | « ui/app_list/views/apps_container_view.cc ('k') | ui/app_list/views/apps_grid_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SetTopItemViewsVisible(bool visible);
148
149 // Schedules an animation to show or hide the view.
150 void ScheduleShowHideAnimation(bool show);
151
141 // Return the view model for test purposes. 152 // Return the view model for test purposes.
142 const views::ViewModel* view_model_for_test() const { return &view_model_; } 153 const views::ViewModel* view_model_for_test() const { return &view_model_; }
143 154
144 // For test: Return if the drag and drop handler was set. 155 // 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_; } 156 bool has_drag_and_drop_host_for_test() { return NULL != drag_and_drop_host_; }
146 157
147 // For test: Return if the drag and drop operation gets dispatched. 158 // For test: Return if the drag and drop operation gets dispatched.
148 bool forward_events_to_drag_and_drop_host_for_test() { 159 bool forward_events_to_drag_and_drop_host_for_test() {
149 return forward_events_to_drag_and_drop_host_; 160 return forward_events_to_drag_and_drop_host_;
150 } 161 }
151 162
152 void set_is_root_level(bool value) { is_root_level_ = value; } 163 void set_is_root_level(bool value) { is_root_level_ = value; }
153 164
165 AppListItemView* activated_item_view() const {
166 return activated_item_view_;
167 }
168
154 private: 169 private:
155 friend class test::AppsGridViewTestApi; 170 friend class test::AppsGridViewTestApi;
156 171
157 enum DropAttempt { 172 enum DropAttempt {
158 DROP_FOR_NONE, 173 DROP_FOR_NONE,
159 DROP_FOR_REORDER, 174 DROP_FOR_REORDER,
160 DROP_FOR_FOLDER, 175 DROP_FOR_FOLDER,
161 }; 176 };
162 177
163 // Represents the index to an item view in the grid. 178 // Represents the index to an item view in the grid.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 299
285 // Overridden from PaginationModelObserver: 300 // Overridden from PaginationModelObserver:
286 virtual void TotalPagesChanged() OVERRIDE; 301 virtual void TotalPagesChanged() OVERRIDE;
287 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; 302 virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE;
288 virtual void TransitionStarted() OVERRIDE; 303 virtual void TransitionStarted() OVERRIDE;
289 virtual void TransitionChanged() OVERRIDE; 304 virtual void TransitionChanged() OVERRIDE;
290 305
291 // Overridden from AppListModelObserver: 306 // Overridden from AppListModelObserver:
292 virtual void OnAppListModelStatusChanged() OVERRIDE; 307 virtual void OnAppListModelStatusChanged() OVERRIDE;
293 308
309 // ui::ImplicitAnimationObserver overrides:
310 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
311
294 // Hide a given view temporarily without losing (mouse) events and / or 312 // 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 313 // changing the size of it. If |immediate| is set the change will be
296 // immediately applied - otherwise it will change gradually. 314 // immediately applied - otherwise it will change gradually.
297 // If |hide| is set the view will get hidden, otherwise it gets shown. 315 // If |hide| is set the view will get hidden, otherwise it gets shown.
298 void SetViewHidden(views::View* view, bool hide, bool immediate); 316 void SetViewHidden(views::View* view, bool hide, bool immediate);
299 317
300 // Whether the folder drag-and-drop UI should be enabled. 318 // Whether the folder drag-and-drop UI should be enabled.
301 bool EnableFolderDragDropUI(); 319 bool EnableFolderDragDropUI();
302 320
303 // Whether target specified by |drap_target| can accept more items to be 321 // 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 424
407 // Delay in milliseconds of when |page_flip_timer_| should fire after user 425 // Delay in milliseconds of when |page_flip_timer_| should fire after user
408 // drags an item near the edges. 426 // drags an item near the edges.
409 int page_flip_delay_in_ms_; 427 int page_flip_delay_in_ms_;
410 428
411 views::BoundsAnimator bounds_animator_; 429 views::BoundsAnimator bounds_animator_;
412 430
413 // If true, AppsGridView is rending items at the root level of the app list. 431 // If true, AppsGridView is rending items at the root level of the app list.
414 bool is_root_level_; 432 bool is_root_level_;
415 433
434 // The most recent activated item view.
435 AppListItemView* activated_item_view_;
436
416 DISALLOW_COPY_AND_ASSIGN(AppsGridView); 437 DISALLOW_COPY_AND_ASSIGN(AppsGridView);
417 }; 438 };
418 439
419 } // namespace app_list 440 } // namespace app_list
420 441
421 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ 442 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/apps_container_view.cc ('k') | ui/app_list/views/apps_grid_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698