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