Views Omnibox: tolerate minor click-to-select-all dragging.
[chromium-blink-merge.git] / ui / app_list / views / app_list_folder_view.h
blob7052588179b10b2b6fbcf9aef86f4eb07e8a3eed
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_
6 #define UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_
8 #include "ui/app_list/app_list_item_list_observer.h"
9 #include "ui/app_list/views/folder_header_view.h"
10 #include "ui/app_list/views/folder_header_view_delegate.h"
11 #include "ui/compositor/layer_animation_observer.h"
12 #include "ui/views/controls/button/button.h"
13 #include "ui/views/view.h"
15 namespace content {
16 class WebContents;
19 namespace views {
20 class ViewModel;
23 namespace app_list {
25 class AppsContainerView;
26 class AppsGridView;
27 class AppListFolderItem;
28 class AppListMainView;
29 class AppListModel;
30 class FolderHeaderView;
31 class PaginationModel;
33 class AppListFolderView : public views::View,
34 public FolderHeaderViewDelegate,
35 public AppListItemListObserver,
36 public ui::ImplicitAnimationObserver {
37 public:
38 AppListFolderView(AppsContainerView* container_view,
39 AppListModel* model,
40 AppListMainView* app_list_main_view,
41 content::WebContents* start_page_contents);
42 virtual ~AppListFolderView();
44 void SetAppListFolderItem(AppListFolderItem* folder);
46 // Schedules an animation to show or hide the view.
47 void ScheduleShowHideAnimation(bool show);
49 // Gets icon image bounds of the item at |index|, relative to
50 // AppListFolderView.
51 gfx::Rect GetItemIconBoundsAt(int index);
53 // views::View overrides:
54 virtual gfx::Size GetPreferredSize() OVERRIDE;
55 virtual void Layout() OVERRIDE;
56 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
58 // Overridden from AppListItemListObserver:
59 virtual void OnListItemRemoved(size_t index, AppListItem* item) OVERRIDE;
61 // ui::ImplicitAnimationObserver overrides:
62 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
64 private:
65 void CalculateIdealBounds();
67 // Overridden from FolderHeaderViewDelegate:
68 virtual void NavigateBack(AppListFolderItem* item,
69 const ui::Event& event_flags) OVERRIDE;
71 AppsContainerView* container_view_; // Not owned.
72 FolderHeaderView* folder_header_view_; // Owned by views hierarchy.
73 AppsGridView* items_grid_view_; // Owned by the views hierarchy.
75 scoped_ptr<views::ViewModel> view_model_;
77 AppListModel* model_; // Not owned.
78 AppListFolderItem* folder_item_; // Not owned.
80 scoped_ptr<PaginationModel> pagination_model_;
82 DISALLOW_COPY_AND_ASSIGN(AppListFolderView);
85 } // namespace app_list
87 #endif // UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_