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

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

Issue 2523783002: Top Chrome MD cleanup - get rid of most of GetLayoutInsets. (Closed)
Patch Set: Created 4 years, 1 month 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 =
143 incognito_bounds_.right() + GetLayoutInsets(AVATAR_ICON).right(); 143 incognito_bounds_.right() + GetLayoutConstant(AVATAR_ICON_PADDING);
144 int end_x = width() - ClientBorderThickness(false); 144 int end_x = width() - ClientBorderThickness(false);
145 if (!CaptionButtonsOnLeadingEdge()) { 145 if (!CaptionButtonsOnLeadingEdge()) {
146 end_x = std::min(MinimizeButtonX(), end_x) - 146 end_x = std::min(MinimizeButtonX(), end_x) -
147 (IsMaximized() ? kNewTabCaptionMaximizedSpacing 147 (IsMaximized() ? kNewTabCaptionMaximizedSpacing
148 : kNewTabCaptionRestoredSpacing); 148 : kNewTabCaptionRestoredSpacing);
149 149
150 // The profile switcher button is optionally displayed to the left of the 150 // The profile switcher button is optionally displayed to the left of the
151 // minimize button. 151 // minimize button.
152 if (profile_switcher_.view()) { 152 if (profile_switcher_.view()) {
153 const int old_end_x = end_x; 153 const int old_end_x = end_x;
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 // their contents are aligned as if they were 20 pixels high and extended 725 // their contents are aligned as if they were 20 pixels high and extended
726 // 1 pixel off the top of the screen. We position the profile switcher 726 // 1 pixel off the top of the screen. We position the profile switcher
727 // button the same way to match. 727 // button the same way to match.
728 button_y -= 1; 728 button_y -= 1;
729 } 729 }
730 profile_switcher_.view()->SetBounds(button_x, button_y, label_size.width(), 730 profile_switcher_.view()->SetBounds(button_x, button_y, label_size.width(),
731 kProfileSwitcherButtonHeight); 731 kProfileSwitcherButtonHeight);
732 } 732 }
733 733
734 void GlassBrowserFrameView::LayoutIncognitoIcon() { 734 void GlassBrowserFrameView::LayoutIncognitoIcon() {
735 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); 735 const int pad = GetLayoutConstant(AVATAR_ICON_PADDING);
736 const gfx::Size size(GetIncognitoAvatarIcon().size()); 736 const gfx::Size size(GetIncognitoAvatarIcon().size());
737 int x = ClientBorderThickness(false); 737 int x = ClientBorderThickness(false);
738 // In RTL, the icon needs to start after the caption buttons. 738 // In RTL, the icon needs to start after the caption buttons.
739 if (CaptionButtonsOnLeadingEdge()) { 739 if (CaptionButtonsOnLeadingEdge()) {
740 x = width() - frame()->GetMinimizeButtonOffset() + 740 x = width() - frame()->GetMinimizeButtonOffset() +
741 (profile_switcher_.view() ? (profile_switcher_.view()->width() + 741 (profile_switcher_.view() ? (profile_switcher_.view()->width() +
742 kProfileSwitcherButtonOffset) 742 kProfileSwitcherButtonOffset)
743 : 0); 743 : 0);
744 } 744 }
745 const int bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - 745 const int bottom =
746 insets.bottom(); 746 GetTopInset(false) + browser_view()->GetTabStripHeight() - pad;
747 incognito_bounds_.SetRect(x + (profile_indicator_icon() ? insets.left() : 0), 747 incognito_bounds_.SetRect(
748 bottom - size.height(), 748 x + (profile_indicator_icon() ? pad : 0), bottom - size.height(),
749 profile_indicator_icon() ? size.width() : 0, 749 profile_indicator_icon() ? size.width() : 0, size.height());
750 size.height());
751 if (profile_indicator_icon()) 750 if (profile_indicator_icon())
752 profile_indicator_icon()->SetBoundsRect(incognito_bounds_); 751 profile_indicator_icon()->SetBoundsRect(incognito_bounds_);
753 } 752 }
754 753
755 void GlassBrowserFrameView::LayoutTitleBar() { 754 void GlassBrowserFrameView::LayoutTitleBar() {
756 if (!ShowCustomIcon() && !ShowCustomTitle()) 755 if (!ShowCustomIcon() && !ShowCustomTitle())
757 return; 756 return;
758 757
759 gfx::Rect window_icon_bounds; 758 gfx::Rect window_icon_bounds;
760 const int icon_size = 759 const int icon_size =
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 static bool initialized = false; 903 static bool initialized = false;
905 if (!initialized) { 904 if (!initialized) {
906 for (int i = 0; i < kThrobberIconCount; ++i) { 905 for (int i = 0; i < kThrobberIconCount; ++i) {
907 throbber_icons_[i] = 906 throbber_icons_[i] =
908 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 907 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
909 DCHECK(throbber_icons_[i]); 908 DCHECK(throbber_icons_[i]);
910 } 909 }
911 initialized = true; 910 initialized = true;
912 } 911 }
913 } 912 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698