| 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 "ui/views/bubble/tray_bubble_view.h" | 5 #include "ui/views/bubble/tray_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "cc/paint/paint_flags.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
| 11 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
| 12 #include "third_party/skia/include/core/SkPaint.h" | |
| 13 #include "third_party/skia/include/core/SkPath.h" | 13 #include "third_party/skia/include/core/SkPath.h" |
| 14 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 14 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 15 #include "ui/accessibility/ax_node_data.h" | 15 #include "ui/accessibility/ax_node_data.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
| 18 #include "ui/compositor/layer_delegate.h" | 18 #include "ui/compositor/layer_delegate.h" |
| 19 #include "ui/compositor/paint_recorder.h" | 19 #include "ui/compositor/paint_recorder.h" |
| 20 #include "ui/events/event.h" | 20 #include "ui/events/event.h" |
| 21 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
| 22 #include "ui/gfx/color_palette.h" | 22 #include "ui/gfx/color_palette.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 layer_.set_delegate(this); | 106 layer_.set_delegate(this); |
| 107 layer_.SetFillsBoundsOpaquely(false); | 107 layer_.SetFillsBoundsOpaquely(false); |
| 108 } | 108 } |
| 109 | 109 |
| 110 TrayBubbleContentMask::~TrayBubbleContentMask() { | 110 TrayBubbleContentMask::~TrayBubbleContentMask() { |
| 111 layer_.set_delegate(NULL); | 111 layer_.set_delegate(NULL); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void TrayBubbleContentMask::OnPaintLayer(const ui::PaintContext& context) { | 114 void TrayBubbleContentMask::OnPaintLayer(const ui::PaintContext& context) { |
| 115 ui::PaintRecorder recorder(context, layer()->size()); | 115 ui::PaintRecorder recorder(context, layer()->size()); |
| 116 SkPaint paint; | 116 cc::PaintFlags paint; |
| 117 paint.setAlpha(255); | 117 paint.setAlpha(255); |
| 118 paint.setStyle(SkPaint::kFill_Style); | 118 paint.setStyle(cc::PaintFlags::kFill_Style); |
| 119 gfx::Rect rect(layer()->bounds().size()); | 119 gfx::Rect rect(layer()->bounds().size()); |
| 120 recorder.canvas()->DrawRoundRect(rect, corner_radius_, paint); | 120 recorder.canvas()->DrawRoundRect(rect, corner_radius_, paint); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void TrayBubbleContentMask::OnDeviceScaleFactorChanged( | 123 void TrayBubbleContentMask::OnDeviceScaleFactorChanged( |
| 124 float device_scale_factor) { | 124 float device_scale_factor) { |
| 125 // Redrawing will take care of scale factor change. | 125 // Redrawing will take care of scale factor change. |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Custom layout for the bubble-view. Does the default box-layout if there is | 128 // Custom layout for the bubble-view. Does the default box-layout if there is |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 377 |
| 378 void TrayBubbleView::ViewHierarchyChanged( | 378 void TrayBubbleView::ViewHierarchyChanged( |
| 379 const ViewHierarchyChangedDetails& details) { | 379 const ViewHierarchyChangedDetails& details) { |
| 380 if (details.is_add && details.child == this) { | 380 if (details.is_add && details.child == this) { |
| 381 details.parent->SetPaintToLayer(); | 381 details.parent->SetPaintToLayer(); |
| 382 details.parent->layer()->SetMasksToBounds(true); | 382 details.parent->layer()->SetMasksToBounds(true); |
| 383 } | 383 } |
| 384 } | 384 } |
| 385 | 385 |
| 386 } // namespace views | 386 } // namespace views |
| OLD | NEW |