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

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

Issue 2499523003: Add ink drop masking to TrayBackgroundView (Closed)
Patch Set: 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 node_data->SetName(GetAccessibleNameForTray()); 370 node_data->SetName(GetAccessibleNameForTray());
370 } 371 }
371 372
372 void TrayBackgroundView::AboutToRequestFocusFromTabTraversal(bool reverse) { 373 void TrayBackgroundView::AboutToRequestFocusFromTabTraversal(bool reverse) {
373 // Return focus to the login view. See crbug.com/120500. 374 // Return focus to the login view. See crbug.com/120500.
374 views::View* v = GetNextFocusableView(); 375 views::View* v = GetNextFocusableView();
375 if (v) 376 if (v)
376 v->AboutToRequestFocusFromTabTraversal(reverse); 377 v->AboutToRequestFocusFromTabTraversal(reverse);
377 } 378 }
378 379
380 void TrayBackgroundView::AddInkDropLayer(ui::Layer* ink_drop_layer) {
381 gfx::Rect local_bounds = GetLocalBounds();
382 ink_drop_layer->SetBounds(local_bounds);
bruthig 2016/11/11 20:16:43 Capturing offline discussion: Let's move the owner
mohsen 2016/11/13 23:31:28 Done.
383 ink_drop_mask_.reset(new views::RoundRectInkDropMask(
384 local_bounds, GetBackgroundBounds(GetContentsBounds(), shelf_alignment_),
385 kTrayRoundedBorderRadius));
386 ink_drop_layer->SetMaskLayer(ink_drop_mask_->layer());
387 ActionableView::AddInkDropLayer(ink_drop_layer);
388 }
389
390 void TrayBackgroundView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
391 ActionableView::RemoveInkDropLayer(ink_drop_layer);
392 ink_drop_layer->SetMaskLayer(nullptr);
393 ink_drop_mask_.reset();
394 }
395
379 std::unique_ptr<views::InkDropRipple> TrayBackgroundView::CreateInkDropRipple() 396 std::unique_ptr<views::InkDropRipple> TrayBackgroundView::CreateInkDropRipple()
380 const { 397 const {
381 return base::MakeUnique<views::FloodFillInkDropRipple>( 398 return base::MakeUnique<views::FloodFillInkDropRipple>(
382 GetBackgroundBounds(GetContentsBounds(), shelf_alignment_), 399 GetBackgroundBounds(GetContentsBounds(), shelf_alignment_),
383 GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), 400 GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(),
384 ink_drop_visible_opacity()); 401 ink_drop_visible_opacity());
385 } 402 }
386 403
387 std::unique_ptr<views::InkDropHighlight> 404 std::unique_ptr<views::InkDropHighlight>
388 TrayBackgroundView::CreateInkDropHighlight() const { 405 TrayBackgroundView::CreateInkDropHighlight() const {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 paint.setAntiAlias(true); 636 paint.setAntiAlias(true);
620 637
621 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height) 638 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height)
622 : gfx::Rect(y, x, height, width); 639 : gfx::Rect(y, x, height, width);
623 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 640 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
624 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(), 641 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(),
625 rect.bottom_right(), paint); 642 rect.bottom_right(), paint);
626 } 643 }
627 644
628 } // namespace ash 645 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698