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

Unified Diff: ui/app_list/views/app_list_view.h

Issue 2898743002: Draggable peeking/fullscreen launcher with transparent background. (Closed)
Patch Set: Addressed comments. Created 3 years, 7 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
Index: ui/app_list/views/app_list_view.h
diff --git a/ui/app_list/views/app_list_view.h b/ui/app_list/views/app_list_view.h
index cbdb1d895728135ba6ba8995b4aa480b4bcfaabb..c88d47738ac7ba08a3ceec923f5032c6942b5848 100644
--- a/ui/app_list/views/app_list_view.h
+++ b/ui/app_list/views/app_list_view.h
@@ -9,12 +9,18 @@
#include "base/callback.h"
#include "base/macros.h"
+#include "base/scoped_observer.h"
#include "build/build_config.h"
#include "ui/app_list/app_list_export.h"
#include "ui/app_list/speech_ui_model_observer.h"
+#include "ui/display/display_observer.h"
#include "ui/views/bubble/bubble_dialog_delegate.h"
#include "ui/views/widget/widget.h"
+namespace display {
+class Screen;
+}
+
namespace app_list {
class ApplicationDragAndDropHost;
class AppListMainView;
@@ -32,7 +38,8 @@ class AppListViewTestApi;
// AppListView is the top-level view and controller of app list UI. It creates
// and hosts a AppsGridView and passes AppListModel to it for display.
class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
- public SpeechUIModelObserver {
+ public SpeechUIModelObserver,
+ public display::DisplayObserver {
public:
// Does not take ownership of |delegate|.
explicit AppListView(AppListViewDelegate* delegate);
@@ -62,6 +69,8 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
void UpdateBounds();
+ void UpdateDimensions();
+
// Enables/disables a semi-transparent overlay over the app list (good for
// hiding the app list when a modal dialog is being shown).
void SetAppListOverlayVisible(bool visible);
@@ -89,6 +98,12 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
void Layout() override;
void SchedulePaintInRect(const gfx::Rect& rect) override;
+ // Changes the view to the peeking state or to the fullscreen state.
+ void ToFullscreen();
+ void ToPeeking();
+
+ bool IsFullscreen() const;
+
private:
friend class test::AppListViewTestApi;
@@ -102,6 +117,20 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
// Initializes the widget as a bubble.
void InitializeBubble(gfx::NativeView parent, int initial_apps_page);
+ // Transfers drag events to Start/Update/EndDrag.
+ void HandleDrag(const gfx::Point& location, ui::EventType type);
+
+ // Initializes |initial_drag_separation_|.
+ void StartDrag(const gfx::Point& location);
vadimt 2017/05/26 23:44:08 You don't need to declare StartDrag in .h file. An
newcomer 2017/05/30 21:37:03 Done. Also moved HandleDrag, UpdateDrag, and EndDr
+
+ // Updates the bounds of the widget while maintaining the relative position
+ // of the top of the widget and the gesture.
+ void UpdateDrag(const gfx::Point& location);
+
+ // Handles launcher state transfers. If the drag was fast enough, ignore the
+ // release position and snap to the next state.
+ void EndDrag(const gfx::Point& location);
+
// Overridden from views::BubbleDialogDelegateView:
void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
views::Widget* widget) const override;
@@ -112,6 +141,10 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
bool WidgetHasHitTestMask() const override;
void GetWidgetHitTestMask(gfx::Path* mask) const override;
+ // Overridden from ui::EventHandler:
+ void OnMouseEvent(ui::MouseEvent* event) override;
+ void OnGestureEvent(ui::GestureEvent* event) override;
+
// Overridden from views::WidgetObserver:
void OnWidgetDestroying(views::Widget* widget) override;
void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override;
@@ -120,14 +153,40 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
void OnSpeechRecognitionStateChanged(
SpeechRecognitionState new_state) override;
+ // Overridden from DisplayObserver:
+ void OnDisplayMetricsChanged(const display::Display& display,
+ uint32_t changed_metrics) override;
+
AppListViewDelegate* delegate_; // Weak. Owned by AppListService.
AppListMainView* app_list_main_view_;
SpeechView* speech_view_;
+ views::Widget* fullscreen_widget_ = nullptr; // Owned by AppListView.
views::View* search_box_focus_host_; // Owned by the views hierarchy.
views::Widget* search_box_widget_; // Owned by the app list's widget.
SearchBoxView* search_box_view_; // Owned by |search_box_widget_|.
+ // Owned by the app list's widget.
+ views::View* launcher_background_shield_ = nullptr;
+ // The gap between the initial gesture event and the top of the window.
+ int initial_drag_separation_ = 0;
+ // The velocity of the gesture event.
+ float last_fling_velocity_ = 0;
+ // The height of the peeking launcher, which changes based on screen
+ // orientation.
+ int default_peeking_launcher_y_ = 0;
+ // The DIP delta that must be exceeded for the launcher to snap to the next
+ // state.
+ int launcher_threshold_ = 0;
+ bool is_fullscreen_launcher_ = false;
+ // The desktop area, not including the shelf.
+ gfx::Rect display_work_area_bounds_;
+ // The bounds of the launcher. The size should never change, only the
+ // position.
+ gfx::Rect fullscreen_widget_bounds_;
+
+ // An observer that notifies AppListView when the display has changed.
+ ScopedObserver<display::Screen, display::DisplayObserver> display_observer_;
// A semi-transparent white overlay that covers the app list while dialogs are
// open.

Powered by Google App Engine
This is Rietveld 408576698