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

Unified Diff: chrome/browser/ui/views/frame/glass_browser_frame_view.cc

Issue 2616523004: Layout avatar button
Patch Set: More stuff Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/glass_browser_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
index 0fbe791f84e2f2bc5dc0cc7c53a08945c3c08bda..fe9b5b73b207aced34031ca192194c92ce827047 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -49,7 +49,7 @@ const int kNonClientRestoredExtraThickness = 11;
// pixels at the end of the top and bottom edges trigger diagonal resizing.
const int kResizeCornerWidth = 16;
// How far the profile switcher button is from the left of the minimize button.
-const int kProfileSwitcherButtonOffset = 5;
+const int kProfileSwitcherButtonOffset = 1;
// The content edge images have a shadow built into them.
const int kContentEdgeShadowThickness = 2;
// In restored mode, the New Tab button isn't at the same height as the caption
@@ -60,11 +60,9 @@ const int kNewTabCaptionRestoredSpacing = 5;
// similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid
// looking too cluttered.
const int kNewTabCaptionMaximizedSpacing = 16;
-// Height of the profile switcher button. Same as the height of the Windows 7/8
-// caption buttons.
-// TODO(bsep): Windows 10 caption buttons look very different and we would like
-// the profile switcher button to match on that platform.
-const int kProfileSwitcherButtonHeight = 20;
+// Minimum and maximux width of the profile switcher button.
+const int kProfileSwitcherButtonMinWidth = 48;
+const int kProfileSwictherButtonMaxWidth = 96;
// There is a small one-pixel strip right above the caption buttons in which the
// resize border "peeks" through.
const int kCaptionButtonTopInset = 1;
@@ -154,11 +152,11 @@ gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip(
// In non-maximized mode, allow the new tab button to slide completely
// under the profile switcher button.
- if (!IsMaximized()) {
- end_x = std::min(end_x + GetLayoutSize(NEW_TAB_BUTTON).width() +
- kNewTabCaptionRestoredSpacing,
- old_end_x);
- }
+ //if (!IsMaximized()) {
+ // end_x = std::min(end_x + GetLayoutSize(NEW_TAB_BUTTON).width() +
+ // kNewTabCaptionRestoredSpacing,
+ // old_end_x);
+ //}
}
}
return gfx::Rect(x, TopAreaHeight(false), std::max(0, end_x - x),
@@ -717,27 +715,40 @@ void GlassBrowserFrameView::LayoutProfileSwitcher() {
if (!profile_switcher_.view())
return;
- gfx::Size label_size = profile_switcher_.view()->GetPreferredSize();
+ gfx::Size button_size = profile_switcher_.view()->GetPreferredSize();
+ int button_width = std::min(std::max(button_size.width(), kProfileSwitcherButtonMinWidth), kProfileSwictherButtonMaxWidth);
int button_x;
if (CaptionButtonsOnLeadingEdge()) {
button_x = width() - frame()->GetMinimizeButtonOffset() +
kProfileSwitcherButtonOffset;
} else {
- button_x =
- MinimizeButtonX() - kProfileSwitcherButtonOffset - label_size.width();
+ button_x = MinimizeButtonX() - kProfileSwitcherButtonOffset - button_width;
}
int button_y = WindowTopY();
+ int button_height = frame()->GetMinimizeButtonHeight();
if (IsMaximized()) {
// In maximized mode the caption buttons appear only 19 pixels high, but
// their contents are aligned as if they were 20 pixels high and extended
// 1 pixel off the top of the screen. We position the profile switcher
// button the same way to match.
- button_y -= 1;
+ button_height -= 3;
}
- profile_switcher_.view()->SetBounds(button_x, button_y, label_size.width(),
- kProfileSwitcherButtonHeight);
+
+ profile_switcher_.view()->SetBounds(button_x, button_y, button_width, button_height);
+ //if (browser_view()->tabstrip()) {
+ // LOG(ERROR) << "tabstrip->GetPreferredSize(): " << browser_view()->tabstrip()->GetPreferredSize().ToString();
+ // gfx::Rect tabstrip_bounds = GetBoundsForTabStrip(browser_view()->tabstrip());
+ // LOG(ERROR) << "tabstrip_bounds: " << tabstrip_bounds.ToString() << " - max_x" << browser_view()->tabstrip()->max_x();
+ // LOG(ERROR) << "Profile Swicther Bounds: " << profile_switcher_.view()->GetMirroredBounds().ToString();
+ // LOG(ERROR) << "--------";
+ // if (browser_view()->tabstrip()->max_x() >= button_x) {
+ // profile_switcher_.view()->SetBounds(button_x, button_y, button_width, 19);
+ // }
+ // }
+ LOG(ERROR) << "Minimize Button Bounds: " << minimize_button_->GetMirroredBounds().ToString();
+ LOG(ERROR) << "Profile Swicther Bounds: " << profile_switcher_.view()->GetMirroredBounds().ToString();
}
void GlassBrowserFrameView::LayoutIncognitoIcon() {

Powered by Google App Engine
This is Rietveld 408576698