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

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

Issue 7066024: Adjusted the spacing of the profile tag in maximized opaque frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | « no previous file | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // looking too cluttered. 93 // looking too cluttered.
94 const int kNewTabCaptionMaximizedSpacing = 16; 94 const int kNewTabCaptionMaximizedSpacing = 16;
95 // How far to indent the tabstrip from the left side of the screen when there 95 // How far to indent the tabstrip from the left side of the screen when there
96 // is no OTR icon. 96 // is no OTR icon.
97 const int kTabStripIndent = 1; 97 const int kTabStripIndent = 1;
98 // Inset from the top of the toolbar/tabstrip to the shadow. Used only for 98 // Inset from the top of the toolbar/tabstrip to the shadow. Used only for
99 // vertical tabs. 99 // vertical tabs.
100 const int kVerticalTabBorderInset = 3; 100 const int kVerticalTabBorderInset = 3;
101 // Y position for profile tag inside the frame. 101 // Y position for profile tag inside the frame.
102 const int kProfileTagYPosition = 1; 102 const int kProfileTagYPosition = 1;
103 // Offset y position of profile button and tag by this amount when maximized.
104 const int kProfileElementMaximizedYOffset = 6;
105 103
106 // Converts |bounds| from |src|'s coordinate system to |dst|, and checks if 104 // Converts |bounds| from |src|'s coordinate system to |dst|, and checks if
107 // |pt| is contained within. 105 // |pt| is contained within.
108 bool ConvertedContainsCheck(gfx::Rect bounds, const views::View* src, 106 bool ConvertedContainsCheck(gfx::Rect bounds, const views::View* src,
109 const views::View* dst, const gfx::Point& pt) { 107 const views::View* dst, const gfx::Point& pt) {
110 DCHECK(src); 108 DCHECK(src);
111 DCHECK(dst); 109 DCHECK(dst);
112 gfx::Point origin(bounds.origin()); 110 gfx::Point origin(bounds.origin());
113 views::View::ConvertPointToView(src, dst, &origin); 111 views::View::ConvertPointToView(src, dst, &origin);
114 bounds.set_origin(origin); 112 bounds.set_origin(origin);
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 profile_button_->SetVisible(true); 1175 profile_button_->SetVisible(true);
1178 int x_tag = 1176 int x_tag =
1179 // The x position of minimize button in the frame 1177 // The x position of minimize button in the frame
1180 minimize_button_->x() - 1178 minimize_button_->x() -
1181 // - the space between the minimize button and the profile button 1179 // - the space between the minimize button and the profile button
1182 ProfileMenuButton::kProfileTagHorizontalSpacing - 1180 ProfileMenuButton::kProfileTagHorizontalSpacing -
1183 // - the width of the profile button 1181 // - the width of the profile button
1184 profile_button_->GetPreferredSize().width(); 1182 profile_button_->GetPreferredSize().width();
1185 // Adjust for different default font sizes on different Windows platforms. 1183 // Adjust for different default font sizes on different Windows platforms.
1186 int y_tag = profile_button_->font().GetHeight() < 14 ? 2 : 0; 1184 int y_tag = profile_button_->font().GetHeight() < 14 ? 2 : 0;
1187 int y_maximized_offset = frame_->IsMaximized() ? 1185 int maximized = frame_->IsMaximized();
1188 kProfileElementMaximizedYOffset : 0;
1189 profile_button_->SetBounds( 1186 profile_button_->SetBounds(
1190 x_tag, 1187 x_tag,
1191 y_tag + y_maximized_offset, 1188 maximized ? 0 : y_tag,
1192 profile_button_->GetPreferredSize().width(), 1189 profile_button_->GetPreferredSize().width(),
1193 profile_button_->GetPreferredSize().height()); 1190 profile_button_->GetPreferredSize().height());
1194 1191
1195 if (!profile_name.empty()) { 1192 if (!profile_name.empty()) {
1196 profile_tag_->SetVisible(true); 1193 profile_tag_->SetVisible(true);
1197 profile_tag_->SetBounds( 1194 profile_tag_->SetBounds(
1198 x_tag, 1195 x_tag,
1199 kProfileTagYPosition + y_maximized_offset, 1196 maximized ? 0 : kProfileTagYPosition,
1200 profile_button_->GetPreferredSize().width(), 1197 profile_button_->GetPreferredSize().width(),
1201 ProfileTagView::kProfileTagHeight); 1198 ProfileTagView::kProfileTagHeight);
1202 profile_tag_->SetVisible(true);
1203 } else { 1199 } else {
1204 profile_tag_->SetVisible(false); 1200 profile_tag_->SetVisible(false);
1205 } 1201 }
1206 } 1202 }
1207 1203
1208 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, 1204 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width,
1209 int height) const { 1205 int height) const {
1210 int top_height = NonClientTopBorderHeight(false, false); 1206 int top_height = NonClientTopBorderHeight(false, false);
1211 int border_thickness = NonClientBorderThickness(); 1207 int border_thickness = NonClientBorderThickness();
1212 return gfx::Rect(border_thickness, top_height, 1208 return gfx::Rect(border_thickness, top_height,
1213 std::max(0, width - (2 * border_thickness)), 1209 std::max(0, width - (2 * border_thickness)),
1214 std::max(0, height - GetReservedHeight() - 1210 std::max(0, height - GetReservedHeight() -
1215 top_height - border_thickness)); 1211 top_height - border_thickness));
1216 } 1212 }
1217 1213
1218 void OpaqueBrowserFrameView::RegisterLoginNotifications() { 1214 void OpaqueBrowserFrameView::RegisterLoginNotifications() {
1219 PrefService* pref_service = browser_view_->browser()->profile()->GetPrefs(); 1215 PrefService* pref_service = browser_view_->browser()->profile()->GetPrefs();
1220 DCHECK(pref_service); 1216 DCHECK(pref_service);
1221 username_pref_.Init(prefs::kGoogleServicesUsername, pref_service, this); 1217 username_pref_.Init(prefs::kGoogleServicesUsername, pref_service, this);
1222 } 1218 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698