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/views/widget/widget.h" | 9 #include "ui/views/widget/widget.h" |
10 #include "ui/views/widget/widget_observer.h" | 10 #include "ui/views/widget/widget_observer.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 // Delay laying out the MessageBubbleBase until all notifications have been | 13 // Delay laying out the MessageBubbleBase until all notifications have been |
14 // added and icons have had a chance to load. | 14 // added and icons have had a chance to load. |
15 const int kUpdateDelayMs = 50; | 15 const int kUpdateDelayMs = 50; |
16 const int kMessageBubbleBaseDefaultMaxHeight = 400; | 16 const int kMessageBubbleBaseDefaultMaxHeight = 400; |
17 } | 17 } |
18 | 18 |
19 namespace message_center { | 19 namespace message_center { |
20 | 20 |
21 const SkColor MessageBubbleBase::kBackgroundColor = | 21 const SkColor MessageBubbleBase::kBackgroundColor = |
22 SkColorSetRGB(0xfe, 0xfe, 0xfe); | 22 SkColorSetRGB(0xfe, 0xfe, 0xfe); |
23 | 23 |
24 MessageBubbleBase::MessageBubbleBase(MessageCenter* message_center, | 24 MessageBubbleBase::MessageBubbleBase(MessageCenter* message_center, |
25 MessageCenterTray* tray) | 25 MessageCenterTray* tray) |
26 : message_center_(message_center), | 26 : message_center_(message_center), |
27 tray_(tray), | 27 tray_(tray), |
28 bubble_view_(NULL), | 28 bubble_view_(NULL), |
29 weak_ptr_factory_(this), | 29 max_height_(kMessageBubbleBaseDefaultMaxHeight), |
30 max_height_(kMessageBubbleBaseDefaultMaxHeight) { | 30 weak_ptr_factory_(this) { |
31 } | 31 } |
32 | 32 |
33 MessageBubbleBase::~MessageBubbleBase() { | 33 MessageBubbleBase::~MessageBubbleBase() { |
34 if (bubble_view_) | 34 if (bubble_view_) |
35 bubble_view_->reset_delegate(); | 35 bubble_view_->reset_delegate(); |
36 } | 36 } |
37 | 37 |
38 void MessageBubbleBase::BubbleViewDestroyed() { | 38 void MessageBubbleBase::BubbleViewDestroyed() { |
39 bubble_view_ = NULL; | 39 bubble_view_ = NULL; |
40 OnBubbleViewDestroyed(); | 40 OnBubbleViewDestroyed(); |
(...skipping 29 matching lines...) Expand all Loading... |
70 views::TrayBubbleView::InitParams init_params( | 70 views::TrayBubbleView::InitParams init_params( |
71 views::TrayBubbleView::ANCHOR_TYPE_TRAY, | 71 views::TrayBubbleView::ANCHOR_TYPE_TRAY, |
72 anchor_alignment, | 72 anchor_alignment, |
73 kNotificationWidth, | 73 kNotificationWidth, |
74 kNotificationWidth); | 74 kNotificationWidth); |
75 init_params.arrow_color = kBackgroundDarkColor; | 75 init_params.arrow_color = kBackgroundDarkColor; |
76 return init_params; | 76 return init_params; |
77 } | 77 } |
78 | 78 |
79 } // namespace message_center | 79 } // namespace message_center |
OLD | NEW |