| 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/message_center/views/message_view.h" | 5 #include "ui/message_center/views/message_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/accessibility/ax_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/models/simple_menu_model.h" | 10 #include "ui/base/models/simple_menu_model.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 namespace message_center { | 62 namespace message_center { |
| 63 | 63 |
| 64 MessageView::MessageView(MessageCenterController* controller, | 64 MessageView::MessageView(MessageCenterController* controller, |
| 65 const Notification& notification) | 65 const Notification& notification) |
| 66 : controller_(controller), | 66 : controller_(controller), |
| 67 notification_id_(notification.id()), | 67 notification_id_(notification.id()), |
| 68 notifier_id_(notification.notifier_id()), | 68 notifier_id_(notification.notifier_id()), |
| 69 slide_out_controller_(this, this) { | 69 slide_out_controller_(this, this) { |
| 70 SetFocusBehavior(FocusBehavior::ALWAYS); | 70 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 71 | 71 |
| 72 // Paint to a dedicated layer to make the layer non-opaque. |
| 73 SetPaintToLayer(); |
| 74 layer()->SetFillsBoundsOpaquely(false); |
| 75 |
| 72 // Create the opaque background that's above the view's shadow. | 76 // Create the opaque background that's above the view's shadow. |
| 73 background_view_ = new views::View(); | 77 background_view_ = new views::View(); |
| 74 background_view_->set_background( | 78 background_view_->set_background( |
| 75 views::Background::CreateSolidBackground(kNotificationBackgroundColor)); | 79 views::Background::CreateSolidBackground(kNotificationBackgroundColor)); |
| 76 AddChildView(background_view_); | 80 AddChildView(background_view_); |
| 77 | 81 |
| 78 focus_painter_ = views::Painter::CreateSolidFocusPainter( | 82 focus_painter_ = views::Painter::CreateSolidFocusPainter( |
| 79 kFocusBorderColor, gfx::Insets(0, 1, 3, 2)); | 83 kFocusBorderColor, gfx::Insets(0, 1, 3, 2)); |
| 80 | 84 |
| 81 UpdateWithNotification(notification); | 85 UpdateWithNotification(notification); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 92 } | 96 } |
| 93 | 97 |
| 94 // static | 98 // static |
| 95 gfx::Insets MessageView::GetShadowInsets() { | 99 gfx::Insets MessageView::GetShadowInsets() { |
| 96 return -gfx::ShadowValue::GetMargin( | 100 return -gfx::ShadowValue::GetMargin( |
| 97 gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius).values); | 101 gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius).values); |
| 98 } | 102 } |
| 99 | 103 |
| 100 void MessageView::SetIsNested() { | 104 void MessageView::SetIsNested() { |
| 101 is_nested_ = true; | 105 is_nested_ = true; |
| 102 SetPaintToLayer(); | |
| 103 layer()->SetFillsBoundsOpaquely(false); | |
| 104 | 106 |
| 105 const auto& shadow = | 107 const auto& shadow = |
| 106 gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius); | 108 gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius); |
| 107 gfx::Insets ninebox_insets = gfx::ShadowValue::GetBlurRegion(shadow.values) + | 109 gfx::Insets ninebox_insets = gfx::ShadowValue::GetBlurRegion(shadow.values) + |
| 108 gfx::Insets(kShadowCornerRadius); | 110 gfx::Insets(kShadowCornerRadius); |
| 109 SetBorder(views::CreateBorderPainter( | 111 SetBorder(views::CreateBorderPainter( |
| 110 std::unique_ptr<views::Painter>(views::Painter::CreateImagePainter( | 112 std::unique_ptr<views::Painter>(views::Painter::CreateImagePainter( |
| 111 shadow.ninebox_image, ninebox_insets)), | 113 shadow.ninebox_image, ninebox_insets)), |
| 112 -gfx::ShadowValue::GetMargin(shadow.values))); | 114 -gfx::ShadowValue::GetMargin(shadow.values))); |
| 113 } | 115 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 231 } |
| 230 | 232 |
| 231 void MessageView::SetDrawBackgroundAsActive(bool active) { | 233 void MessageView::SetDrawBackgroundAsActive(bool active) { |
| 232 background_view_->background()-> | 234 background_view_->background()-> |
| 233 SetNativeControlColor(active ? kHoveredButtonBackgroundColor : | 235 SetNativeControlColor(active ? kHoveredButtonBackgroundColor : |
| 234 kNotificationBackgroundColor); | 236 kNotificationBackgroundColor); |
| 235 SchedulePaint(); | 237 SchedulePaint(); |
| 236 } | 238 } |
| 237 | 239 |
| 238 } // namespace message_center | 240 } // namespace message_center |
| OLD | NEW |