| OLD | NEW |
| 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 Loading... |
| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 // their contents are aligned as if they were 20 pixels high and extended | 732 // 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 | 733 // 1 pixel off the top of the screen. We position the profile switcher |
| 734 // button the same way to match. | 734 // button the same way to match. |
| 735 button_y -= 1; | 735 button_y -= 1; |
| 736 } | 736 } |
| 737 profile_switcher_.view()->SetBounds(button_x, button_y, label_size.width(), | 737 profile_switcher_.view()->SetBounds(button_x, button_y, label_size.width(), |
| 738 kProfileSwitcherButtonHeight); | 738 kProfileSwitcherButtonHeight); |
| 739 } | 739 } |
| 740 | 740 |
| 741 void GlassBrowserFrameView::LayoutIncognitoIcon() { | 741 void GlassBrowserFrameView::LayoutIncognitoIcon() { |
| 742 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); | 742 const int pad = GetLayoutConstant(AVATAR_ICON_PADDING); |
| 743 const gfx::Size size(GetIncognitoAvatarIcon().size()); | 743 const gfx::Size size(GetIncognitoAvatarIcon().size()); |
| 744 int x = ClientBorderThickness(false); | 744 int x = ClientBorderThickness(false); |
| 745 // In RTL, the icon needs to start after the caption buttons. | 745 // In RTL, the icon needs to start after the caption buttons. |
| 746 if (CaptionButtonsOnLeadingEdge()) { | 746 if (CaptionButtonsOnLeadingEdge()) { |
| 747 x = width() - frame()->GetMinimizeButtonOffset() + | 747 x = width() - frame()->GetMinimizeButtonOffset() + |
| 748 (profile_switcher_.view() ? (profile_switcher_.view()->width() + | 748 (profile_switcher_.view() ? (profile_switcher_.view()->width() + |
| 749 kProfileSwitcherButtonOffset) | 749 kProfileSwitcherButtonOffset) |
| 750 : 0); | 750 : 0); |
| 751 } | 751 } |
| 752 const int bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - | 752 const int bottom = |
| 753 insets.bottom(); | 753 GetTopInset(false) + browser_view()->GetTabStripHeight() - pad; |
| 754 incognito_bounds_.SetRect(x + (profile_indicator_icon() ? insets.left() : 0), | 754 incognito_bounds_.SetRect( |
| 755 bottom - size.height(), | 755 x + (profile_indicator_icon() ? pad : 0), bottom - size.height(), |
| 756 profile_indicator_icon() ? size.width() : 0, | 756 profile_indicator_icon() ? size.width() : 0, size.height()); |
| 757 size.height()); | |
| 758 if (profile_indicator_icon()) | 757 if (profile_indicator_icon()) |
| 759 profile_indicator_icon()->SetBoundsRect(incognito_bounds_); | 758 profile_indicator_icon()->SetBoundsRect(incognito_bounds_); |
| 760 } | 759 } |
| 761 | 760 |
| 762 void GlassBrowserFrameView::LayoutTitleBar() { | 761 void GlassBrowserFrameView::LayoutTitleBar() { |
| 763 if (!ShowCustomIcon() && !ShowCustomTitle()) | 762 if (!ShowCustomIcon() && !ShowCustomTitle()) |
| 764 return; | 763 return; |
| 765 | 764 |
| 766 gfx::Rect window_icon_bounds; | 765 gfx::Rect window_icon_bounds; |
| 767 const int icon_size = | 766 const int icon_size = |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 static bool initialized = false; | 910 static bool initialized = false; |
| 912 if (!initialized) { | 911 if (!initialized) { |
| 913 for (int i = 0; i < kThrobberIconCount; ++i) { | 912 for (int i = 0; i < kThrobberIconCount; ++i) { |
| 914 throbber_icons_[i] = | 913 throbber_icons_[i] = |
| 915 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 914 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
| 916 DCHECK(throbber_icons_[i]); | 915 DCHECK(throbber_icons_[i]); |
| 917 } | 916 } |
| 918 initialized = true; | 917 initialized = true; |
| 919 } | 918 } |
| 920 } | 919 } |
| OLD | NEW |