Chromium Code Reviews| Index: ui/views/window/custom_frame_view.cc |
| diff --git a/ui/views/window/custom_frame_view.cc b/ui/views/window/custom_frame_view.cc |
| index bb27dc60ca5b57ced6b20b372c4ae82b7c0be6c6..ceb4e0d1c1454fb250712c1cf79803313f57adee 100644 |
| --- a/ui/views/window/custom_frame_view.cc |
| +++ b/ui/views/window/custom_frame_view.cc |
| @@ -31,6 +31,10 @@ |
| #include "ui/views/widget/native_widget_win.h" |
| #endif |
| +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| +#include "ui/views/linux_ui/linux_ui.h" |
|
Ben Goodger (Google)
2014/01/09 23:03:27
Hrm... I would actually like to not have this type
Matt Giuca
2014/01/10 01:07:50
Is the style used by OpaqueBrowserFrameView (havin
|
| +#endif |
| + |
| namespace views { |
| namespace { |
| @@ -186,7 +190,7 @@ int CustomFrameView::NonClientHitTest(const gfx::Point& point) { |
| void CustomFrameView::GetWindowMask(const gfx::Size& size, |
| gfx::Path* window_mask) { |
| DCHECK(window_mask); |
| - if (frame_->IsMaximized()) |
| + if (frame_->IsMaximized() || !ShouldShowTitleBarAndBorder()) |
| return; |
| GetDefaultWindowMask(size, window_mask); |
| @@ -212,6 +216,9 @@ void CustomFrameView::UpdateWindowTitle() { |
| // CustomFrameView, View overrides: |
| void CustomFrameView::OnPaint(gfx::Canvas* canvas) { |
| + if (!ShouldShowTitleBarAndBorder()) |
| + return; |
| + |
| if (frame_->IsMaximized()) |
| PaintMaximizedFrameBorder(canvas); |
| else |
| @@ -222,8 +229,11 @@ void CustomFrameView::OnPaint(gfx::Canvas* canvas) { |
| } |
| void CustomFrameView::Layout() { |
| - LayoutWindowControls(); |
| - LayoutTitleBar(); |
| + if (ShouldShowTitleBarAndBorder()) { |
| + LayoutWindowControls(); |
| + LayoutTitleBar(); |
| + } |
| + |
| LayoutClientView(); |
| } |
| @@ -323,8 +333,19 @@ gfx::Rect CustomFrameView::IconBounds() const { |
| return gfx::Rect(frame_thickness + kIconLeftSpacing, y, size, size); |
| } |
| +bool CustomFrameView::ShouldShowTitleBarAndBorder() const { |
| +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| + // On Ubuntu Unity, if the window is maximized, the system will provide a |
| + // title and caption buttons, so we should not add our own. |
|
Ben Goodger (Google)
2014/01/10 16:41:50
is this true of all frame types within views? if s
Matt Giuca
2014/01/17 01:29:51
OK, I have added a ViewsDelegate method for this.
|
| + views::LinuxUI* ui = views::LinuxUI::instance(); |
| + return !(frame_->IsMaximized() && ui && ui->UnityIsRunning()); |
| +#endif |
| + |
| + return true; |
| +} |
| + |
| bool CustomFrameView::ShouldShowClientEdge() const { |
| - return !frame_->IsMaximized(); |
| + return !frame_->IsMaximized() && ShouldShowTitleBarAndBorder(); |
| } |
| void CustomFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { |
| @@ -549,6 +570,11 @@ void CustomFrameView::LayoutTitleBar() { |
| } |
| void CustomFrameView::LayoutClientView() { |
| + if (!ShouldShowTitleBarAndBorder()) { |
| + client_view_bounds_ = bounds(); |
| + return; |
| + } |
| + |
| int top_height = NonClientTopBorderHeight(); |
| int border_thickness = NonClientBorderThickness(); |
| client_view_bounds_.SetRect(border_thickness, top_height, |