| 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 "cc/paint/paint_flags.h" |
| (...skipping 95 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 cc::PaintFlags paint; | 116 cc::PaintFlags flags; |
| 117 paint.setAlpha(255); | 117 flags.setAlpha(255); |
| 118 paint.setStyle(cc::PaintFlags::kFill_Style); | 118 flags.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_, flags); |
| 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 |
| 129 // enough height. Otherwise, makes sure the bottom rows are visible. | 129 // enough height. Otherwise, makes sure the bottom rows are visible. |
| 130 class BottomAlignedBoxLayout : public BoxLayout { | 130 class BottomAlignedBoxLayout : public BoxLayout { |
| (...skipping 246 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 |