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

Unified Diff: ash/wm/app_list_controller.h

Issue 1866403006: Revert of AppListController refactoring part 3: Switching over to use AppListShower in Ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus_chrome_delegates_ash_impl
Patch Set: 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 | « ash/test/test_shell_delegate.cc ('k') | ash/wm/app_list_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/app_list_controller.h
diff --git a/ash/wm/app_list_controller.h b/ash/wm/app_list_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..1f3114c37d4858c4bfda875bd5e4fb9696d9a4d5
--- /dev/null
+++ b/ash/wm/app_list_controller.h
@@ -0,0 +1,153 @@
+// Copyright (c) 2012 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 ASH_WM_APP_LIST_CONTROLLER_H_
+#define ASH_WM_APP_LIST_CONTROLLER_H_
+
+#include "ash/shelf/shelf_icon_observer.h"
+#include "ash/shell_observer.h"
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "ui/app_list/pagination_model_observer.h"
+#include "ui/aura/client/focus_change_observer.h"
+#include "ui/aura/window_observer.h"
+#include "ui/compositor/layer_animation_observer.h"
+#include "ui/events/event_handler.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/keyboard/keyboard_controller_observer.h"
+#include "ui/views/widget/widget_observer.h"
+
+namespace app_list {
+class ApplicationDragAndDropHost;
+class AppListView;
+}
+
+namespace ui {
+class LocatedEvent;
+}
+
+namespace ash {
+namespace test {
+class AppListControllerTestApi;
+}
+
+// AppListController is a controller that manages app list UI for shell.
+// It creates AppListView and schedules showing/hiding animation.
+// While the UI is visible, it monitors things such as app list widget's
+// activation state and desktop mouse click to auto dismiss the UI.
+class AppListController : public ui::EventHandler,
+ public aura::client::FocusChangeObserver,
+ public aura::WindowObserver,
+ public ui::ImplicitAnimationObserver,
+ public views::WidgetObserver,
+ public keyboard::KeyboardControllerObserver,
+ public ShellObserver,
+ public ShelfIconObserver,
+ public app_list::PaginationModelObserver {
+ public:
+ AppListController();
+ ~AppListController() override;
+
+ // Show/hide app list window. The |window| is used to deterime in
+ // which display (in which the |window| exists) the app list should
+ // be shown.
+ void Show(aura::Window* window);
+ void Dismiss();
+
+ // Whether app list window is visible (shown or being shown).
+ bool IsVisible() const;
+
+ // Returns target visibility. This differs from IsVisible() if an animation
+ // is ongoing.
+ bool GetTargetVisibility() const { return is_visible_; }
+
+ // Returns app list window or NULL if it is not visible.
+ aura::Window* GetWindow();
+
+ // Returns app list view if one exists, or NULL otherwise.
+ app_list::AppListView* GetView() { return view_; }
+
+ private:
+ friend class test::AppListControllerTestApi;
+
+ // If |drag_and_drop_host| is not NULL it will be called upon drag and drop
+ // operations outside the application list.
+ void SetDragAndDropHostOfCurrentAppList(
+ app_list::ApplicationDragAndDropHost* drag_and_drop_host);
+
+ // Sets the app list view and attempts to show it.
+ void SetView(app_list::AppListView* view);
+
+ // Forgets the view.
+ void ResetView();
+
+ // Starts show/hide animation.
+ void ScheduleAnimation();
+
+ void ProcessLocatedEvent(ui::LocatedEvent* event);
+
+ // Makes app list bubble update its bounds.
+ void UpdateBounds();
+
+ // ui::EventHandler overrides:
+ void OnMouseEvent(ui::MouseEvent* event) override;
+ void OnGestureEvent(ui::GestureEvent* event) override;
+
+ // 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;
+
+ // KeyboardControllerObserver overrides:
+ void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
+
+ // ShellObserver overrides:
+ void OnShelfAlignmentChanged(aura::Window* root_window) override;
+ void OnMaximizeModeStarted() override;
+ void OnMaximizeModeEnded() override;
+
+ // ShelfIconObserver overrides:
+ void OnShelfIconPositionsChanged() override;
+
+ // app_list::PaginationModelObserver overrides:
+ void TotalPagesChanged() override;
+ void SelectedPageChanged(int old_selected, int new_selected) override;
+ void TransitionStarted() override;
+ void TransitionChanged() override;
+
+ // Whether we should show or hide app list widget.
+ bool is_visible_;
+
+ // Whether the app list should remain centered.
+ bool is_centered_;
+
+ // The AppListView this class manages, owned by its widget.
+ app_list::AppListView* view_;
+
+ // 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_;
+
+ // 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_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppListController);
+};
+
+} // namespace ash
+
+#endif // ASH_WM_APP_LIST_CONTROLLER_H_
« no previous file with comments | « ash/test/test_shell_delegate.cc ('k') | ash/wm/app_list_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698