Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc

Issue 1682373002: Misc. small changes in preparation for moving popup mode edge drawing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/profiles/profiles_state.h" 9 #include "chrome/browser/profiles/profiles_state.h"
10 #include "chrome/browser/ui/layout_constants.h" 10 #include "chrome/browser/ui/layout_constants.h"
(...skipping 24 matching lines...) Expand all
35 const int kCaptionButtonSpacing = 0; 35 const int kCaptionButtonSpacing = 0;
36 #endif 36 #endif
37 37
38 } // namespace 38 } // namespace
39 39
40 /////////////////////////////////////////////////////////////////////////////// 40 ///////////////////////////////////////////////////////////////////////////////
41 // OpaqueBrowserFrameView, public: 41 // OpaqueBrowserFrameView, public:
42 42
43 // statics 43 // statics
44 44
45 // The content edge images have a shadow built into them.
46 const int OpaqueBrowserFrameViewLayout::kContentEdgeShadowThickness = 2;
47
45 // Besides the frame border, there's empty space atop the window in restored 48 // Besides the frame border, there's empty space atop the window in restored
46 // mode, to use to drag the window around. 49 // mode, to use to drag the window around.
47 const int OpaqueBrowserFrameViewLayout::kNonClientRestoredExtraThickness = 11; 50 const int OpaqueBrowserFrameViewLayout::kNonClientRestoredExtraThickness = 11;
48 51
49 // The frame border is only visible in restored mode and is hardcoded to 4 px on 52 // The frame border is only visible in restored mode and is hardcoded to 4 px on
50 // each side regardless of the system window border size. 53 // each side regardless of the system window border size.
51 const int OpaqueBrowserFrameViewLayout::kFrameBorderThickness = 4; 54 const int OpaqueBrowserFrameViewLayout::kFrameBorderThickness = 4;
52 55
53 // The titlebar has a 2 px 3D edge along the top and bottom. 56 // The titlebar has a 2 px 3D edge along the top.
54 const int OpaqueBrowserFrameViewLayout::kTitlebarTopAndBottomEdgeThickness = 2; 57 const int OpaqueBrowserFrameViewLayout::kTitlebarTopEdgeThickness = 2;
55 58
56 // The icon is inset 2 px from the left frame border. 59 // The icon is inset 2 px from the left frame border.
57 const int OpaqueBrowserFrameViewLayout::kIconLeftSpacing = 2; 60 const int OpaqueBrowserFrameViewLayout::kIconLeftSpacing = 2;
58 61
59 // There is a 4 px gap between the icon and the title text. 62 // There is a 4 px gap between the icon and the title text.
60 const int OpaqueBrowserFrameViewLayout::kIconTitleSpacing = 4; 63 const int OpaqueBrowserFrameViewLayout::kIconTitleSpacing = 4;
61 64
62 // The horizontal spacing to use in most cases when laying out things near the 65 // The horizontal spacing to use in most cases when laying out things near the
63 // caption button area. 66 // caption button area.
64 const int OpaqueBrowserFrameViewLayout::kCaptionSpacing = 5; 67 const int OpaqueBrowserFrameViewLayout::kCaptionSpacing = 5;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // Annoyingly, the pre-MD layout uses different heights for the hit-test 179 // Annoyingly, the pre-MD layout uses different heights for the hit-test
177 // exclusion region (which we want here, since we're trying to size the border 180 // exclusion region (which we want here, since we're trying to size the border
178 // so that the region above the tab's hit-test zone matches) versus the shadow 181 // so that the region above the tab's hit-test zone matches) versus the shadow
179 // thickness. 182 // thickness.
180 const int exclusion = GetLayoutConstant(TAB_TOP_EXCLUSION_HEIGHT); 183 const int exclusion = GetLayoutConstant(TAB_TOP_EXCLUSION_HEIGHT);
181 return (!restored && (IsTitleBarCondensed() || delegate_->IsFullscreen())) ? 184 return (!restored && (IsTitleBarCondensed() || delegate_->IsFullscreen())) ?
182 top : (top + kNonClientRestoredExtraThickness - exclusion); 185 top : (top + kNonClientRestoredExtraThickness - exclusion);
183 } 186 }
184 187
185 int OpaqueBrowserFrameViewLayout::TitlebarBottomThickness(bool restored) const { 188 int OpaqueBrowserFrameViewLayout::TitlebarBottomThickness(bool restored) const {
186 int thickness = kTitleBarAdditionalPadding; 189 const int thickness =
187 // If there's a non-empty toolbar, it will render the bottom portion of the 190 kTitleBarAdditionalPadding + kContentEdgeShadowThickness;
188 // titlebar. 191 return (delegate_->IsToolbarVisible() || !IsTitleBarCondensed() || restored)
189 if (delegate_->IsToolbarVisible()) 192 ? (thickness + views::NonClientFrameView::kClientEdgeThickness)
190 return thickness; 193 : thickness;
191 thickness += kTitlebarTopAndBottomEdgeThickness;
192 return (!restored && IsTitleBarCondensed()) ?
193 thickness : (thickness + views::NonClientFrameView::kClientEdgeThickness);
194 } 194 }
195 195
196 int OpaqueBrowserFrameViewLayout::CaptionButtonY(bool restored) const { 196 int OpaqueBrowserFrameViewLayout::CaptionButtonY(bool restored) const {
197 // Maximized buttons start at window top, since the window has no border. This 197 // Maximized buttons start at window top, since the window has no border. This
198 // offset is for the image (the actual clickable bounds extend all the way to 198 // offset is for the image (the actual clickable bounds extend all the way to
199 // the top to take Fitts' Law into account). 199 // the top to take Fitts' Law into account).
200 const int frame = (!restored && IsTitleBarCondensed()) ? 200 const int frame = (!restored && IsTitleBarCondensed()) ?
201 FrameBorderThickness(false) : 201 FrameBorderThickness(false) :
202 views::NonClientFrameView::kFrameShadowThickness; 202 views::NonClientFrameView::kFrameShadowThickness;
203 return frame + extra_caption_y_; 203 return frame + extra_caption_y_;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 // Our frame border has a different "3D look" than Windows'. Theirs has 285 // Our frame border has a different "3D look" than Windows'. Theirs has
286 // a more complex gradient on the top that they push their icon/title 286 // a more complex gradient on the top that they push their icon/title
287 // below; then the maximized window cuts this off and the icon/title are 287 // below; then the maximized window cuts this off and the icon/title are
288 // centered in the remaining space. Because the apparent shape of our 288 // centered in the remaining space. Because the apparent shape of our
289 // border is simpler, using the same positioning makes things look 289 // border is simpler, using the same positioning makes things look
290 // slightly uncentered with restored windows, so when the window is 290 // slightly uncentered with restored windows, so when the window is
291 // restored, instead of calculating the remaining space from below the 291 // restored, instead of calculating the remaining space from below the
292 // frame border, we calculate from below the 3D edge. 292 // frame border, we calculate from below the 3D edge.
293 int unavailable_px_at_top = IsTitleBarCondensed() ? 293 int unavailable_px_at_top = IsTitleBarCondensed() ?
294 frame_thickness : kTitlebarTopAndBottomEdgeThickness; 294 frame_thickness : kTitlebarTopEdgeThickness;
295 // When the icon is shorter than the minimum space we reserve for the 295 // When the icon is shorter than the minimum space we reserve for the
296 // caption button, we vertically center it. We want to bias rounding to 296 // caption button, we vertically center it. We want to bias rounding to
297 // put extra space above the icon, since the 3D edge (+ client edge, for 297 // put extra space above the icon, since the 3D edge (+ client edge, for
298 // restored windows) below looks (to the eye) more like additional space 298 // restored windows) below looks (to the eye) more like additional space
299 // than does the 3D edge (or nothing at all, for maximized windows) 299 // than does the 3D edge (or nothing at all, for maximized windows)
300 // above; hence the +1. 300 // above; hence the +1.
301 int y = unavailable_px_at_top + (NonClientTopBorderHeight(false) - 301 int y = unavailable_px_at_top + (NonClientTopBorderHeight(false) -
302 unavailable_px_at_top - size - 302 unavailable_px_at_top - size -
303 TitlebarBottomThickness(false) + 1) / 2; 303 TitlebarBottomThickness(false) + 1) / 2;
304 304
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 619
620 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, 620 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host,
621 views::View* view) { 621 views::View* view) {
622 SetView(view->id(), view); 622 SetView(view->id(), view);
623 } 623 }
624 624
625 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, 625 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host,
626 views::View* view) { 626 views::View* view) {
627 SetView(view->id(), nullptr); 627 SetView(view->id(), nullptr);
628 } 628 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698