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 "chrome/browser/ui/views/status_bubble_views.h" | 5 #include "chrome/browser/ui/views/status_bubble_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 ui::ThemeProvider* theme_service_; | 185 ui::ThemeProvider* theme_service_; |
186 }; | 186 }; |
187 | 187 |
188 void StatusBubbleViews::StatusView::SetText(const string16& text, | 188 void StatusBubbleViews::StatusView::SetText(const string16& text, |
189 bool should_animate_open) { | 189 bool should_animate_open) { |
190 if (text.empty()) { | 190 if (text.empty()) { |
191 // The string was empty. | 191 // The string was empty. |
192 StartHiding(); | 192 StartHiding(); |
193 } else { | 193 } else { |
194 // We want to show the string. | 194 // We want to show the string. |
195 text_ = text; | 195 if (text != text_) { |
| 196 text_ = text; |
| 197 SchedulePaint(); |
| 198 } |
196 if (should_animate_open) | 199 if (should_animate_open) |
197 StartShowing(); | 200 StartShowing(); |
198 } | 201 } |
199 | |
200 SchedulePaint(); | |
201 } | 202 } |
202 | 203 |
203 void StatusBubbleViews::StatusView::Show() { | 204 void StatusBubbleViews::StatusView::Show() { |
204 Stop(); | 205 Stop(); |
205 CancelTimer(); | 206 CancelTimer(); |
206 SetOpacity(1.0); | 207 SetOpacity(1.0); |
207 popup_->Show(); | 208 popup_->Show(); |
208 stage_ = BUBBLE_SHOWN; | 209 stage_ = BUBBLE_SHOWN; |
209 } | 210 } |
210 | 211 |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 void StatusBubbleViews::SetBubbleWidth(int width) { | 849 void StatusBubbleViews::SetBubbleWidth(int width) { |
849 size_.set_width(width); | 850 size_.set_width(width); |
850 SetBounds(original_position_.x(), original_position_.y(), | 851 SetBounds(original_position_.x(), original_position_.y(), |
851 size_.width(), size_.height()); | 852 size_.width(), size_.height()); |
852 } | 853 } |
853 | 854 |
854 void StatusBubbleViews::CancelExpandTimer() { | 855 void StatusBubbleViews::CancelExpandTimer() { |
855 if (expand_timer_factory_.HasWeakPtrs()) | 856 if (expand_timer_factory_.HasWeakPtrs()) |
856 expand_timer_factory_.InvalidateWeakPtrs(); | 857 expand_timer_factory_.InvalidateWeakPtrs(); |
857 } | 858 } |
OLD | NEW |