Index: chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc |
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc |
index 95390efd24734dde7230dbc45dcb0165335d3330..7f9ed6612eec2dca27ea4ada4ffa76e4e3bd71ea 100644 |
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc |
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc |
@@ -27,6 +27,7 @@ |
#include "ui/aura/window.h" |
#include "ui/base/hit_test.h" |
#include "ui/base/layout.h" |
+#include "ui/base/material_design/material_design_controller.h" |
#include "ui/base/theme_provider.h" |
#include "ui/compositor/layer_animator.h" |
#include "ui/gfx/canvas.h" |
@@ -40,6 +41,10 @@ |
#include "ui/views/widget/widget.h" |
#include "ui/views/widget/widget_delegate.h" |
+#if defined(OS_CHROMEOS) |
+#include "ash/common/ash_layout_constants.h" |
+#endif |
+ |
#if !defined(OS_CHROMEOS) |
#define FRAME_AVATAR_BUTTON |
#endif |
@@ -52,14 +57,6 @@ const int kAvatarButtonOffset = 5; |
#endif |
// Space between right edge of tabstrip and maximize button. |
const int kTabstripRightSpacing = 10; |
-// Height of the shadow of the content area, at the top of the toolbar. |
-const int kContentShadowHeight = 1; |
-// Space between top of window and top of tabstrip for tall headers, such as |
-// for restored windows, apps, etc. |
-const int kTabstripTopSpacingTall = 4; |
-// Space between top of window and top of tabstrip for short headers, such as |
-// for maximized windows, pop-ups, etc. |
-const int kTabstripTopSpacingShort = 0; |
// Height of the shadow in the tab image, used to ensure clicks in the shadow |
// area still drag restored windows. This keeps the clickable area large enough |
// to hit easily. |
@@ -137,9 +134,10 @@ gfx::Rect BrowserNonClientFrameViewMus::GetBoundsForTabStrip( |
int left_inset = GetTabStripLeftInset(); |
int right_inset = GetTabStripRightInset(); |
- return gfx::Rect(left_inset, GetTopInset(false), |
- std::max(0, width() - left_inset - right_inset), |
- tabstrip->GetPreferredSize().height()); |
+ const gfx::Rect bounds(left_inset, GetTopInset(false), |
+ std::max(0, width() - left_inset - right_inset), |
+ tabstrip->GetPreferredSize().height()); |
+ return bounds; |
} |
int BrowserNonClientFrameViewMus::GetTopInset(bool restored) const { |
@@ -155,19 +153,12 @@ int BrowserNonClientFrameViewMus::GetTopInset(bool restored) const { |
return 0; |
} |
- if (browser_view()->IsTabStripVisible()) { |
- return ((frame()->IsMaximized() || frame()->IsFullscreen()) && !restored) |
- ? kTabstripTopSpacingShort |
- : kTabstripTopSpacingTall; |
- } |
- |
- int caption_buttons_bottom = frame_values().normal_insets.top(); |
+ const int header_height = GetHeaderHeight(); |
- // The toolbar partially overlaps the caption buttons. |
- if (browser_view()->IsToolbarVisible()) |
- return caption_buttons_bottom - kContentShadowHeight; |
+ if (browser_view()->IsTabStripVisible()) |
+ return header_height - browser_view()->GetTabStripHeight(); |
- return caption_buttons_bottom + kClientEdgeThickness; |
+ return header_height; |
} |
int BrowserNonClientFrameViewMus::GetThemeBackgroundXInset() const { |
@@ -214,9 +205,14 @@ void BrowserNonClientFrameViewMus::UpdateClientArea() { |
static_cast<aura::WindowTreeHostMus*>( |
GetWidget()->GetNativeWindow()->GetHost()); |
if (show_frame_decorations) { |
- window_tree_host_mus->SetClientArea( |
- views::WindowManagerFrameValues::instance().normal_insets, |
- additional_client_area); |
+ const int header_height = GetHeaderHeight(); |
+ gfx::Insets client_area_insets = |
+ views::WindowManagerFrameValues::instance().normal_insets; |
+ client_area_insets.Set(header_height, client_area_insets.left(), |
+ client_area_insets.bottom(), |
+ client_area_insets.right()); |
+ window_tree_host_mus->SetClientArea(client_area_insets, |
+ additional_client_area); |
views::Widget* reveal_widget = immersive_mode_controller->GetRevealWidget(); |
if (reveal_widget) { |
// In immersive mode the reveal widget needs the same client area as |
@@ -224,9 +220,7 @@ void BrowserNonClientFrameViewMus::UpdateClientArea() { |
// clicks in the frame decoration. |
static_cast<aura::WindowTreeHostMus*>( |
reveal_widget->GetNativeWindow()->GetHost()) |
- ->SetClientArea( |
- views::WindowManagerFrameValues::instance().normal_insets, |
- additional_client_area); |
+ ->SetClientArea(client_area_insets, additional_client_area); |
} |
} else { |
window_tree_host_mus->SetClientArea(gfx::Insets(), additional_client_area); |
@@ -507,3 +501,16 @@ void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { |
GetThemeProvider()->GetColor( |
ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); |
} |
+ |
+int BrowserNonClientFrameViewMus::GetHeaderHeight() const { |
+#if defined(OS_CHROMEOS) |
+ // TODO: move ash_layout_constants to ash/public/cpp. |
+ const bool restored = !frame()->IsMaximized() && !frame()->IsFullscreen(); |
+ return GetAshLayoutSize(restored |
+ ? AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON |
+ : AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON) |
+ .height(); |
+#else |
+ return views::WindowManagerFrameValues::instance().normal_insets.top(); |
+#endif |
+} |