| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_CONTAINER_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_ |
| 6 #define UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "ui/app_list/app_list_folder_item.h" | 13 #include "ui/app_list/app_list_folder_item.h" |
| 14 #include "ui/app_list/views/app_list_page.h" | 14 #include "ui/app_list/views/app_list_page.h" |
| 15 #include "ui/app_list/views/top_icon_animation_view.h" | 15 #include "ui/app_list/views/top_icon_animation_view.h" |
| 16 #include "ui/gfx/range/range.h" | |
| 17 #include "ui/views/controls/styled_label_listener.h" | |
| 18 | 16 |
| 19 namespace gfx { | 17 namespace gfx { |
| 20 class Rect; | 18 class Rect; |
| 21 } | 19 } |
| 22 | 20 |
| 23 namespace app_list { | 21 namespace app_list { |
| 24 | 22 |
| 25 class AppsGridView; | 23 class AppsGridView; |
| 26 class ApplicationDragAndDropHost; | 24 class ApplicationDragAndDropHost; |
| 27 class AppListFolderItem; | 25 class AppListFolderItem; |
| 28 class AppListFolderView; | 26 class AppListFolderView; |
| 29 class AppListMainView; | 27 class AppListMainView; |
| 30 class AppListModel; | 28 class AppListModel; |
| 31 class AppListViewDelegate; | |
| 32 class ContentsView; | 29 class ContentsView; |
| 33 class FolderBackgroundView; | 30 class FolderBackgroundView; |
| 34 | 31 |
| 35 // AppsContainerView contains a root level AppsGridView to render the root level | 32 // AppsContainerView contains a root level AppsGridView to render the root level |
| 36 // app items, and a AppListFolderView to render the app items inside the | 33 // app items, and a AppListFolderView to render the app items inside the |
| 37 // active folder. Only one if them is visible to user at any time. | 34 // active folder. Only one if them is visible to user at any time. |
| 38 class AppsContainerView : public AppListPage, | 35 class AppsContainerView : public AppListPage, public TopIconAnimationObserver { |
| 39 public TopIconAnimationObserver, | |
| 40 public views::StyledLabelListener { | |
| 41 public: | 36 public: |
| 42 AppsContainerView(AppListMainView* app_list_main_view, | 37 AppsContainerView(AppListMainView* app_list_main_view, |
| 43 AppListModel* model); | 38 AppListModel* model); |
| 44 ~AppsContainerView() override; | 39 ~AppsContainerView() override; |
| 45 | 40 |
| 46 // Shows the active folder content specified by |folder_item|. | 41 // Shows the active folder content specified by |folder_item|. |
| 47 void ShowActiveFolder(AppListFolderItem* folder_item); | 42 void ShowActiveFolder(AppListFolderItem* folder_item); |
| 48 | 43 |
| 49 // Shows the root level apps list. This is called when UI navigate back from | 44 // Shows the root level apps list. This is called when UI navigate back from |
| 50 // a folder view with |folder_item|. If |folder_item| is NULL skips animation. | 45 // a folder view with |folder_item|. If |folder_item| is NULL skips animation. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 76 void Layout() override; | 71 void Layout() override; |
| 77 bool OnKeyPressed(const ui::KeyEvent& event) override; | 72 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 78 | 73 |
| 79 // AppListPage overrides: | 74 // AppListPage overrides: |
| 80 void OnWillBeShown() override; | 75 void OnWillBeShown() override; |
| 81 gfx::Rect GetPageBoundsForState(AppListModel::State state) const override; | 76 gfx::Rect GetPageBoundsForState(AppListModel::State state) const override; |
| 82 | 77 |
| 83 // TopIconAnimationObserver overrides: | 78 // TopIconAnimationObserver overrides: |
| 84 void OnTopIconAnimationsComplete() override; | 79 void OnTopIconAnimationsComplete() override; |
| 85 | 80 |
| 86 // StyledLabelListener overrides: | |
| 87 void StyledLabelLinkClicked(views::StyledLabel* label, | |
| 88 const gfx::Range& range, | |
| 89 int event_flags) override; | |
| 90 | |
| 91 AppsGridView* apps_grid_view() { return apps_grid_view_; } | 81 AppsGridView* apps_grid_view() { return apps_grid_view_; } |
| 92 FolderBackgroundView* folder_background_view() { | 82 FolderBackgroundView* folder_background_view() { |
| 93 return folder_background_view_; | 83 return folder_background_view_; |
| 94 } | 84 } |
| 95 AppListFolderView* app_list_folder_view() { return app_list_folder_view_; } | 85 AppListFolderView* app_list_folder_view() { return app_list_folder_view_; } |
| 96 | 86 |
| 97 private: | 87 private: |
| 98 enum ShowState { | 88 enum ShowState { |
| 99 SHOW_NONE, // initial state | 89 SHOW_NONE, // initial state |
| 100 SHOW_APPS, | 90 SHOW_APPS, |
| 101 SHOW_ACTIVE_FOLDER, | 91 SHOW_ACTIVE_FOLDER, |
| 102 SHOW_ITEM_REPARENT, | 92 SHOW_ITEM_REPARENT, |
| 103 }; | 93 }; |
| 104 | 94 |
| 105 void SetShowState(ShowState show_state, bool show_apps_with_animation); | 95 void SetShowState(ShowState show_state, bool show_apps_with_animation); |
| 106 | 96 |
| 107 // Calculates the top item icon bounds in the active folder icon. The bounds | 97 // Calculates the top item icon bounds in the active folder icon. The bounds |
| 108 // is relative to AppsContainerView. | 98 // is relative to AppsContainerView. |
| 109 // Returns the bounds of top items' icon in sequence of top left, top right, | 99 // Returns the bounds of top items' icon in sequence of top left, top right, |
| 110 // bottom left, bottom right. | 100 // bottom left, bottom right. |
| 111 std::vector<gfx::Rect> GetTopItemIconBoundsInActiveFolder(); | 101 std::vector<gfx::Rect> GetTopItemIconBoundsInActiveFolder(); |
| 112 | 102 |
| 113 // Creates the transitional views for animating the top items in the folder | 103 // Creates the transitional views for animating the top items in the folder |
| 114 // when opening or closing a folder. | 104 // when opening or closing a folder. |
| 115 void CreateViewsForFolderTopItemsAnimation( | 105 void CreateViewsForFolderTopItemsAnimation( |
| 116 AppListFolderItem* active_folder, bool open_folder); | 106 AppListFolderItem* active_folder, bool open_folder); |
| 117 | 107 |
| 118 void PrepareToShowApps(AppListFolderItem* folder_item); | 108 void PrepareToShowApps(AppListFolderItem* folder_item); |
| 119 | 109 |
| 120 // Null on Chrome OS (unused). | |
| 121 View* deprecation_banner_view_ = nullptr; // Owned by views hierarchy. | |
| 122 AppsGridView* apps_grid_view_; // Owned by views hierarchy. | 110 AppsGridView* apps_grid_view_; // Owned by views hierarchy. |
| 123 AppListFolderView* app_list_folder_view_; // Owned by views hierarchy. | 111 AppListFolderView* app_list_folder_view_; // Owned by views hierarchy. |
| 124 FolderBackgroundView* folder_background_view_; // Owned by views hierarchy. | 112 FolderBackgroundView* folder_background_view_; // Owned by views hierarchy. |
| 125 ShowState show_state_; | 113 ShowState show_state_; |
| 126 AppListViewDelegate* view_delegate_; | |
| 127 | 114 |
| 128 // The transitional views for animating the top items in folder | 115 // The transitional views for animating the top items in folder |
| 129 // when opening or closing a folder. | 116 // when opening or closing a folder. |
| 130 std::vector<views::View*> top_icon_views_; | 117 std::vector<views::View*> top_icon_views_; |
| 131 | 118 |
| 132 size_t top_icon_animation_pending_count_; | 119 size_t top_icon_animation_pending_count_; |
| 133 | 120 |
| 134 DISALLOW_COPY_AND_ASSIGN(AppsContainerView); | 121 DISALLOW_COPY_AND_ASSIGN(AppsContainerView); |
| 135 }; | 122 }; |
| 136 | 123 |
| 137 } // namespace app_list | 124 } // namespace app_list |
| 138 | 125 |
| 139 | 126 |
| 140 #endif // UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_ | 127 #endif // UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_ |
| OLD | NEW |