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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 small_image_view->SetImageSize(gfx::Size(kSmallImageSize, kSmallImageSize)); | 79 small_image_view->SetImageSize(gfx::Size(kSmallImageSize, kSmallImageSize)); |
80 // The small image view should be added to view hierarchy by the derived | 80 // The small image view should be added to view hierarchy by the derived |
81 // class. This ensures that it is on top of other views. | 81 // class. This ensures that it is on top of other views. |
82 small_image_view->set_owned_by_client(); | 82 small_image_view->set_owned_by_client(); |
83 small_image_view_.reset(small_image_view); | 83 small_image_view_.reset(small_image_view); |
84 | 84 |
85 focus_painter_ = views::Painter::CreateSolidFocusPainter( | 85 focus_painter_ = views::Painter::CreateSolidFocusPainter( |
86 kFocusBorderColor, gfx::Insets(0, 1, 3, 2)); | 86 kFocusBorderColor, gfx::Insets(0, 1, 3, 2)); |
87 | 87 |
88 accessible_name_ = CreateAccessibleName(notification); | 88 accessible_name_ = CreateAccessibleName(notification); |
89 set_slide_out_enabled(!notification.pinned()); | |
yhanada
2017/01/12 05:51:58
optional: How about calling UpdateWithNotification
yoshiki
2017/01/16 06:08:50
Good idea! done.
| |
89 } | 90 } |
90 | 91 |
91 MessageView::~MessageView() { | 92 MessageView::~MessageView() { |
92 } | 93 } |
93 | 94 |
94 void MessageView::UpdateWithNotification(const Notification& notification) { | 95 void MessageView::UpdateWithNotification(const Notification& notification) { |
95 small_image_view_->SetImage(notification.small_image().AsImageSkia()); | 96 small_image_view_->SetImage(notification.small_image().AsImageSkia()); |
96 display_source_ = notification.display_source(); | 97 display_source_ = notification.display_source(); |
97 accessible_name_ = CreateAccessibleName(notification); | 98 accessible_name_ = CreateAccessibleName(notification); |
99 set_slide_out_enabled(!notification.pinned()); | |
98 } | 100 } |
99 | 101 |
100 // static | 102 // static |
101 gfx::Insets MessageView::GetShadowInsets() { | 103 gfx::Insets MessageView::GetShadowInsets() { |
102 return -gfx::ShadowValue::GetMargin( | 104 return -gfx::ShadowValue::GetMargin( |
103 gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius).values); | 105 gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius).values); |
104 } | 106 } |
105 | 107 |
106 void MessageView::CreateShadowBorder() { | 108 void MessageView::CreateShadowBorder() { |
107 const auto& shadow = | 109 const auto& shadow = |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 } | 237 } |
236 | 238 |
237 void MessageView::SetDrawBackgroundAsActive(bool active) { | 239 void MessageView::SetDrawBackgroundAsActive(bool active) { |
238 background_view_->background()-> | 240 background_view_->background()-> |
239 SetNativeControlColor(active ? kHoveredButtonBackgroundColor : | 241 SetNativeControlColor(active ? kHoveredButtonBackgroundColor : |
240 kNotificationBackgroundColor); | 242 kNotificationBackgroundColor); |
241 SchedulePaint(); | 243 SchedulePaint(); |
242 } | 244 } |
243 | 245 |
244 } // namespace message_center | 246 } // namespace message_center |
OLD | NEW |