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

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

Issue 10270016: Fix spacing around left tab, increment theme resource ID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/frame/glass_browser_frame_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // The icon never shrinks below 16 px on a side. 77 // The icon never shrinks below 16 px on a side.
78 const int kIconMinimumSize = 16; 78 const int kIconMinimumSize = 16;
79 // There is a 4 px gap between the icon and the title text. 79 // There is a 4 px gap between the icon and the title text.
80 const int kIconTitleSpacing = 4; 80 const int kIconTitleSpacing = 4;
81 // There is a 5 px gap between the title text and the caption buttons. 81 // There is a 5 px gap between the title text and the caption buttons.
82 const int kTitleLogoSpacing = 5; 82 const int kTitleLogoSpacing = 5;
83 // The avatar ends 2 px above the bottom of the tabstrip (which, given the 83 // The avatar ends 2 px above the bottom of the tabstrip (which, given the
84 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the 84 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the
85 // user). 85 // user).
86 const int kAvatarBottomSpacing = 2; 86 const int kAvatarBottomSpacing = 2;
87 // There are 2 px on each side of the avatar (between the frame border and 87 // Space between the frame border and the left edge of the avatar.
88 // it on the left, and between it and the tabstrip on the right). 88 const int kAvatarLeftSpacing = 2;
89 const int kAvatarSideSpacing = 2; 89 // Space between the right edge of the avatar and the tabstrip.
90 const int kAvatarRightSpacing = -2;
90 // The top 3 px of the tabstrip is shadow; in maximized mode we push this off 91 // The top 3 px of the tabstrip is shadow; in maximized mode we push this off
91 // the top of the screen so the tabs appear flush against the screen edge. 92 // the top of the screen so the tabs appear flush against the screen edge.
92 const int kTabstripTopShadowThickness = 3; 93 const int kTabstripTopShadowThickness = 3;
93 // In restored mode, the New Tab button isn't at the same height as the caption 94 // In restored mode, the New Tab button isn't at the same height as the caption
94 // buttons, but the space will look cluttered if it actually slides under them, 95 // buttons, but the space will look cluttered if it actually slides under them,
95 // so we stop it when the gap between the two is down to 5 px. 96 // so we stop it when the gap between the two is down to 5 px.
96 const int kNewTabCaptionRestoredSpacing = 5; 97 const int kNewTabCaptionRestoredSpacing = 5;
97 // In maximized mode, where the New Tab button and the caption buttons are at 98 // In maximized mode, where the New Tab button and the caption buttons are at
98 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid 99 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid
99 // looking too cluttered. 100 // looking too cluttered.
100 const int kNewTabCaptionMaximizedSpacing = 16; 101 const int kNewTabCaptionMaximizedSpacing = 16;
101 // How far to indent the tabstrip from the left side of the screen when there 102 // How far to indent the tabstrip from the left side of the screen when there
102 // is no avatar icon. 103 // is no avatar icon.
103 const int kTabStripIndent = -4; 104 const int kTabStripIndent = -6;
104 105
105 // Converts |bounds| from |src|'s coordinate system to |dst|, and checks if 106 // Converts |bounds| from |src|'s coordinate system to |dst|, and checks if
106 // |pt| is contained within. 107 // |pt| is contained within.
107 bool ConvertedContainsCheck(gfx::Rect bounds, const views::View* src, 108 bool ConvertedContainsCheck(gfx::Rect bounds, const views::View* src,
108 const views::View* dst, const gfx::Point& pt) { 109 const views::View* dst, const gfx::Point& pt) {
109 DCHECK(src); 110 DCHECK(src);
110 DCHECK(dst); 111 DCHECK(dst);
111 gfx::Point origin(bounds.origin()); 112 gfx::Point origin(bounds.origin());
112 views::View::ConvertPointToView(src, dst, &origin); 113 views::View::ConvertPointToView(src, dst, &origin);
113 bounds.set_origin(origin); 114 bounds.set_origin(origin);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 204
204 /////////////////////////////////////////////////////////////////////////////// 205 ///////////////////////////////////////////////////////////////////////////////
205 // OpaqueBrowserFrameView, BrowserNonClientFrameView implementation: 206 // OpaqueBrowserFrameView, BrowserNonClientFrameView implementation:
206 207
207 gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip( 208 gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip(
208 views::View* tabstrip) const { 209 views::View* tabstrip) const {
209 if (!tabstrip) 210 if (!tabstrip)
210 return gfx::Rect(); 211 return gfx::Rect();
211 212
212 int tabstrip_x = browser_view()->ShouldShowAvatar() ? 213 int tabstrip_x = browser_view()->ShouldShowAvatar() ?
213 (avatar_bounds_.right() + kAvatarSideSpacing) : 214 (avatar_bounds_.right() + kAvatarRightSpacing) :
214 NonClientBorderThickness() + kTabStripIndent; 215 NonClientBorderThickness() + kTabStripIndent;
215 216
216 int maximized_spacing = kNewTabCaptionMaximizedSpacing; 217 int maximized_spacing = kNewTabCaptionMaximizedSpacing;
217 int tabstrip_width = minimize_button_->x() - tabstrip_x - 218 int tabstrip_width = minimize_button_->x() - tabstrip_x -
218 (frame()->IsMaximized() ? 219 (frame()->IsMaximized() ?
219 maximized_spacing : kNewTabCaptionRestoredSpacing); 220 maximized_spacing : kNewTabCaptionRestoredSpacing);
220 return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false), 221 return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false),
221 std::max(0, tabstrip_width), tabstrip->GetPreferredSize().height()); 222 std::max(0, tabstrip_width), tabstrip->GetPreferredSize().height());
222 } 223 }
223 224
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 // use the incognito icon to layout the avatar button. The profile icon 951 // use the incognito icon to layout the avatar button. The profile icon
951 // can be customized so we can't depend on its size to perform layout. 952 // can be customized so we can't depend on its size to perform layout.
952 SkBitmap incognito_icon = browser_view()->GetOTRAvatarIcon(); 953 SkBitmap incognito_icon = browser_view()->GetOTRAvatarIcon();
953 954
954 int avatar_bottom = GetHorizontalTabStripVerticalOffset(false) + 955 int avatar_bottom = GetHorizontalTabStripVerticalOffset(false) +
955 browser_view()->GetTabStripHeight() - kAvatarBottomSpacing; 956 browser_view()->GetTabStripHeight() - kAvatarBottomSpacing;
956 int avatar_restored_y = avatar_bottom - incognito_icon.height(); 957 int avatar_restored_y = avatar_bottom - incognito_icon.height();
957 int avatar_y = frame()->IsMaximized() ? 958 int avatar_y = frame()->IsMaximized() ?
958 (NonClientTopBorderHeight(false) + kTabstripTopShadowThickness) : 959 (NonClientTopBorderHeight(false) + kTabstripTopShadowThickness) :
959 avatar_restored_y; 960 avatar_restored_y;
960 avatar_bounds_.SetRect(NonClientBorderThickness() + kAvatarSideSpacing, 961 avatar_bounds_.SetRect(NonClientBorderThickness() + kAvatarLeftSpacing,
961 avatar_y, incognito_icon.width(), 962 avatar_y, incognito_icon.width(),
962 browser_view()->ShouldShowAvatar() ? (avatar_bottom - avatar_y) : 0); 963 browser_view()->ShouldShowAvatar() ? (avatar_bottom - avatar_y) : 0);
963 964
964 if (avatar_button()) 965 if (avatar_button())
965 avatar_button()->SetBoundsRect(avatar_bounds_); 966 avatar_button()->SetBoundsRect(avatar_bounds_);
966 } 967 }
967 968
968 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, 969 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width,
969 int height) const { 970 int height) const {
970 int top_height = NonClientTopBorderHeight(false); 971 int top_height = NonClientTopBorderHeight(false);
971 int border_thickness = NonClientBorderThickness(); 972 int border_thickness = NonClientBorderThickness();
972 return gfx::Rect(border_thickness, top_height, 973 return gfx::Rect(border_thickness, top_height,
973 std::max(0, width - (2 * border_thickness)), 974 std::max(0, width - (2 * border_thickness)),
974 std::max(0, height - GetReservedHeight() - 975 std::max(0, height - GetReservedHeight() -
975 top_height - border_thickness)); 976 top_height - border_thickness));
976 } 977 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/glass_browser_frame_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698