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..a55ec3b7a61984e2a63fdd77cc0cc453e912cc9c 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 regions for windows with non-standard frames. |
James Cook
2016/06/14 23:44:56
Nice class comment.
optional: Maybe cite an examp
msw
2016/06/15 17:06:40
Done.
|
+// It uses empty insets, doesn't paint anything, and hit tests return HTCAPTION. |
+class StubNonClientFrameView : public views::NonClientFrameView { |
James Cook
2016/06/14 23:44:56
optional: I wish there was a better name for this.
msw
2016/06/15 17:06:40
Went with EmptyDraggableNonClientFrameView, but I'
James Cook
2016/06/15 23:21:13
SGTM
|
+ public: |
+ StubNonClientFrameView() {} |
+ ~StubNonClientFrameView() 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(StubNonClientFrameView); |
+}; |
+ |
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 StubNonClientFrameView(); |
+ return new NonClientFrameViewMash(GetWidget(), window()); |
} |
void InitNativeWidget(const views::Widget::InitParams& params) override { |
views::NativeWidgetMus::InitNativeWidget(params); |