Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: ash/common/system/tray/tray_background_view.cc

Issue 2555373004: Apply new MD shadows to CrOS tray bubbles. (Closed)
Patch Set: fix test for mac Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/bubble/bubble_border.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 SchedulePaint(); 527 SchedulePaint();
528 } 528 }
529 529
530 views::View* TrayBackgroundView::GetBubbleAnchor() const { 530 views::View* TrayBackgroundView::GetBubbleAnchor() const {
531 return tray_container_; 531 return tray_container_;
532 } 532 }
533 533
534 gfx::Insets TrayBackgroundView::GetBubbleAnchorInsets() const { 534 gfx::Insets TrayBackgroundView::GetBubbleAnchorInsets() const {
535 gfx::Insets anchor_insets = GetBubbleAnchor()->GetInsets(); 535 gfx::Insets anchor_insets = GetBubbleAnchor()->GetInsets();
536 gfx::Insets tray_bg_insets = GetInsets(); 536 gfx::Insets tray_bg_insets = GetInsets();
537 // TODO(estade): for reasons I don't understand, BubbleBorder distances the
538 // bubble by the arrow's "interior" thickness even when the paint type is
539 // PAINT_NONE.
540 const int kBigShadowArrowInteriorThickness = 9;
541 if (GetAnchorAlignment() == TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { 537 if (GetAnchorAlignment() == TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) {
542 return gfx::Insets(kBigShadowArrowInteriorThickness - tray_bg_insets.top(), 538 return gfx::Insets(-tray_bg_insets.top(), anchor_insets.left(),
543 anchor_insets.left(), -tray_bg_insets.bottom(), 539 -tray_bg_insets.bottom(), anchor_insets.right());
544 anchor_insets.right());
545 } else { 540 } else {
546 return gfx::Insets( 541 return gfx::Insets(anchor_insets.top(), -tray_bg_insets.left(),
547 anchor_insets.top(), 542 anchor_insets.bottom(), -tray_bg_insets.right());
548 kBigShadowArrowInteriorThickness - tray_bg_insets.left(),
549 anchor_insets.bottom(),
550 kBigShadowArrowInteriorThickness - tray_bg_insets.right());
551 } 543 }
552 } 544 }
553 545
554 std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask() 546 std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask()
555 const { 547 const {
556 return base::MakeUnique<views::RoundRectInkDropMask>( 548 return base::MakeUnique<views::RoundRectInkDropMask>(
557 size(), GetBackgroundInsets(), kTrayRoundedBorderRadius); 549 size(), GetBackgroundInsets(), kTrayRoundedBorderRadius);
558 } 550 }
559 551
560 bool TrayBackgroundView::ShouldEnterPushedState(const ui::Event& event) { 552 bool TrayBackgroundView::ShouldEnterPushedState(const ui::Event& event) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 } 637 }
646 638
647 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { 639 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const {
648 gfx::Insets insets = GetBackgroundInsets(); 640 gfx::Insets insets = GetBackgroundInsets();
649 gfx::Rect bounds = GetLocalBounds(); 641 gfx::Rect bounds = GetLocalBounds();
650 bounds.Inset(insets); 642 bounds.Inset(insets);
651 return bounds; 643 return bounds;
652 } 644 }
653 645
654 } // namespace ash 646 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/bubble_border.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698