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_bubble_base.h" | 5 #include "ui/message_center/views/message_bubble_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/message_center/message_center_style.h" | 8 #include "ui/message_center/message_center_style.h" |
9 #include "ui/message_center/message_center_util.h" | 9 #include "ui/message_center/message_center_util.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 weak_ptr_factory_.GetWeakPtr()), | 49 weak_ptr_factory_.GetWeakPtr()), |
50 base::TimeDelta::FromMilliseconds(kUpdateDelayMs)); | 50 base::TimeDelta::FromMilliseconds(kUpdateDelayMs)); |
51 } | 51 } |
52 | 52 |
53 bool MessageBubbleBase::IsVisible() const { | 53 bool MessageBubbleBase::IsVisible() const { |
54 return bubble_view() && bubble_view()->GetWidget()->IsVisible(); | 54 return bubble_view() && bubble_view()->GetWidget()->IsVisible(); |
55 } | 55 } |
56 | 56 |
57 void MessageBubbleBase::SetMaxHeight(int height) { | 57 void MessageBubbleBase::SetMaxHeight(int height) { |
58 // Maximum height makes sense only for the new design. | 58 // Maximum height makes sense only for the new design. |
59 if (!message_center::IsRichNotificationEnabled()) | |
60 return; | |
61 | |
62 if (height == 0) | 59 if (height == 0) |
63 height = kMessageBubbleBaseDefaultMaxHeight; | 60 height = kMessageBubbleBaseDefaultMaxHeight; |
64 if (height == max_height_) | 61 if (height == max_height_) |
65 return; | 62 return; |
66 | 63 |
67 max_height_ = height; | 64 max_height_ = height; |
68 if (bubble_view_) | 65 if (bubble_view_) |
69 bubble_view_->SetMaxHeight(max_height_); | 66 bubble_view_->SetMaxHeight(max_height_); |
70 } | 67 } |
71 | 68 |
72 views::TrayBubbleView::InitParams MessageBubbleBase::GetDefaultInitParams( | 69 views::TrayBubbleView::InitParams MessageBubbleBase::GetDefaultInitParams( |
73 views::TrayBubbleView::AnchorAlignment anchor_alignment) { | 70 views::TrayBubbleView::AnchorAlignment anchor_alignment) { |
74 views::TrayBubbleView::InitParams init_params( | 71 views::TrayBubbleView::InitParams init_params( |
75 views::TrayBubbleView::ANCHOR_TYPE_TRAY, | 72 views::TrayBubbleView::ANCHOR_TYPE_TRAY, |
76 anchor_alignment, | 73 anchor_alignment, |
77 kNotificationWidth, | 74 kNotificationWidth, |
78 kNotificationWidth); | 75 kNotificationWidth); |
79 init_params.arrow_color = kBackgroundDarkColor; | 76 init_params.arrow_color = kBackgroundDarkColor; |
80 return init_params; | 77 return init_params; |
81 } | 78 } |
82 | 79 |
83 } // namespace message_center | 80 } // namespace message_center |
OLD | NEW |