Chromium Code Reviews| Index: chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc |
| diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc |
| index 146de727b1036bbd7bb211eaefdab0c5cd8789a4..95da58ef025c1511fe28a5304791b1d719c8137e 100644 |
| --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc |
| +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc |
| @@ -4,8 +4,10 @@ |
| #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" |
| +#include "base/command_line.h" |
| #include "chrome/browser/profiles/profiles_state.h" |
| #include "chrome/browser/ui/views/avatar_menu_button.h" |
| +#include "chrome/common/chrome_switches.h" |
| #include "ui/gfx/font.h" |
| #include "ui/views/controls/button/image_button.h" |
| #include "ui/views/controls/label.h" |
| @@ -142,7 +144,7 @@ gfx::Rect OpaqueBrowserFrameViewLayout::GetBoundsForTabStrip( |
| if (delegate_->GetAdditionalReservedSpaceInTabStrip()) |
| available_width -= delegate_->GetAdditionalReservedSpaceInTabStrip(); |
| - const int caption_spacing = delegate_->IsMaximized() ? |
| + const int caption_spacing = IsTitleBarCondensed() ? |
| kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing; |
| const int tabstrip_width = available_width - caption_spacing; |
| gfx::Rect bounds(leading_button_start_, GetTabStripInsetsTop(false), |
| @@ -175,7 +177,7 @@ gfx::Size OpaqueBrowserFrameViewLayout::GetMinimumSize( |
| if (delegate_->IsTabStripVisible()) { |
| gfx::Size preferred_size = delegate_->GetTabstripPreferredSize(); |
| const int min_tabstrip_width = preferred_size.width(); |
| - const int caption_spacing = delegate_->IsMaximized() ? |
| + const int caption_spacing = IsTitleBarCondensed() ? |
| kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing; |
| min_size.Enlarge(min_tabstrip_width + caption_spacing, 0); |
| } |
| @@ -194,7 +196,7 @@ gfx::Rect OpaqueBrowserFrameViewLayout::GetWindowBoundsForClientBounds( |
| } |
| int OpaqueBrowserFrameViewLayout::FrameBorderThickness(bool restored) const { |
| - return (!restored && (delegate_->IsMaximized() || |
| + return (!restored && (IsTitleBarCondensed() || |
| delegate_->IsFullscreen())) ? |
| 0 : kFrameBorderThickness; |
| } |
| @@ -202,7 +204,7 @@ int OpaqueBrowserFrameViewLayout::FrameBorderThickness(bool restored) const { |
| int OpaqueBrowserFrameViewLayout::NonClientBorderThickness() const { |
| // When we fill the screen, we don't show a client edge. |
| return FrameBorderThickness(false) + |
| - ((delegate_->IsMaximized() || delegate_->IsFullscreen()) ? |
| + ((IsTitleBarCondensed() || delegate_->IsFullscreen()) ? |
| 0 : views::NonClientFrameView::kClientEdgeThickness); |
| } |
| @@ -215,21 +217,24 @@ int OpaqueBrowserFrameViewLayout::NonClientTopBorderHeight( |
| } |
| return FrameBorderThickness(restored) - |
| - ((delegate_->IsTabStripVisible() && |
| - !restored && !delegate_->ShouldLeaveOffsetNearTopBorder()) |
| - ? kTabstripTopShadowThickness : 0); |
| + ((delegate_->IsTabStripVisible() && !restored && |
| + (!delegate_->ShouldLeaveOffsetNearTopBorder() || |
|
James Cook
2013/12/19 20:57:55
Though not your fault, this conditional is too cra
Matt Giuca
2013/12/20 03:53:22
Done.
|
| + IsTitleBarCondensed())) |
| + ? kTabstripTopShadowThickness |
| + : 0); |
| } |
| int OpaqueBrowserFrameViewLayout::GetTabStripInsetsTop(bool restored) const { |
| return NonClientTopBorderHeight(restored) + ((!restored && |
| (!delegate_->ShouldLeaveOffsetNearTopBorder() || |
| + IsTitleBarCondensed() || |
| delegate_->IsFullscreen())) ? |
| 0 : kNonClientRestoredExtraThickness); |
| } |
| int OpaqueBrowserFrameViewLayout::TitlebarBottomThickness(bool restored) const { |
| return kTitlebarTopAndBottomEdgeThickness + |
| - ((!restored && delegate_->IsMaximized()) ? 0 : |
| + ((!restored && IsTitleBarCondensed()) ? 0 : |
| views::NonClientFrameView::kClientEdgeThickness); |
| } |
| @@ -237,7 +242,7 @@ int OpaqueBrowserFrameViewLayout::CaptionButtonY(bool restored) const { |
| // Maximized buttons start at window top, since the window has no border. This |
| // offset is for the image (the actual clickable bounds extend all the way to |
| // the top to take Fitts' Law into account). |
| - return ((!restored && delegate_->IsMaximized()) ? |
| + return ((!restored && IsTitleBarCondensed()) ? |
| FrameBorderThickness(false) : |
| views::NonClientFrameView::kFrameShadowThickness) + extra_caption_y_; |
| } |
| @@ -256,6 +261,15 @@ gfx::Rect OpaqueBrowserFrameViewLayout::CalculateClientAreaBounds( |
| std::max(0, height - top_height - border_thickness)); |
| } |
| +bool OpaqueBrowserFrameViewLayout::IsTitleBarCondensed() const { |
| +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseSystemTitleBar)) |
| + return true; |
| +#endif |
| + |
| + return delegate_->IsMaximized(); |
| +} |
| + |
| /////////////////////////////////////////////////////////////////////////////// |
| // OpaqueBrowserFrameView, private: |
| @@ -320,7 +334,7 @@ void OpaqueBrowserFrameViewLayout::LayoutTitleBar(views::View* host) { |
| // slightly uncentered with restored windows, so when the window is |
| // restored, instead of calculating the remaining space from below the |
| // frame border, we calculate from below the 3D edge. |
| - int unavailable_px_at_top = delegate_->IsMaximized() ? |
| + int unavailable_px_at_top = IsTitleBarCondensed() ? |
| frame_thickness : kTitlebarTopAndBottomEdgeThickness; |
| // When the icon is shorter than the minimum space we reserve for the |
| // caption button, we vertically center it. We want to bias rounding to |
| @@ -406,7 +420,7 @@ void OpaqueBrowserFrameViewLayout::LayoutAvatar(views::View* host) { |
| host->width() - trailing_button_start_ - kAvatarOuterSpacing - |
| incognito_icon.width() : |
| leading_button_start_ + kAvatarOuterSpacing; |
| - int avatar_y = delegate_->IsMaximized() ? |
| + int avatar_y = IsTitleBarCondensed() ? |
| (NonClientTopBorderHeight(false) + kTabstripTopShadowThickness) : |
| avatar_restored_y; |
| avatar_bounds_.SetRect( |
| @@ -512,7 +526,7 @@ void OpaqueBrowserFrameViewLayout::SetBoundsForButton( |
| // side of the caption buttons. In maximized mode we extend buttons to the |
| // screen top and the rightmost button to the screen right (or leftmost button |
| // to the screen left, for left-aligned buttons) to obey Fitts' Law. |
| - bool is_maximized = delegate_->IsMaximized(); |
| + bool is_maximized = IsTitleBarCondensed(); |
|
James Cook
2013/12/19 20:57:55
nit: Maybe call this title_bar_condensed instead o
Matt Giuca
2013/12/20 03:53:22
Done.
|
| // When we are the first button on the leading side and are the close |
| // button, we must flip ourselves, because the close button assets have |