Chromium Code Reviews| 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/tabs/tab.h" | 5 #include "chrome/browser/ui/views/tabs/tab.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 hover_controller_.SetAnimationContainer(container); | 538 hover_controller_.SetAnimationContainer(container); |
| 539 } | 539 } |
| 540 | 540 |
| 541 bool Tab::IsActive() const { | 541 bool Tab::IsActive() const { |
| 542 return controller_->IsActiveTab(this); | 542 return controller_->IsActiveTab(this); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void Tab::ActiveStateChanged() { | 545 void Tab::ActiveStateChanged() { |
| 546 OnButtonColorMaybeChanged(); | 546 OnButtonColorMaybeChanged(); |
| 547 media_indicator_button_->UpdateEnabledForMuteToggle(); | 547 media_indicator_button_->UpdateEnabledForMuteToggle(); |
| 548 | |
| 549 if (ShouldShowCloseBox() != showing_close_button_) | |
|
miu
2016/01/08 00:25:39
I think we have to unconditionally call Layout() h
enne (OOO)
2016/01/08 01:46:25
Thanks! Updated the patch.
| |
| 550 Layout(); | |
| 548 } | 551 } |
| 549 | 552 |
| 550 bool Tab::IsSelected() const { | 553 bool Tab::IsSelected() const { |
| 551 return controller_->IsTabSelected(this); | 554 return controller_->IsTabSelected(this); |
| 552 } | 555 } |
| 553 | 556 |
| 554 void Tab::SetData(const TabRendererData& data) { | 557 void Tab::SetData(const TabRendererData& data) { |
| 555 DCHECK(GetWidget()); | 558 DCHECK(GetWidget()); |
| 556 | 559 |
| 557 if (data_.Equals(data)) | 560 if (data_.Equals(data)) |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1169 if (data().blocked == old.blocked) | 1172 if (data().blocked == old.blocked) |
| 1170 return; | 1173 return; |
| 1171 | 1174 |
| 1172 if (data().blocked) | 1175 if (data().blocked) |
| 1173 StartPulse(); | 1176 StartPulse(); |
| 1174 else | 1177 else |
| 1175 StopPulse(); | 1178 StopPulse(); |
| 1176 } | 1179 } |
| 1177 | 1180 |
| 1178 void Tab::PaintTab(gfx::Canvas* canvas) { | 1181 void Tab::PaintTab(gfx::Canvas* canvas) { |
| 1179 // See if the model changes whether the icons should be painted. | |
| 1180 const bool show_icon = ShouldShowIcon(); | |
| 1181 const bool show_media_indicator = ShouldShowMediaIndicator(); | |
| 1182 const bool show_close_button = ShouldShowCloseBox(); | |
| 1183 if (show_icon != showing_icon_ || | |
| 1184 show_media_indicator != showing_media_indicator_ || | |
| 1185 show_close_button != showing_close_button_) | |
| 1186 Layout(); | |
| 1187 | |
| 1188 PaintTabBackground(canvas); | 1182 PaintTabBackground(canvas); |
| 1189 | 1183 |
| 1190 if (show_icon) | 1184 if (showing_icon_) |
| 1191 PaintIcon(canvas); | 1185 PaintIcon(canvas); |
| 1192 } | 1186 } |
| 1193 | 1187 |
| 1194 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) { | 1188 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) { |
| 1195 // Use transparency for the draw-attention animation. | 1189 // Use transparency for the draw-attention animation. |
| 1196 int alpha = 255; | 1190 int alpha = 255; |
| 1197 if (pulse_animation_ && pulse_animation_->is_animating() && !data().pinned) { | 1191 if (pulse_animation_ && pulse_animation_->is_animating() && !data().pinned) { |
| 1198 alpha = pulse_animation_->CurrentValueBetween( | 1192 alpha = pulse_animation_->CurrentValueBetween( |
| 1199 255, static_cast<int>(255 * kImmersiveTabMinThrobOpacity)); | 1193 255, static_cast<int>(255 * kImmersiveTabMinThrobOpacity)); |
| 1200 } | 1194 } |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1765 const gfx::ImageSkia& image) { | 1759 const gfx::ImageSkia& image) { |
| 1766 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1760 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1767 ImageCacheEntry entry; | 1761 ImageCacheEntry entry; |
| 1768 entry.resource_id = resource_id; | 1762 entry.resource_id = resource_id; |
| 1769 entry.scale_factor = scale_factor; | 1763 entry.scale_factor = scale_factor; |
| 1770 entry.image = image; | 1764 entry.image = image; |
| 1771 image_cache_->push_front(entry); | 1765 image_cache_->push_front(entry); |
| 1772 if (image_cache_->size() > kMaxImageCacheSize) | 1766 if (image_cache_->size() > kMaxImageCacheSize) |
| 1773 image_cache_->pop_back(); | 1767 image_cache_->pop_back(); |
| 1774 } | 1768 } |
| OLD | NEW |