| 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/browser_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" |
| 6 | 6 |
| 7 #include "ash/shell_delegate.h" | 7 #include "ash/shell_delegate.h" |
| 8 #include "ash/wm/frame_painter.h" | 8 #include "ash/wm/frame_painter.h" |
| 9 #include "ash/wm/workspace/frame_maximize_button.h" | 9 #include "ash/wm/workspace/frame_maximize_button.h" |
| 10 #include "chrome/browser/themes/theme_properties.h" | 10 #include "chrome/browser/themes/theme_properties.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 if (!tabstrip) | 125 if (!tabstrip) |
| 126 return gfx::Rect(); | 126 return gfx::Rect(); |
| 127 TabStripInsets insets(GetTabStripInsets(false)); | 127 TabStripInsets insets(GetTabStripInsets(false)); |
| 128 return gfx::Rect(insets.left, insets.top, | 128 return gfx::Rect(insets.left, insets.top, |
| 129 std::max(0, width() - insets.left - insets.right), | 129 std::max(0, width() - insets.left - insets.right), |
| 130 tabstrip->GetPreferredSize().height()); | 130 tabstrip->GetPreferredSize().height()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 BrowserNonClientFrameView::TabStripInsets | 133 BrowserNonClientFrameView::TabStripInsets |
| 134 BrowserNonClientFrameViewAsh::GetTabStripInsets(bool force_restored) const { | 134 BrowserNonClientFrameViewAsh::GetTabStripInsets(bool force_restored) const { |
| 135 int left = avatar_button() ? kAvatarSideSpacing + | 135 int left = kTabstripLeftSpacing; |
| 136 browser_view()->GetOTRAvatarIcon().width() + kAvatarSideSpacing : | 136 if (avatar_button()) { |
| 137 kTabstripLeftSpacing; | 137 if (avatar_label()) { |
| 138 if (avatar_label()) { | 138 left = avatar_label()->GetPreferredSize().width() - 6; |
| 139 left += avatar_label()->GetPreferredSize().width() + | 139 } else { |
| 140 views::kRelatedControlHorizontalSpacing; | 140 left = kAvatarSideSpacing + browser_view()->GetOTRAvatarIcon().width() + |
| 141 kAvatarSideSpacing; |
| 142 } |
| 141 } | 143 } |
| 142 int right = frame_painter_->GetRightInset() + kTabstripRightSpacing; | 144 int right = frame_painter_->GetRightInset() + kTabstripRightSpacing; |
| 143 return TabStripInsets(NonClientTopBorderHeight(force_restored), left, right); | 145 return TabStripInsets(NonClientTopBorderHeight(force_restored), left, right); |
| 144 } | 146 } |
| 145 | 147 |
| 146 int BrowserNonClientFrameViewAsh::GetThemeBackgroundXInset() const { | 148 int BrowserNonClientFrameViewAsh::GetThemeBackgroundXInset() const { |
| 147 return frame_painter_->GetThemeBackgroundXInset(); | 149 return frame_painter_->GetThemeBackgroundXInset(); |
| 148 } | 150 } |
| 149 | 151 |
| 150 void BrowserNonClientFrameViewAsh::UpdateThrobber(bool running) { | 152 void BrowserNonClientFrameViewAsh::UpdateThrobber(bool running) { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 avatar_restored_y; | 436 avatar_restored_y; |
| 435 gfx::Rect avatar_bounds(kAvatarSideSpacing, | 437 gfx::Rect avatar_bounds(kAvatarSideSpacing, |
| 436 avatar_y, | 438 avatar_y, |
| 437 incognito_icon.width(), | 439 incognito_icon.width(), |
| 438 avatar_bottom - avatar_y); | 440 avatar_bottom - avatar_y); |
| 439 avatar_button()->SetBoundsRect(avatar_bounds); | 441 avatar_button()->SetBoundsRect(avatar_bounds); |
| 440 if (avatar_label()) { | 442 if (avatar_label()) { |
| 441 gfx::Size size = avatar_label()->GetPreferredSize(); | 443 gfx::Size size = avatar_label()->GetPreferredSize(); |
| 442 int label_height = std::min(avatar_bounds.height(), size.height()); | 444 int label_height = std::min(avatar_bounds.height(), size.height()); |
| 443 gfx::Rect label_bounds( | 445 gfx::Rect label_bounds( |
| 444 avatar_bounds.right() + views::kRelatedControlHorizontalSpacing, | 446 0, |
| 445 avatar_y + (avatar_bounds.height() - label_height) / 2, | 447 avatar_bottom - size.height() - 3, |
| 446 size.width(), | 448 size.width(), |
| 447 size.height()); | 449 size.height()); |
| 448 avatar_label()->SetBoundsRect(label_bounds); | 450 avatar_label()->SetBoundsRect(label_bounds); |
| 449 } | 451 } |
| 450 } | 452 } |
| 451 | 453 |
| 452 bool BrowserNonClientFrameViewAsh::ShouldPaint() const { | 454 bool BrowserNonClientFrameViewAsh::ShouldPaint() const { |
| 453 // Immersive mode windows are fullscreen, but need to paint during a reveal. | 455 // Immersive mode windows are fullscreen, but need to paint during a reveal. |
| 454 return !frame()->IsFullscreen() || | 456 return !frame()->IsFullscreen() || |
| 455 browser_view()->immersive_mode_controller()->IsRevealed(); | 457 browser_view()->immersive_mode_controller()->IsRevealed(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const { | 562 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const { |
| 561 ui::ThemeProvider* tp = GetThemeProvider(); | 563 ui::ThemeProvider* tp = GetThemeProvider(); |
| 562 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && | 564 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && |
| 563 browser_view()->IsBrowserTypeNormal() && | 565 browser_view()->IsBrowserTypeNormal() && |
| 564 !browser_view()->IsOffTheRecord()) { | 566 !browser_view()->IsOffTheRecord()) { |
| 565 return ShouldPaintAsActive() ? | 567 return ShouldPaintAsActive() ? |
| 566 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE; | 568 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE; |
| 567 } | 569 } |
| 568 return 0; | 570 return 0; |
| 569 } | 571 } |
| OLD | NEW |