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

Unified Diff: ash/mus/non_client_frame_controller.cc

Issue 2042903002: Support app window draggable areas in mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 6 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: ash/mus/non_client_frame_controller.cc
diff --git a/ash/mus/non_client_frame_controller.cc b/ash/mus/non_client_frame_controller.cc
index dbd8a8269284ed50bae61e6011f2ec42abe80af7..5deb8490d8b26c64dabadc7730d9be1290324e2d 100644
--- a/ash/mus/non_client_frame_controller.cc
+++ b/ash/mus/non_client_frame_controller.cc
@@ -27,6 +27,7 @@
#include "ui/aura/layout_manager.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
+#include "ui/base/hit_test.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/views/mus/native_widget_mus.h"
@@ -84,6 +85,30 @@ class ContentWindowLayoutManager : public aura::LayoutManager {
DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager);
};
+// This class supports draggable app windows that paint their own custom frames.
+// It uses empty insets, doesn't paint anything, and hit tests return HTCAPTION.
+class EmptyDraggableNonClientFrameView : public views::NonClientFrameView {
+ public:
+ EmptyDraggableNonClientFrameView() {}
+ ~EmptyDraggableNonClientFrameView() override {}
+
+ // views::NonClientFrameView:
+ gfx::Rect GetBoundsForClientView() const override { return bounds(); }
+ gfx::Rect GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const override {
+ return bounds();
+ }
+ int NonClientHitTest(const gfx::Point& point) override { return HTCAPTION; }
+ void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override {}
+ void ResetWindowControls() override {}
+ void UpdateWindowIcon() override {}
+ void UpdateWindowTitle() override {}
+ void SizeConstraintsChanged() override {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(EmptyDraggableNonClientFrameView);
+};
+
class WmNativeWidgetMus : public views::NativeWidgetMus {
public:
WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate,
@@ -99,13 +124,11 @@ class WmNativeWidgetMus : public views::NativeWidgetMus {
// NativeWidgetMus:
views::NonClientFrameView* CreateNonClientFrameView() override {
- views::Widget* widget =
- static_cast<views::internal::NativeWidgetPrivate*>(this)->GetWidget();
- NonClientFrameViewMash* frame_view =
- new NonClientFrameViewMash(widget, window());
move_event_handler_.reset(new MoveEventHandler(
window(), window_manager_client_, GetNativeView()));
- return frame_view;
+ if (ShouldRemoveStandardFrame(window()))
+ return new EmptyDraggableNonClientFrameView();
+ return new NonClientFrameViewMash(GetWidget(), window());
}
void InitNativeWidget(const views::Widget::InitParams& params) override {
views::NativeWidgetMus::InitNativeWidget(params);
« no previous file with comments | « no previous file | ash/mus/property_util.h » ('j') | chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698