| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/profiles/profiles_state.h" | 8 #include "chrome/browser/profiles/profiles_state.h" |
| 9 #include "chrome/browser/ui/views/layout_constants.h" | 9 #include "chrome/browser/ui/views/layout_constants.h" |
| 10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "components/signin/core/common/profile_management_switches.h" | 12 #include "components/signin/core/common/profile_management_switches.h" |
| 13 #include "ui/gfx/font.h" | 13 #include "ui/gfx/font.h" |
| 14 #include "ui/views/controls/button/image_button.h" | 14 #include "ui/views/controls/button/image_button.h" |
| 15 #include "ui/views/controls/label.h" | 15 #include "ui/views/controls/label.h" |
| 16 | 16 |
| 17 #if defined(ENABLE_SUPERVISED_USERS) | 17 #if defined(ENABLE_SUPERVISED_USERS) |
| 18 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" | 18 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // Besides the frame border, there's another 9 px of empty space atop the | 23 // Besides the frame border, there's empty space atop the window in restored |
| 24 // window in restored mode, to use to drag the window around. | 24 // mode, to use to drag the window around. |
| 25 const int kNonClientRestoredExtraThickness = 9; | 25 const int kNonClientRestoredExtraThickness = 11; |
| 26 | 26 |
| 27 // The titlebar never shrinks too short to show the caption button plus some | 27 // The titlebar never shrinks too short to show the caption button plus some |
| 28 // padding below it. | 28 // padding below it. |
| 29 const int kCaptionButtonHeightWithPadding = 19; | 29 const int kCaptionButtonHeightWithPadding = 19; |
| 30 | 30 |
| 31 // There is a 5 px gap between the title text and the caption buttons. | 31 // There is a 5 px gap between the title text and the caption buttons. |
| 32 const int kTitleLogoSpacing = 5; | 32 const int kTitleLogoSpacing = 5; |
| 33 | 33 |
| 34 // The frame border is only visible in restored mode and is hardcoded to 4 px on | 34 // The frame border is only visible in restored mode and is hardcoded to 4 px on |
| 35 // each side regardless of the system window border size. | 35 // each side regardless of the system window border size. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 220 } |
| 221 | 221 |
| 222 int thickness = FrameBorderThickness(restored); | 222 int thickness = FrameBorderThickness(restored); |
| 223 if (!restored && delegate_->IsTabStripVisible() && IsTitleBarCondensed()) | 223 if (!restored && delegate_->IsTabStripVisible() && IsTitleBarCondensed()) |
| 224 thickness -= kTabstripTopShadowThickness; | 224 thickness -= kTabstripTopShadowThickness; |
| 225 return thickness; | 225 return thickness; |
| 226 } | 226 } |
| 227 | 227 |
| 228 int OpaqueBrowserFrameViewLayout::GetTabStripInsetsTop(bool restored) const { | 228 int OpaqueBrowserFrameViewLayout::GetTabStripInsetsTop(bool restored) const { |
| 229 const int top = NonClientTopBorderHeight(restored); | 229 const int top = NonClientTopBorderHeight(restored); |
| 230 // Annoyingly, the pre-MD layout uses different heights for the hit-test |
| 231 // exclusion region (which we want here, since we're trying to size the border |
| 232 // so that the region above the tab's hit-test zone matches) versus the shadow |
| 233 // thickness. |
| 234 const int exclusion = GetLayoutConstant(TAB_TOP_EXCLUSION_HEIGHT); |
| 230 return (!restored && (IsTitleBarCondensed() || delegate_->IsFullscreen())) ? | 235 return (!restored && (IsTitleBarCondensed() || delegate_->IsFullscreen())) ? |
| 231 top : (top + kNonClientRestoredExtraThickness); | 236 top : (top + kNonClientRestoredExtraThickness - exclusion); |
| 232 } | 237 } |
| 233 | 238 |
| 234 int OpaqueBrowserFrameViewLayout::TitlebarBottomThickness(bool restored) const { | 239 int OpaqueBrowserFrameViewLayout::TitlebarBottomThickness(bool restored) const { |
| 235 const int edge = kTitlebarTopAndBottomEdgeThickness; | 240 const int edge = kTitlebarTopAndBottomEdgeThickness; |
| 236 return (!restored && IsTitleBarCondensed()) ? | 241 return (!restored && IsTitleBarCondensed()) ? |
| 237 edge : (edge + views::NonClientFrameView::kClientEdgeThickness); | 242 edge : (edge + views::NonClientFrameView::kClientEdgeThickness); |
| 238 } | 243 } |
| 239 | 244 |
| 240 int OpaqueBrowserFrameViewLayout::CaptionButtonY(bool restored) const { | 245 int OpaqueBrowserFrameViewLayout::CaptionButtonY(bool restored) const { |
| 241 // Maximized buttons start at window top, since the window has no border. This | 246 // Maximized buttons start at window top, since the window has no border. This |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 | 708 |
| 704 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, | 709 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, |
| 705 views::View* view) { | 710 views::View* view) { |
| 706 SetView(view->id(), view); | 711 SetView(view->id(), view); |
| 707 } | 712 } |
| 708 | 713 |
| 709 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, | 714 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, |
| 710 views::View* view) { | 715 views::View* view) { |
| 711 SetView(view->id(), nullptr); | 716 SetView(view->id(), nullptr); |
| 712 } | 717 } |
| OLD | NEW |