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/common/ash_layout_constants.h" | 9 #include "ash/common/ash_layout_constants.h" |
10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 const gfx::Rect rect_in_tabstrip_coords( | 433 const gfx::Rect rect_in_tabstrip_coords( |
434 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f)); | 434 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f)); |
435 return (rect_in_tabstrip_coords.y() <= tabstrip->height()) && | 435 return (rect_in_tabstrip_coords.y() <= tabstrip->height()) && |
436 (!tabstrip->HitTestRect(rect_in_tabstrip_coords) || | 436 (!tabstrip->HitTestRect(rect_in_tabstrip_coords) || |
437 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords)); | 437 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords)); |
438 } | 438 } |
439 | 439 |
440 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { | 440 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { |
441 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); | 441 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); |
442 const int avatar_right = profile_indicator_icon() | 442 const int avatar_right = profile_indicator_icon() |
443 ? (insets.left() + GetOTRAvatarIcon().width()) | 443 ? (insets.left() + GetIncognitoAvatarIcon().width()) |
444 : 0; | 444 : 0; |
445 return avatar_right + insets.right(); | 445 return avatar_right + insets.right(); |
446 } | 446 } |
447 | 447 |
448 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { | 448 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { |
449 return kTabstripRightSpacing + | 449 return kTabstripRightSpacing + |
450 caption_button_container_->GetPreferredSize().width(); | 450 caption_button_container_->GetPreferredSize().width(); |
451 } | 451 } |
452 | 452 |
453 bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const { | 453 bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const { |
454 const ImmersiveModeController* const immersive_controller = | 454 const ImmersiveModeController* const immersive_controller = |
(...skipping 16 matching lines...) Expand all Loading... |
471 Browser::FEATURE_WEBAPPFRAME); | 471 Browser::FEATURE_WEBAPPFRAME); |
472 } | 472 } |
473 | 473 |
474 void BrowserNonClientFrameViewAsh::LayoutProfileIndicatorIcon() { | 474 void BrowserNonClientFrameViewAsh::LayoutProfileIndicatorIcon() { |
475 DCHECK(profile_indicator_icon()); | 475 DCHECK(profile_indicator_icon()); |
476 #if !defined(OS_CHROMEOS) | 476 #if !defined(OS_CHROMEOS) |
477 // ChromeOS shows avatar on V1 app. | 477 // ChromeOS shows avatar on V1 app. |
478 DCHECK(browser_view()->IsTabStripVisible()); | 478 DCHECK(browser_view()->IsTabStripVisible()); |
479 #endif | 479 #endif |
480 | 480 |
481 const gfx::ImageSkia incognito_icon = GetOTRAvatarIcon(); | 481 const gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon(); |
482 const gfx::Insets avatar_insets = GetLayoutInsets(AVATAR_ICON); | 482 const gfx::Insets avatar_insets = GetLayoutInsets(AVATAR_ICON); |
483 const int avatar_bottom = GetTopInset(false) + | 483 const int avatar_bottom = GetTopInset(false) + |
484 browser_view()->GetTabStripHeight() - avatar_insets.bottom(); | 484 browser_view()->GetTabStripHeight() - avatar_insets.bottom(); |
485 int avatar_y = avatar_bottom - incognito_icon.height(); | 485 int avatar_y = avatar_bottom - incognito_icon.height(); |
486 if (!ui::MaterialDesignController::IsModeMaterial() && | 486 if (!ui::MaterialDesignController::IsModeMaterial() && |
487 browser_view()->IsTabStripVisible() && | 487 browser_view()->IsTabStripVisible() && |
488 (frame()->IsMaximized() || frame()->IsFullscreen())) { | 488 (frame()->IsMaximized() || frame()->IsFullscreen())) { |
489 avatar_y = GetTopInset(false) + kContentShadowHeight; | 489 avatar_y = GetTopInset(false) + kContentShadowHeight; |
490 } | 490 } |
491 | 491 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 // TODO(pkasting): The "2 *" part of this makes no sense to me. | 585 // TODO(pkasting): The "2 *" part of this makes no sense to me. |
586 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w, | 586 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w, |
587 img_y, img_w, img_h); | 587 img_y, img_w, img_h); |
588 | 588 |
589 // Toolbar/content separator. | 589 // Toolbar/content separator. |
590 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, | 590 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, |
591 kClientEdgeThickness, 0); | 591 kClientEdgeThickness, 0); |
592 canvas->FillRect(toolbar_bounds, separator_color); | 592 canvas->FillRect(toolbar_bounds, separator_color); |
593 } | 593 } |
594 } | 594 } |
OLD | NEW |