| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 10 #include "ash/frame/default_header_painter.h" | 10 #include "ash/frame/default_header_painter.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #if defined(ENABLE_SUPERVISED_USERS) | 52 #if defined(ENABLE_SUPERVISED_USERS) |
| 53 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" | 53 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" |
| 54 #endif | 54 #endif |
| 55 | 55 |
| 56 namespace { | 56 namespace { |
| 57 | 57 |
| 58 #if defined(FRAME_AVATAR_BUTTON) | 58 #if defined(FRAME_AVATAR_BUTTON) |
| 59 // Space between the new avatar button and the minimize button. | 59 // Space between the new avatar button and the minimize button. |
| 60 const int kNewAvatarButtonOffset = 5; | 60 const int kNewAvatarButtonOffset = 5; |
| 61 #endif | 61 #endif |
| 62 // Space between left edge of window and tabstrip. | |
| 63 const int kTabstripLeftSpacing = 0; | |
| 64 // Space between right edge of tabstrip and maximize button. | 62 // Space between right edge of tabstrip and maximize button. |
| 65 const int kTabstripRightSpacing = 10; | 63 const int kTabstripRightSpacing = 10; |
| 66 // Height of the shadow of the content area, at the top of the toolbar. | 64 // Height of the shadow of the content area, at the top of the toolbar. |
| 67 const int kContentShadowHeight = 1; | 65 const int kContentShadowHeight = 1; |
| 68 // Space between top of window and top of tabstrip for tall headers, such as | 66 // Space between top of window and top of tabstrip for tall headers, such as |
| 69 // for restored windows, apps, etc. | 67 // for restored windows, apps, etc. |
| 70 const int kTabstripTopSpacingTall = 7; | 68 const int kTabstripTopSpacingTall = 7; |
| 71 // Space between top of window and top of tabstrip for short headers, such as | 69 // Space between top of window and top of tabstrip for short headers, such as |
| 72 // for maximized windows, pop-ups, etc. | 70 // for maximized windows, pop-ups, etc. |
| 73 const int kTabstripTopSpacingShort = 0; | 71 const int kTabstripTopSpacingShort = 0; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 490 |
| 493 return !tabstrip->HitTestRect(rect_in_tabstrip_coords) || | 491 return !tabstrip->HitTestRect(rect_in_tabstrip_coords) || |
| 494 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords); | 492 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords); |
| 495 } | 493 } |
| 496 | 494 |
| 497 // Claim |rect| if it is above the top of the topmost view in the client area. | 495 // Claim |rect| if it is above the top of the topmost view in the client area. |
| 498 return rect.y() < GetTopInset(); | 496 return rect.y() < GetTopInset(); |
| 499 } | 497 } |
| 500 | 498 |
| 501 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { | 499 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { |
| 502 const int icon_width = browser_view()->GetOTRAvatarIcon().width(); | 500 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); |
| 503 const int insets_width = GetLayoutInsets(AVATAR_ICON).width(); | 501 const int avatar_right = avatar_button() ? |
| 504 return avatar_button() ? (icon_width + insets_width) : kTabstripLeftSpacing; | 502 (insets.left() + browser_view()->GetOTRAvatarIcon().width()) : 0; |
| 503 return avatar_right + insets.right(); |
| 505 } | 504 } |
| 506 | 505 |
| 507 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { | 506 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { |
| 508 int tabstrip_width = kTabstripRightSpacing + | 507 int tabstrip_width = kTabstripRightSpacing + |
| 509 caption_button_container_->GetPreferredSize().width(); | 508 caption_button_container_->GetPreferredSize().width(); |
| 510 | 509 |
| 511 #if defined(FRAME_AVATAR_BUTTON) | 510 #if defined(FRAME_AVATAR_BUTTON) |
| 512 if (new_avatar_button()) { | 511 if (new_avatar_button()) { |
| 513 tabstrip_width += kNewAvatarButtonOffset + | 512 tabstrip_width += kNewAvatarButtonOffset + |
| 514 new_avatar_button()->GetPreferredSize().width(); | 513 new_avatar_button()->GetPreferredSize().width(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 } | 702 } |
| 704 } | 703 } |
| 705 | 704 |
| 706 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { | 705 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { |
| 707 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 706 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); |
| 708 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), | 707 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), |
| 709 width(), kClientEdgeThickness), | 708 width(), kClientEdgeThickness), |
| 710 ThemeProperties::GetDefaultColor( | 709 ThemeProperties::GetDefaultColor( |
| 711 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 710 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 712 } | 711 } |
| OLD | NEW |