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

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

Issue 2555623002: Last round of cleaning up MD layout constants. (Closed)
Patch Set: pkasting review, remove debug code, rebase Created 4 years 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 (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/glass_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 GlassBrowserFrameView::~GlassBrowserFrameView() { 134 GlassBrowserFrameView::~GlassBrowserFrameView() {
135 } 135 }
136 136
137 /////////////////////////////////////////////////////////////////////////////// 137 ///////////////////////////////////////////////////////////////////////////////
138 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: 138 // GlassBrowserFrameView, BrowserNonClientFrameView implementation:
139 139
140 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( 140 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip(
141 views::View* tabstrip) const { 141 views::View* tabstrip) const {
142 const int x = 142 const int x = incognito_bounds_.right() + kAvatarIconPadding;
143 incognito_bounds_.right() + GetLayoutConstant(AVATAR_ICON_PADDING);
144 int end_x = width() - ClientBorderThickness(false); 143 int end_x = width() - ClientBorderThickness(false);
145 if (!CaptionButtonsOnLeadingEdge()) { 144 if (!CaptionButtonsOnLeadingEdge()) {
146 end_x = std::min(MinimizeButtonX(), end_x) - 145 end_x = std::min(MinimizeButtonX(), end_x) -
147 (IsMaximized() ? kNewTabCaptionMaximizedSpacing 146 (IsMaximized() ? kNewTabCaptionMaximizedSpacing
148 : kNewTabCaptionRestoredSpacing); 147 : kNewTabCaptionRestoredSpacing);
149 148
150 // The profile switcher button is optionally displayed to the left of the 149 // The profile switcher button is optionally displayed to the left of the
151 // minimize button. 150 // minimize button.
152 if (profile_switcher_.view()) { 151 if (profile_switcher_.view()) {
153 const int old_end_x = end_x; 152 const int old_end_x = end_x;
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 // their contents are aligned as if they were 20 pixels high and extended 731 // their contents are aligned as if they were 20 pixels high and extended
733 // 1 pixel off the top of the screen. We position the profile switcher 732 // 1 pixel off the top of the screen. We position the profile switcher
734 // button the same way to match. 733 // button the same way to match.
735 button_y -= 1; 734 button_y -= 1;
736 } 735 }
737 profile_switcher_.view()->SetBounds(button_x, button_y, label_size.width(), 736 profile_switcher_.view()->SetBounds(button_x, button_y, label_size.width(),
738 kProfileSwitcherButtonHeight); 737 kProfileSwitcherButtonHeight);
739 } 738 }
740 739
741 void GlassBrowserFrameView::LayoutIncognitoIcon() { 740 void GlassBrowserFrameView::LayoutIncognitoIcon() {
742 const int pad = GetLayoutConstant(AVATAR_ICON_PADDING);
743 const gfx::Size size(GetIncognitoAvatarIcon().size()); 741 const gfx::Size size(GetIncognitoAvatarIcon().size());
744 int x = ClientBorderThickness(false); 742 int x = ClientBorderThickness(false);
745 // In RTL, the icon needs to start after the caption buttons. 743 // In RTL, the icon needs to start after the caption buttons.
746 if (CaptionButtonsOnLeadingEdge()) { 744 if (CaptionButtonsOnLeadingEdge()) {
747 x = width() - frame()->GetMinimizeButtonOffset() + 745 x = width() - frame()->GetMinimizeButtonOffset() +
748 (profile_switcher_.view() ? (profile_switcher_.view()->width() + 746 (profile_switcher_.view() ? (profile_switcher_.view()->width() +
749 kProfileSwitcherButtonOffset) 747 kProfileSwitcherButtonOffset)
750 : 0); 748 : 0);
751 } 749 }
752 const int bottom = 750 const int bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() -
753 GetTopInset(false) + browser_view()->GetTabStripHeight() - pad; 751 kAvatarIconPadding;
754 incognito_bounds_.SetRect( 752 incognito_bounds_.SetRect(
755 x + (profile_indicator_icon() ? pad : 0), bottom - size.height(), 753 x + (profile_indicator_icon() ? kAvatarIconPadding : 0),
756 profile_indicator_icon() ? size.width() : 0, size.height()); 754 bottom - size.height(), profile_indicator_icon() ? size.width() : 0,
755 size.height());
757 if (profile_indicator_icon()) 756 if (profile_indicator_icon())
758 profile_indicator_icon()->SetBoundsRect(incognito_bounds_); 757 profile_indicator_icon()->SetBoundsRect(incognito_bounds_);
759 } 758 }
760 759
761 void GlassBrowserFrameView::LayoutTitleBar() { 760 void GlassBrowserFrameView::LayoutTitleBar() {
762 if (!ShowCustomIcon() && !ShowCustomTitle()) 761 if (!ShowCustomIcon() && !ShowCustomTitle())
763 return; 762 return;
764 763
765 gfx::Rect window_icon_bounds; 764 gfx::Rect window_icon_bounds;
766 const int icon_size = 765 const int icon_size =
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 static bool initialized = false; 909 static bool initialized = false;
911 if (!initialized) { 910 if (!initialized) {
912 for (int i = 0; i < kThrobberIconCount; ++i) { 911 for (int i = 0; i < kThrobberIconCount; ++i) {
913 throbber_icons_[i] = 912 throbber_icons_[i] =
914 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 913 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
915 DCHECK(throbber_icons_[i]); 914 DCHECK(throbber_icons_[i]);
916 } 915 }
917 initialized = true; 916 initialized = true;
918 } 917 }
919 } 918 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698