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_constants.h" | 8 #include "ui/message_center/message_center_constants.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 23 matching lines...) Expand all Loading... |
34 bubble_view_->reset_delegate(); | 34 bubble_view_->reset_delegate(); |
35 } | 35 } |
36 | 36 |
37 void MessageBubbleBase::BubbleViewDestroyed() { | 37 void MessageBubbleBase::BubbleViewDestroyed() { |
38 bubble_view_ = NULL; | 38 bubble_view_ = NULL; |
39 OnBubbleViewDestroyed(); | 39 OnBubbleViewDestroyed(); |
40 } | 40 } |
41 | 41 |
42 void MessageBubbleBase::ScheduleUpdate() { | 42 void MessageBubbleBase::ScheduleUpdate() { |
43 weak_ptr_factory_.InvalidateWeakPtrs(); // Cancel any pending update. | 43 weak_ptr_factory_.InvalidateWeakPtrs(); // Cancel any pending update. |
44 MessageLoop::current()->PostDelayedTask( | 44 base::MessageLoop::current()->PostDelayedTask( |
45 FROM_HERE, | 45 FROM_HERE, |
46 base::Bind(&MessageBubbleBase::UpdateBubbleView, | 46 base::Bind(&MessageBubbleBase::UpdateBubbleView, |
47 weak_ptr_factory_.GetWeakPtr()), | 47 weak_ptr_factory_.GetWeakPtr()), |
48 base::TimeDelta::FromMilliseconds(kUpdateDelayMs)); | 48 base::TimeDelta::FromMilliseconds(kUpdateDelayMs)); |
49 } | 49 } |
50 | 50 |
51 bool MessageBubbleBase::IsVisible() const { | 51 bool MessageBubbleBase::IsVisible() const { |
52 return bubble_view() && bubble_view()->GetWidget()->IsVisible(); | 52 return bubble_view() && bubble_view()->GetWidget()->IsVisible(); |
53 } | 53 } |
54 | 54 |
(...skipping 17 matching lines...) Expand all Loading... |
72 views::TrayBubbleView::InitParams init_params( | 72 views::TrayBubbleView::InitParams init_params( |
73 views::TrayBubbleView::ANCHOR_TYPE_TRAY, | 73 views::TrayBubbleView::ANCHOR_TYPE_TRAY, |
74 anchor_alignment, | 74 anchor_alignment, |
75 kNotificationWidth, | 75 kNotificationWidth, |
76 kNotificationWidth); | 76 kNotificationWidth); |
77 init_params.arrow_color = kBackgroundDarkColor; | 77 init_params.arrow_color = kBackgroundDarkColor; |
78 return init_params; | 78 return init_params; |
79 } | 79 } |
80 | 80 |
81 } // namespace message_center | 81 } // namespace message_center |
OLD | NEW |