linux: Share code on frameless window with Windows.

This commit is contained in:
Cheng Zhao 2014-07-16 16:00:08 +08:00
parent 9afc2daf75
commit 2a2fc4903d
4 changed files with 7 additions and 27 deletions

View file

@ -76,9 +76,7 @@ const gfx::FontList& GetTitleFontList() {
// LinuxFrameView, public:
LinuxFrameView::LinuxFrameView()
: window_(NULL),
frame_(NULL),
window_icon_(NULL),
: window_icon_(NULL),
minimize_button_(NULL),
maximize_button_(NULL),
restore_button_(NULL),
@ -117,12 +115,6 @@ void LinuxFrameView::Init(NativeWindowViews* window, views::Widget* frame) {
}
}
int LinuxFrameView::ResizingBorderHitTest(const gfx::Point& point) {
return GetHTComponentForFrame(point, FrameBorderThickness(),
FrameBorderThickness() + kClientEdgeThickness, kResizeAreaCornerSize,
kResizeAreaCornerSize, true);
}
///////////////////////////////////////////////////////////////////////////////
// LinuxFrameView, NonClientFrameView implementation:
@ -141,23 +133,13 @@ gfx::Rect LinuxFrameView::GetWindowBoundsForClientBounds(
}
int LinuxFrameView::NonClientHitTest(const gfx::Point& point) {
if (!window_->has_frame())
return FramelessView::NonClientHitTest(point);
// Sanity check.
if (!bounds().Contains(point))
return HTNOWHERE;
// Check for possible draggable region in the client area for the frameless
// window.
SkRegion* draggable_region = window_->draggable_region();
if (draggable_region && draggable_region->contains(point.x(), point.y()))
return HTCAPTION;
// Support resizing frameless window by dragging the border.
if (!window_->has_frame() && frame_->widget_delegate()->CanResize()) {
int window_component = ResizingBorderHitTest(point);
if (window_component != HTNOWHERE)
return window_component;
}
int frame_component = frame_->client_view()->NonClientHitTest(point);
// See if we're in the sysmenu region. (We check the ClientView first to be