| 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 "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 MessageCenterTray* tray) | 24 MessageCenterTray* tray) |
| 25 : message_center_(message_center), | 25 : message_center_(message_center), |
| 26 tray_(tray), | 26 tray_(tray), |
| 27 bubble_view_(NULL), | 27 bubble_view_(NULL), |
| 28 max_height_(kMessageBubbleBaseDefaultMaxHeight), | 28 max_height_(kMessageBubbleBaseDefaultMaxHeight), |
| 29 weak_ptr_factory_(this) { | 29 weak_ptr_factory_(this) { |
| 30 } | 30 } |
| 31 | 31 |
| 32 MessageBubbleBase::~MessageBubbleBase() { | 32 MessageBubbleBase::~MessageBubbleBase() { |
| 33 if (bubble_view_) | 33 if (bubble_view_) |
| 34 bubble_view_->reset_delegate(); | 34 bubble_view_->ResetDelegate(); |
| 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 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 44 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 height = kMessageBubbleBaseDefaultMaxHeight; | 57 height = kMessageBubbleBaseDefaultMaxHeight; |
| 58 if (height == max_height_) | 58 if (height == max_height_) |
| 59 return; | 59 return; |
| 60 | 60 |
| 61 max_height_ = height; | 61 max_height_ = height; |
| 62 if (bubble_view_) | 62 if (bubble_view_) |
| 63 bubble_view_->SetMaxHeight(max_height_); | 63 bubble_view_->SetMaxHeight(max_height_); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace message_center | 66 } // namespace message_center |
| OLD | NEW |