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

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

Issue 2499523003: Add ink drop masking to TrayBackgroundView (Closed)
Patch Set: Addressed review comments Created 4 years, 1 month 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
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 "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/shelf/shelf_constants.h" 8 #include "ash/common/shelf/shelf_constants.h"
9 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/common/shelf/wm_shelf_util.h" 10 #include "ash/common/shelf/wm_shelf_util.h"
(...skipping 17 matching lines...) Expand all
28 #include "ui/gfx/geometry/rect.h" 28 #include "ui/gfx/geometry/rect.h"
29 #include "ui/gfx/geometry/size.h" 29 #include "ui/gfx/geometry/size.h"
30 #include "ui/gfx/image/image_skia.h" 30 #include "ui/gfx/image/image_skia.h"
31 #include "ui/gfx/image/image_skia_operations.h" 31 #include "ui/gfx/image/image_skia_operations.h"
32 #include "ui/gfx/nine_image_painter.h" 32 #include "ui/gfx/nine_image_painter.h"
33 #include "ui/gfx/scoped_canvas.h" 33 #include "ui/gfx/scoped_canvas.h"
34 #include "ui/gfx/skia_util.h" 34 #include "ui/gfx/skia_util.h"
35 #include "ui/gfx/transform.h" 35 #include "ui/gfx/transform.h"
36 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 36 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
37 #include "ui/views/animation/ink_drop_highlight.h" 37 #include "ui/views/animation/ink_drop_highlight.h"
38 #include "ui/views/animation/ink_drop_mask.h"
38 #include "ui/views/background.h" 39 #include "ui/views/background.h"
39 #include "ui/views/layout/box_layout.h" 40 #include "ui/views/layout/box_layout.h"
40 #include "ui/wm/core/window_animations.h" 41 #include "ui/wm/core/window_animations.h"
41 42
42 namespace { 43 namespace {
43 44
44 const int kAnimationDurationForPopupMs = 200; 45 const int kAnimationDurationForPopupMs = 200;
45 46
46 // Duration of opacity animation for visibility changes. 47 // Duration of opacity animation for visibility changes.
47 const int kAnimationDurationForVisibilityMs = 250; 48 const int kAnimationDurationForVisibilityMs = 250;
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 background_->set_alpha(alpha); 566 background_->set_alpha(alpha);
566 SchedulePaint(); 567 SchedulePaint();
567 } 568 }
568 } 569 }
569 570
570 void TrayBackgroundView::SetSeparatorVisibility(bool is_shown) { 571 void TrayBackgroundView::SetSeparatorVisibility(bool is_shown) {
571 is_separator_visible_ = is_shown; 572 is_separator_visible_ = is_shown;
572 SchedulePaint(); 573 SchedulePaint();
573 } 574 }
574 575
576 std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask()
577 const {
578 return base::MakeUnique<views::RoundRectInkDropMask>(
579 GetLocalBounds(),
580 GetBackgroundBounds(GetContentsBounds(), shelf_alignment_),
581 kTrayRoundedBorderRadius);
582 }
583
575 bool TrayBackgroundView::ShouldEnterPushedState(const ui::Event& event) { 584 bool TrayBackgroundView::ShouldEnterPushedState(const ui::Event& event) {
576 if (is_active_) 585 if (is_active_)
577 return false; 586 return false;
578 587
579 return ActionableView::ShouldEnterPushedState(event); 588 return ActionableView::ShouldEnterPushedState(event);
580 } 589 }
581 590
582 bool TrayBackgroundView::PerformAction(const ui::Event& event) { 591 bool TrayBackgroundView::PerformAction(const ui::Event& event) {
583 return false; 592 return false;
584 } 593 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 paint.setAntiAlias(true); 632 paint.setAntiAlias(true);
624 633
625 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height) 634 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height)
626 : gfx::Rect(y, x, height, width); 635 : gfx::Rect(y, x, height, width);
627 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 636 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
628 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(), 637 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(),
629 rect.bottom_right(), paint); 638 rect.bottom_right(), paint);
630 } 639 }
631 640
632 } // namespace ash 641 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698