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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 icon_height, filter, paint); | 178 icon_height, filter, paint); |
179 } | 179 } |
180 | 180 |
181 chrome::HostDesktopType GetHostDesktopType(views::View* view) { | 181 chrome::HostDesktopType GetHostDesktopType(views::View* view) { |
182 // Widget is NULL when tabs are detached. | 182 // Widget is NULL when tabs are detached. |
183 views::Widget* widget = view->GetWidget(); | 183 views::Widget* widget = view->GetWidget(); |
184 return chrome::GetHostDesktopTypeForNativeView( | 184 return chrome::GetHostDesktopTypeForNativeView( |
185 widget ? widget->GetNativeView() : NULL); | 185 widget ? widget->GetNativeView() : NULL); |
186 } | 186 } |
187 | 187 |
| 188 // Stop()s |animation| and then deletes it. We do this rather than just deleting |
| 189 // so that the delegate is notified before the destruction. |
| 190 void StopAndDeleteAnimation(scoped_ptr<gfx::Animation> animation) { |
| 191 if (animation) |
| 192 animation->Stop(); |
| 193 } |
| 194 |
188 } // namespace | 195 } // namespace |
189 | 196 |
190 //////////////////////////////////////////////////////////////////////////////// | 197 //////////////////////////////////////////////////////////////////////////////// |
191 // FaviconCrashAnimation | 198 // FaviconCrashAnimation |
192 // | 199 // |
193 // A custom animation subclass to manage the favicon crash animation. | 200 // A custom animation subclass to manage the favicon crash animation. |
194 class Tab::FaviconCrashAnimation : public gfx::LinearAnimation, | 201 class Tab::FaviconCrashAnimation : public gfx::LinearAnimation, |
195 public gfx::AnimationDelegate { | 202 public gfx::AnimationDelegate { |
196 public: | 203 public: |
197 explicit FaviconCrashAnimation(Tab* target) | 204 explicit FaviconCrashAnimation(Tab* target) |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 ResetCrashedFavicon(); | 481 ResetCrashedFavicon(); |
475 } | 482 } |
476 | 483 |
477 if (data_.media_state != old.media_state) { | 484 if (data_.media_state != old.media_state) { |
478 if (data_.media_state != TAB_MEDIA_STATE_NONE) | 485 if (data_.media_state != TAB_MEDIA_STATE_NONE) |
479 animating_media_state_ = data_.media_state; | 486 animating_media_state_ = data_.media_state; |
480 StartMediaIndicatorAnimation(); | 487 StartMediaIndicatorAnimation(); |
481 } | 488 } |
482 | 489 |
483 if (old.mini != data_.mini) { | 490 if (old.mini != data_.mini) { |
484 if (tab_animation_.get() && tab_animation_->is_animating()) { | 491 StopAndDeleteAnimation( |
485 tab_animation_->Stop(); | 492 mini_title_change_animation_.PassAs<gfx::Animation>()); |
486 tab_animation_.reset(NULL); | |
487 } | |
488 } | 493 } |
489 | 494 |
490 DataChanged(old); | 495 DataChanged(old); |
491 | 496 |
492 Layout(); | 497 Layout(); |
493 SchedulePaint(); | 498 SchedulePaint(); |
494 } | 499 } |
495 | 500 |
496 void Tab::UpdateLoadingAnimation(TabRendererData::NetworkState state) { | 501 void Tab::UpdateLoadingAnimation(TabRendererData::NetworkState state) { |
497 if (state == data_.network_state && | 502 if (state == data_.network_state && |
498 state == TabRendererData::NETWORK_STATE_NONE) { | 503 state == TabRendererData::NETWORK_STATE_NONE) { |
499 // If the network state is none and hasn't changed, do nothing. Otherwise we | 504 // If the network state is none and hasn't changed, do nothing. Otherwise we |
500 // need to advance the animation frame. | 505 // need to advance the animation frame. |
501 return; | 506 return; |
502 } | 507 } |
503 | 508 |
504 TabRendererData::NetworkState old_state = data_.network_state; | 509 TabRendererData::NetworkState old_state = data_.network_state; |
505 data_.network_state = state; | 510 data_.network_state = state; |
506 AdvanceLoadingAnimation(old_state, state); | 511 AdvanceLoadingAnimation(old_state, state); |
507 } | 512 } |
508 | 513 |
509 void Tab::StartPulse() { | 514 void Tab::StartPulse() { |
510 gfx::ThrobAnimation* animation = new gfx::ThrobAnimation(this); | 515 pulse_animation_.reset(new gfx::ThrobAnimation(this)); |
511 animation->SetSlideDuration(kPulseDurationMs); | 516 pulse_animation_->SetSlideDuration(kPulseDurationMs); |
512 if (animation_container_.get()) | 517 if (animation_container_) |
513 animation->SetContainer(animation_container_.get()); | 518 pulse_animation_->SetContainer(animation_container_.get()); |
514 animation->StartThrobbing(std::numeric_limits<int>::max()); | 519 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); |
515 tab_animation_.reset(animation); | |
516 } | 520 } |
517 | 521 |
518 void Tab::StopPulse() { | 522 void Tab::StopPulse() { |
519 if (!tab_animation_.get()) | 523 StopAndDeleteAnimation(pulse_animation_.PassAs<gfx::Animation>()); |
520 return; | |
521 tab_animation_->Stop(); | |
522 tab_animation_.reset(NULL); | |
523 } | 524 } |
524 | 525 |
525 void Tab::StartMiniTabTitleAnimation() { | 526 void Tab::StartMiniTabTitleAnimation() { |
526 // We can only do this animation if the tab is mini because we will | |
527 // upcast tab_animation back to MultiAnimation when we draw. | |
528 if (!data().mini) | 527 if (!data().mini) |
529 return; | 528 return; |
530 if (!tab_animation_.get()) { | 529 if (!mini_title_change_animation_) { |
531 gfx::MultiAnimation::Parts parts; | 530 gfx::MultiAnimation::Parts parts; |
532 parts.push_back( | 531 parts.push_back( |
533 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, | 532 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, |
534 gfx::Tween::EASE_OUT)); | 533 gfx::Tween::EASE_OUT)); |
535 parts.push_back( | 534 parts.push_back( |
536 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, | 535 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, |
537 gfx::Tween::ZERO)); | 536 gfx::Tween::ZERO)); |
538 parts.push_back( | 537 parts.push_back( |
539 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, | 538 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, |
540 gfx::Tween::EASE_IN)); | 539 gfx::Tween::EASE_IN)); |
541 parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; | 540 parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; |
542 parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; | 541 parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; |
543 parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; | 542 parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; |
544 parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; | 543 parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; |
545 base::TimeDelta timeout = | 544 base::TimeDelta timeout = |
546 base::TimeDelta::FromMilliseconds(kMiniTitleChangeAnimationIntervalMS); | 545 base::TimeDelta::FromMilliseconds(kMiniTitleChangeAnimationIntervalMS); |
547 gfx::MultiAnimation* animation = new gfx::MultiAnimation(parts, timeout); | 546 mini_title_change_animation_.reset(new gfx::MultiAnimation(parts, timeout)); |
548 if (animation_container_.get()) | 547 if (animation_container_) |
549 animation->SetContainer(animation_container_.get()); | 548 mini_title_change_animation_->SetContainer(animation_container_.get()); |
550 animation->set_delegate(this); | 549 mini_title_change_animation_->set_delegate(this); |
551 tab_animation_.reset(animation); | |
552 } | 550 } |
553 tab_animation_->Start(); | 551 mini_title_change_animation_->Start(); |
554 } | 552 } |
555 | 553 |
556 void Tab::StopMiniTabTitleAnimation() { | 554 void Tab::StopMiniTabTitleAnimation() { |
557 if (!tab_animation_.get()) | 555 StopAndDeleteAnimation(mini_title_change_animation_.PassAs<gfx::Animation>()); |
558 return; | |
559 tab_animation_->Stop(); | |
560 tab_animation_.reset(NULL); | |
561 } | 556 } |
562 | 557 |
563 // static | 558 // static |
564 gfx::Size Tab::GetBasicMinimumUnselectedSize() { | 559 gfx::Size Tab::GetBasicMinimumUnselectedSize() { |
565 InitTabResources(); | 560 InitTabResources(); |
566 | 561 |
567 gfx::Size minimum_size; | 562 gfx::Size minimum_size; |
568 minimum_size.set_width(kLeftPadding + kRightPadding); | 563 minimum_size.set_width(kLeftPadding + kRightPadding); |
569 // Since we use image images, the real minimum height of the image is | 564 // Since we use image images, the real minimum height of the image is |
570 // defined most accurately by the height of the end cap images. | 565 // defined most accurately by the height of the end cap images. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 int Tab::GetImmersiveHeight() { | 601 int Tab::GetImmersiveHeight() { |
607 return kImmersiveTabHeight; | 602 return kImmersiveTabHeight; |
608 } | 603 } |
609 | 604 |
610 //////////////////////////////////////////////////////////////////////////////// | 605 //////////////////////////////////////////////////////////////////////////////// |
611 // Tab, AnimationDelegate overrides: | 606 // Tab, AnimationDelegate overrides: |
612 | 607 |
613 void Tab::AnimationProgressed(const gfx::Animation* animation) { | 608 void Tab::AnimationProgressed(const gfx::Animation* animation) { |
614 // Ignore if the pulse animation is being performed on active tab because | 609 // Ignore if the pulse animation is being performed on active tab because |
615 // it repaints the same image. See |Tab::PaintTabBackground()|. | 610 // it repaints the same image. See |Tab::PaintTabBackground()|. |
616 if (animation == tab_animation_.get() && IsActive()) | 611 if (animation == pulse_animation_.get() && IsActive()) |
617 return; | 612 return; |
618 SchedulePaint(); | 613 SchedulePaint(); |
619 } | 614 } |
620 | 615 |
621 void Tab::AnimationCanceled(const gfx::Animation* animation) { | 616 void Tab::AnimationCanceled(const gfx::Animation* animation) { |
622 if (media_indicator_animation_ == animation) | 617 if (media_indicator_animation_ == animation) |
623 animating_media_state_ = data_.media_state; | 618 animating_media_state_ = data_.media_state; |
624 SchedulePaint(); | 619 SchedulePaint(); |
625 } | 620 } |
626 | 621 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1032 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
1038 close_button_->SetBackground(close_button_color_, | 1033 close_button_->SetBackground(close_button_color_, |
1039 rb.GetImageSkiaNamed(IDR_CLOSE_1), | 1034 rb.GetImageSkiaNamed(IDR_CLOSE_1), |
1040 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); | 1035 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); |
1041 } | 1036 } |
1042 } | 1037 } |
1043 | 1038 |
1044 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) { | 1039 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) { |
1045 // Use transparency for the draw-attention animation. | 1040 // Use transparency for the draw-attention animation. |
1046 int alpha = 255; | 1041 int alpha = 255; |
1047 if (tab_animation_ && | 1042 if (pulse_animation_ && pulse_animation_->is_animating() && !data().mini) { |
1048 tab_animation_->is_animating() && | 1043 alpha = pulse_animation_->CurrentValueBetween( |
1049 !data().mini) { | |
1050 alpha = tab_animation_->CurrentValueBetween( | |
1051 255, static_cast<int>(255 * kImmersiveTabMinThrobOpacity)); | 1044 255, static_cast<int>(255 * kImmersiveTabMinThrobOpacity)); |
1052 } | 1045 } |
1053 | 1046 |
1054 // Draw a gray rectangle to represent the tab. This works for mini-tabs as | 1047 // Draw a gray rectangle to represent the tab. This works for mini-tabs as |
1055 // well as regular ones. The active tab has a brigher bar. | 1048 // well as regular ones. The active tab has a brigher bar. |
1056 SkColor color = | 1049 SkColor color = |
1057 IsActive() ? kImmersiveActiveTabColor : kImmersiveInactiveTabColor; | 1050 IsActive() ? kImmersiveActiveTabColor : kImmersiveInactiveTabColor; |
1058 gfx::Rect bar_rect = GetImmersiveBarRect(); | 1051 gfx::Rect bar_rect = GetImmersiveBarRect(); |
1059 canvas->FillRect(bar_rect, SkColorSetA(color, alpha)); | 1052 canvas->FillRect(bar_rect, SkColorSetA(color, alpha)); |
1060 | 1053 |
(...skipping 23 matching lines...) Expand all Loading... |
1084 bar_rect.x(), 0, left_eye_width, kImmersiveBarHeight); | 1077 bar_rect.x(), 0, left_eye_width, kImmersiveBarHeight); |
1085 canvas->FillRect(left_eye_rect, kEyeColor); | 1078 canvas->FillRect(left_eye_rect, kEyeColor); |
1086 } | 1079 } |
1087 } | 1080 } |
1088 } | 1081 } |
1089 | 1082 |
1090 void Tab::PaintTabBackground(gfx::Canvas* canvas) { | 1083 void Tab::PaintTabBackground(gfx::Canvas* canvas) { |
1091 if (IsActive()) { | 1084 if (IsActive()) { |
1092 PaintActiveTabBackground(canvas); | 1085 PaintActiveTabBackground(canvas); |
1093 } else { | 1086 } else { |
1094 if (tab_animation_.get() && | 1087 if (mini_title_change_animation_ && |
1095 tab_animation_->is_animating() && | 1088 mini_title_change_animation_->is_animating()) { |
1096 data().mini) { | 1089 PaintInactiveTabBackgroundWithTitleChange(canvas); |
1097 gfx::MultiAnimation* animation = | |
1098 static_cast<gfx::MultiAnimation*>(tab_animation_.get()); | |
1099 PaintInactiveTabBackgroundWithTitleChange(canvas, animation); | |
1100 } else { | 1090 } else { |
1101 PaintInactiveTabBackground(canvas); | 1091 PaintInactiveTabBackground(canvas); |
1102 } | 1092 } |
1103 | 1093 |
1104 double throb_value = GetThrobValue(); | 1094 double throb_value = GetThrobValue(); |
1105 if (throb_value > 0) { | 1095 if (throb_value > 0) { |
1106 canvas->SaveLayerAlpha(static_cast<int>(throb_value * 0xff), | 1096 canvas->SaveLayerAlpha(static_cast<int>(throb_value * 0xff), |
1107 GetLocalBounds()); | 1097 GetLocalBounds()); |
1108 PaintActiveTabBackground(canvas); | 1098 PaintActiveTabBackground(canvas); |
1109 canvas->Restore(); | 1099 canvas->Restore(); |
1110 } | 1100 } |
1111 } | 1101 } |
1112 } | 1102 } |
1113 | 1103 |
1114 void Tab::PaintInactiveTabBackgroundWithTitleChange( | 1104 void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) { |
1115 gfx::Canvas* canvas, | |
1116 gfx::MultiAnimation* animation) { | |
1117 // Render the inactive tab background. We'll use this for clipping. | 1105 // Render the inactive tab background. We'll use this for clipping. |
1118 gfx::Canvas background_canvas(size(), canvas->image_scale(), false); | 1106 gfx::Canvas background_canvas(size(), canvas->image_scale(), false); |
1119 PaintInactiveTabBackground(&background_canvas); | 1107 PaintInactiveTabBackground(&background_canvas); |
1120 | 1108 |
1121 gfx::ImageSkia background_image(background_canvas.ExtractImageRep()); | 1109 gfx::ImageSkia background_image(background_canvas.ExtractImageRep()); |
1122 | 1110 |
1123 // Draw a radial gradient to hover_canvas. | 1111 // Draw a radial gradient to hover_canvas. |
1124 gfx::Canvas hover_canvas(size(), canvas->image_scale(), false); | 1112 gfx::Canvas hover_canvas(size(), canvas->image_scale(), false); |
1125 int radius = kMiniTitleChangeGradientRadius; | 1113 int radius = kMiniTitleChangeGradientRadius; |
1126 int x0 = width() + radius - kMiniTitleChangeInitialXOffset; | 1114 int x0 = width() + radius - kMiniTitleChangeInitialXOffset; |
1127 int x1 = radius; | 1115 int x1 = radius; |
1128 int x2 = -radius; | 1116 int x2 = -radius; |
1129 int x; | 1117 int x; |
1130 if (animation->current_part_index() == 0) { | 1118 if (mini_title_change_animation_->current_part_index() == 0) { |
1131 x = animation->CurrentValueBetween(x0, x1); | 1119 x = mini_title_change_animation_->CurrentValueBetween(x0, x1); |
1132 } else if (animation->current_part_index() == 1) { | 1120 } else if (mini_title_change_animation_->current_part_index() == 1) { |
1133 x = x1; | 1121 x = x1; |
1134 } else { | 1122 } else { |
1135 x = animation->CurrentValueBetween(x1, x2); | 1123 x = mini_title_change_animation_->CurrentValueBetween(x1, x2); |
1136 } | 1124 } |
1137 SkPoint center_point; | 1125 SkPoint center_point; |
1138 center_point.iset(x, 0); | 1126 center_point.iset(x, 0); |
1139 SkColor colors[2] = { kMiniTitleChangeGradientColor1, | 1127 SkColor colors[2] = { kMiniTitleChangeGradientColor1, |
1140 kMiniTitleChangeGradientColor2 }; | 1128 kMiniTitleChangeGradientColor2 }; |
1141 skia::RefPtr<SkShader> shader = skia::AdoptRef( | 1129 skia::RefPtr<SkShader> shader = skia::AdoptRef( |
1142 SkGradientShader::CreateRadial( | 1130 SkGradientShader::CreateRadial( |
1143 center_point, SkIntToScalar(radius), colors, NULL, 2, | 1131 center_point, SkIntToScalar(radius), colors, NULL, 2, |
1144 SkShader::kClamp_TileMode)); | 1132 SkShader::kClamp_TileMode)); |
1145 SkPaint paint; | 1133 SkPaint paint; |
1146 paint.setShader(shader.get()); | 1134 paint.setShader(shader.get()); |
1147 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2), | 1135 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2), |
1148 paint); | 1136 paint); |
1149 | 1137 |
1150 // Draw the radial gradient clipped to the background into hover_image. | 1138 // Draw the radial gradient clipped to the background into hover_image. |
1151 gfx::ImageSkia hover_image = gfx::ImageSkiaOperations::CreateMaskedImage( | 1139 gfx::ImageSkia hover_image = gfx::ImageSkiaOperations::CreateMaskedImage( |
1152 gfx::ImageSkia(hover_canvas.ExtractImageRep()), background_image); | 1140 gfx::ImageSkia(hover_canvas.ExtractImageRep()), background_image); |
1153 | 1141 |
1154 // Draw the tab background to the canvas. | 1142 // Draw the tab background to the canvas. |
1155 canvas->DrawImageInt(background_image, 0, 0); | 1143 canvas->DrawImageInt(background_image, 0, 0); |
1156 | 1144 |
1157 // And then the gradient on top of that. | 1145 // And then the gradient on top of that. |
1158 if (animation->current_part_index() == 2) { | 1146 if (mini_title_change_animation_->current_part_index() == 2) { |
1159 uint8 alpha = animation->CurrentValueBetween(255, 0); | 1147 uint8 alpha = mini_title_change_animation_->CurrentValueBetween(255, 0); |
1160 canvas->DrawImageInt(hover_image, 0, 0, alpha); | 1148 canvas->DrawImageInt(hover_image, 0, 0, alpha); |
1161 } else { | 1149 } else { |
1162 canvas->DrawImageInt(hover_image, 0, 0); | 1150 canvas->DrawImageInt(hover_image, 0, 0); |
1163 } | 1151 } |
1164 } | 1152 } |
1165 | 1153 |
1166 void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { | 1154 void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { |
1167 int tab_id; | 1155 int tab_id; |
1168 int frame_id; | 1156 int frame_id; |
1169 views::Widget* widget = GetWidget(); | 1157 views::Widget* widget = GetWidget(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 IconCapacity(), data().mini, IsActive(), data().show_icon, | 1450 IconCapacity(), data().mini, IsActive(), data().show_icon, |
1463 animating_media_state_); | 1451 animating_media_state_); |
1464 } | 1452 } |
1465 | 1453 |
1466 bool Tab::ShouldShowCloseBox() const { | 1454 bool Tab::ShouldShowCloseBox() const { |
1467 return chrome::ShouldTabShowCloseButton( | 1455 return chrome::ShouldTabShowCloseButton( |
1468 IconCapacity(), data().mini, IsActive()); | 1456 IconCapacity(), data().mini, IsActive()); |
1469 } | 1457 } |
1470 | 1458 |
1471 double Tab::GetThrobValue() { | 1459 double Tab::GetThrobValue() { |
1472 bool is_selected = IsSelected(); | 1460 const bool is_selected = IsSelected(); |
1473 double min = is_selected ? kSelectedTabOpacity : 0; | 1461 const double min = is_selected ? kSelectedTabOpacity : 0; |
1474 double scale = is_selected ? kSelectedTabThrobScale : 1; | 1462 const double scale = is_selected ? kSelectedTabThrobScale : 1; |
1475 | 1463 |
1476 if (!data().mini) { | 1464 // Showing both the pulse and title change animation at the same time is too |
1477 if (tab_animation_.get() && tab_animation_->is_animating()) | 1465 // much. |
1478 return tab_animation_->GetCurrentValue() * kHoverOpacity * scale + min; | 1466 if (pulse_animation_ && pulse_animation_->is_animating() && |
| 1467 (!mini_title_change_animation_ || |
| 1468 !mini_title_change_animation_->is_animating())) { |
| 1469 return pulse_animation_->GetCurrentValue() * kHoverOpacity * scale + min; |
1479 } | 1470 } |
1480 | 1471 |
1481 if (hover_controller_.ShouldDraw()) { | 1472 if (hover_controller_.ShouldDraw()) { |
1482 return kHoverOpacity * hover_controller_.GetAnimationValue() * scale + | 1473 return kHoverOpacity * hover_controller_.GetAnimationValue() * scale + |
1483 min; | 1474 min; |
1484 } | 1475 } |
1485 | 1476 |
1486 return is_selected ? kSelectedTabOpacity : 0; | 1477 return is_selected ? kSelectedTabOpacity : 0; |
1487 } | 1478 } |
1488 | 1479 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 const gfx::ImageSkia& image) { | 1606 const gfx::ImageSkia& image) { |
1616 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1607 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
1617 ImageCacheEntry entry; | 1608 ImageCacheEntry entry; |
1618 entry.resource_id = resource_id; | 1609 entry.resource_id = resource_id; |
1619 entry.scale_factor = scale_factor; | 1610 entry.scale_factor = scale_factor; |
1620 entry.image = image; | 1611 entry.image = image; |
1621 image_cache_->push_front(entry); | 1612 image_cache_->push_front(entry); |
1622 if (image_cache_->size() > kMaxImageCacheSize) | 1613 if (image_cache_->size() > kMaxImageCacheSize) |
1623 image_cache_->pop_back(); | 1614 image_cache_->pop_back(); |
1624 } | 1615 } |
OLD | NEW |