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

Unified Diff: ui/app_list/shower/app_list_shower_impl.h

Issue 1770993002: wip: Refactoring Ash's AppListController, moving the bulk of the logic to chrome/browser/ui/ash/app… Base URL: https://chromium.googlesource.com/chromium/src.git@small_5_apps
Patch Set: AppListShower to new component: //ui/app_list/shower, GetViewDelegate() in GetViewDelegate(), test … Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/shower/app_list_shower_export.h ('k') | ui/app_list/shower/app_list_shower_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/shower/app_list_shower_impl.h
diff --git a/ui/app_list/shower/app_list_shower_impl.h b/ui/app_list/shower/app_list_shower_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..85cce8567e34a7176f25982daa75d289a45ad98c
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower_impl.h
@@ -0,0 +1,118 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_SHOWER_APP_LIST_SHOWER_IMPL_H_
+#define UI_APP_LIST_SHOWER_APP_LIST_SHOWER_IMPL_H_
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "ui/app_list/pagination_model_observer.h"
+#include "ui/app_list/shower/app_list_shower.h"
+#include "ui/app_list/shower/app_list_shower_delegate.h"
+#include "ui/aura/client/focus_change_observer.h"
+#include "ui/aura/window_observer.h"
+#include "ui/compositor/layer_animation_observer.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/views/widget/widget_observer.h"
+
+namespace app_list {
+class AppListView;
+class AppListViewDelegate;
+class AppListShowerDelegateFactory;
+
+namespace test {
+class AppListShowerImplTestApi;
+}
+
+class AppListShowerImplTest;
+class AppListViewDelegate;
+
+// Manages app list UI. Creates AppListView and schedules showing/hiding
+// animation. While the UI is visible, it monitors things such as app list
+// activation state to auto dismiss the UI. Delegates the responsibility
+// for laying out the app list UI to ash::AppListLayoutDelegate.
+class APP_LIST_SHOWER_EXPORT AppListShowerImpl
+ : public AppListShower,
+ public aura::client::FocusChangeObserver,
+ public aura::WindowObserver,
+ public ui::ImplicitAnimationObserver,
+ public views::WidgetObserver,
+ public PaginationModelObserver {
+ public:
+ explicit AppListShowerImpl(AppListShowerDelegateFactory* factory);
+ ~AppListShowerImpl() override;
+
+ // Returns app list window or NULL if it is not visible.
+ aura::Window* GetWindow();
+
+ // Returns app list view if one exists, or NULL otherwise.
+ AppListView* GetView() { return view_; }
+
+ // AppListShower:
+ void Show(aura::Window* window) override;
+ void Dismiss() override;
+ bool IsVisible() const override;
+ bool GetTargetVisibility() const override;
+
+ private:
+ friend class test::AppListShowerImplTestApi;
+
+ // Sets the app list view and attempts to show it.
+ void SetView(AppListView* view);
+
+ // Forgets the view.
+ void ResetView();
+
+ // Starts show/hide animation.
+ void ScheduleAnimation();
+
+ // aura::client::FocusChangeObserver overrides:
+ void OnWindowFocused(aura::Window* gained_focus,
+ aura::Window* lost_focus) override;
+
+ // aura::WindowObserver overrides:
+ void OnWindowBoundsChanged(aura::Window* root,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) override;
+
+ // ui::ImplicitAnimationObserver overrides:
+ void OnImplicitAnimationsCompleted() override;
+
+ // views::WidgetObserver overrides:
+ void OnWidgetDestroying(views::Widget* widget) override;
+
+ // PaginationModelObserver overrides:
+ void TotalPagesChanged() override;
+ void SelectedPageChanged(int old_selected, int new_selected) override;
+ void TransitionStarted() override;
+ void TransitionChanged() override;
+
+ // Not owned
+ AppListShowerDelegateFactory* const factory_;
+
+ // Responsible for laying out the app list UI.
+ scoped_ptr<AppListShowerDelegate> shower_delegate_;
+
+ // Whether we should show or hide app list widget.
+ bool is_visible_ = false;
+
+ // The AppListView this class manages, owned by its widget.
+ AppListView* view_ = nullptr;
+
+ // The current page of the AppsGridView of |view_|. This is stored outside of
+ // the view's PaginationModel, so that it persists when the view is destroyed.
+ int current_apps_page_ = -1;
+
+ // Cached bounds of |view_| for snapping back animation after over-scroll.
+ gfx::Rect view_bounds_;
+
+ // Whether should schedule snap back animation.
+ bool should_snap_back_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(AppListShowerImpl);
+};
+
+} // namespace app_list
+
+#endif // UI_APP_LIST_SHOWER_APP_LIST_SHOWER_IMPL_H_
« no previous file with comments | « ui/app_list/shower/app_list_shower_export.h ('k') | ui/app_list/shower/app_list_shower_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698