| 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 "ash/common/system/tray/tray_background_view.h" | 5 #include "ash/common/system/tray/tray_background_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 SchedulePaint(); | 526 SchedulePaint(); |
| 527 } | 527 } |
| 528 | 528 |
| 529 views::View* TrayBackgroundView::GetBubbleAnchor() const { | 529 views::View* TrayBackgroundView::GetBubbleAnchor() const { |
| 530 return tray_container_; | 530 return tray_container_; |
| 531 } | 531 } |
| 532 | 532 |
| 533 gfx::Insets TrayBackgroundView::GetBubbleAnchorInsets() const { | 533 gfx::Insets TrayBackgroundView::GetBubbleAnchorInsets() const { |
| 534 gfx::Insets anchor_insets = GetBubbleAnchor()->GetInsets(); | 534 gfx::Insets anchor_insets = GetBubbleAnchor()->GetInsets(); |
| 535 gfx::Insets tray_bg_insets = GetInsets(); | 535 gfx::Insets tray_bg_insets = GetInsets(); |
| 536 // TODO(estade): for reasons I don't understand, BubbleBorder distances the | |
| 537 // bubble by the arrow's "interior" thickness even when the paint type is | |
| 538 // PAINT_NONE. | |
| 539 const int kBigShadowArrowInteriorThickness = 9; | |
| 540 if (GetAnchorAlignment() == TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { | 536 if (GetAnchorAlignment() == TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { |
| 541 return gfx::Insets(kBigShadowArrowInteriorThickness - tray_bg_insets.top(), | 537 return gfx::Insets(-tray_bg_insets.top(), anchor_insets.left(), |
| 542 anchor_insets.left(), -tray_bg_insets.bottom(), | 538 -tray_bg_insets.bottom(), anchor_insets.right()); |
| 543 anchor_insets.right()); | |
| 544 } else { | 539 } else { |
| 545 return gfx::Insets( | 540 return gfx::Insets(anchor_insets.top(), -tray_bg_insets.left(), |
| 546 anchor_insets.top(), | 541 anchor_insets.bottom(), -tray_bg_insets.right()); |
| 547 kBigShadowArrowInteriorThickness - tray_bg_insets.left(), | |
| 548 anchor_insets.bottom(), | |
| 549 kBigShadowArrowInteriorThickness - tray_bg_insets.right()); | |
| 550 } | 542 } |
| 551 } | 543 } |
| 552 | 544 |
| 553 std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask() | 545 std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask() |
| 554 const { | 546 const { |
| 555 return base::MakeUnique<views::RoundRectInkDropMask>( | 547 return base::MakeUnique<views::RoundRectInkDropMask>( |
| 556 size(), GetBackgroundInsets(), kTrayRoundedBorderRadius); | 548 size(), GetBackgroundInsets(), kTrayRoundedBorderRadius); |
| 557 } | 549 } |
| 558 | 550 |
| 559 bool TrayBackgroundView::ShouldEnterPushedState(const ui::Event& event) { | 551 bool TrayBackgroundView::ShouldEnterPushedState(const ui::Event& event) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 } | 636 } |
| 645 | 637 |
| 646 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { | 638 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { |
| 647 gfx::Insets insets = GetBackgroundInsets(); | 639 gfx::Insets insets = GetBackgroundInsets(); |
| 648 gfx::Rect bounds = GetLocalBounds(); | 640 gfx::Rect bounds = GetLocalBounds(); |
| 649 bounds.Inset(insets); | 641 bounds.Inset(insets); |
| 650 return bounds; | 642 return bounds; |
| 651 } | 643 } |
| 652 | 644 |
| 653 } // namespace ash | 645 } // namespace ash |
| OLD | NEW |