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 19 matching lines...) Expand all Loading... | |
30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
31 #include "ui/base/theme_provider.h" | 31 #include "ui/base/theme_provider.h" |
32 #include "ui/gfx/animation/animation_container.h" | 32 #include "ui/gfx/animation/animation_container.h" |
33 #include "ui/gfx/animation/multi_animation.h" | 33 #include "ui/gfx/animation/multi_animation.h" |
34 #include "ui/gfx/animation/throb_animation.h" | 34 #include "ui/gfx/animation/throb_animation.h" |
35 #include "ui/gfx/canvas.h" | 35 #include "ui/gfx/canvas.h" |
36 #include "ui/gfx/color_analysis.h" | 36 #include "ui/gfx/color_analysis.h" |
37 #include "ui/gfx/favicon_size.h" | 37 #include "ui/gfx/favicon_size.h" |
38 #include "ui/gfx/geometry/rect_conversions.h" | 38 #include "ui/gfx/geometry/rect_conversions.h" |
39 #include "ui/gfx/image/image_skia_operations.h" | 39 #include "ui/gfx/image/image_skia_operations.h" |
40 #include "ui/gfx/paint_vector_icon.h" | |
40 #include "ui/gfx/path.h" | 41 #include "ui/gfx/path.h" |
41 #include "ui/gfx/skia_util.h" | 42 #include "ui/gfx/skia_util.h" |
43 #include "ui/gfx/vector_icons_public.h" | |
44 #include "ui/native_theme/common_theme.h" | |
45 #include "ui/native_theme/native_theme.h" | |
42 #include "ui/resources/grit/ui_resources.h" | 46 #include "ui/resources/grit/ui_resources.h" |
43 #include "ui/views/border.h" | 47 #include "ui/views/border.h" |
44 #include "ui/views/controls/button/image_button.h" | 48 #include "ui/views/controls/button/image_button.h" |
45 #include "ui/views/controls/label.h" | 49 #include "ui/views/controls/label.h" |
46 #include "ui/views/rect_based_targeting_utils.h" | 50 #include "ui/views/rect_based_targeting_utils.h" |
47 #include "ui/views/view_targeter.h" | 51 #include "ui/views/view_targeter.h" |
48 #include "ui/views/widget/tooltip_manager.h" | 52 #include "ui/views/widget/tooltip_manager.h" |
49 #include "ui/views/widget/widget.h" | 53 #include "ui/views/widget/widget.h" |
50 #include "ui/views/window/non_client_view.h" | 54 #include "ui/views/window/non_client_view.h" |
51 | 55 |
(...skipping 16 matching lines...) Expand all Loading... | |
68 | 72 |
69 // How long the pulse throb takes. | 73 // How long the pulse throb takes. |
70 const int kPulseDurationMs = 200; | 74 const int kPulseDurationMs = 200; |
71 | 75 |
72 // Width of touch tabs. | 76 // Width of touch tabs. |
73 const int kTouchWidth = 120; | 77 const int kTouchWidth = 120; |
74 | 78 |
75 const int kToolbarOverlap = 1; | 79 const int kToolbarOverlap = 1; |
76 const int kExtraLeftPaddingToBalanceCloseButtonPadding = 2; | 80 const int kExtraLeftPaddingToBalanceCloseButtonPadding = 2; |
77 const int kFaviconTitleSpacing = 4; | 81 const int kFaviconTitleSpacing = 4; |
78 const int kAfterTitleSpacing = 3; | 82 const int kAfterTitleSpacing = 4; |
79 const int kCloseButtonRightPaddingOverlap = 3; | 83 const int kCloseButtonRightPaddingOverlap = 2; |
80 const int kStandardTitleWidth = 175; | 84 const int kStandardTitleWidth = 175; |
81 | 85 |
82 // Width of the content inside a pinned tab. | 86 // Width of the content inside a pinned tab. |
83 int kPinnedTabContentWidth = 25; | 87 int kPinnedTabContentWidth = 25; |
84 | 88 |
85 // When a non-pinned tab becomes a pinned tab the width of the tab animates. If | 89 // When a non-pinned tab becomes a pinned tab the width of the tab animates. If |
86 // the width of a pinned tab is at least kPinnedTabExtraWidthToRenderAsNormal | 90 // the width of a pinned tab is at least kPinnedTabExtraWidthToRenderAsNormal |
87 // larger than the desired pinned tab width then the tab is rendered as a normal | 91 // larger than the desired pinned tab width then the tab is rendered as a normal |
88 // tab. This is done to avoid having the title immediately disappear when | 92 // tab. This is done to avoid having the title immediately disappear when |
89 // transitioning a tab from normal to pinned tab. | 93 // transitioning a tab from normal to pinned tab. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 const SkColor kImmersiveInactiveTabColor = SkColorSetRGB(190, 190, 190); | 141 const SkColor kImmersiveInactiveTabColor = SkColorSetRGB(190, 190, 190); |
138 | 142 |
139 // The minimum opacity (out of 1) when a tab (either active or inactive) is | 143 // The minimum opacity (out of 1) when a tab (either active or inactive) is |
140 // throbbing in the immersive mode light strip. | 144 // throbbing in the immersive mode light strip. |
141 const double kImmersiveTabMinThrobOpacity = 0.66; | 145 const double kImmersiveTabMinThrobOpacity = 0.66; |
142 | 146 |
143 // Number of steps in the immersive mode loading animation. | 147 // Number of steps in the immersive mode loading animation. |
144 const int kImmersiveLoadingStepCount = 32; | 148 const int kImmersiveLoadingStepCount = 32; |
145 | 149 |
146 const char kTabCloseButtonName[] = "TabCloseButton"; | 150 const char kTabCloseButtonName[] = "TabCloseButton"; |
151 const int kTabCloseButtonSize = 16; | |
147 | 152 |
148 void DrawIconAtLocation(gfx::Canvas* canvas, | 153 void DrawIconAtLocation(gfx::Canvas* canvas, |
149 const gfx::ImageSkia& image, | 154 const gfx::ImageSkia& image, |
150 int image_offset, | 155 int image_offset, |
151 int dst_x, | 156 int dst_x, |
152 int dst_y, | 157 int dst_y, |
153 int icon_width, | 158 int icon_width, |
154 int icon_height, | 159 int icon_height, |
155 bool filter, | 160 bool filter, |
156 const SkPaint& paint) { | 161 const SkPaint& paint) { |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 immersive_loading_step_(0), | 426 immersive_loading_step_(0), |
422 should_display_crashed_favicon_(false), | 427 should_display_crashed_favicon_(false), |
423 close_button_(NULL), | 428 close_button_(NULL), |
424 media_indicator_button_(NULL), | 429 media_indicator_button_(NULL), |
425 title_(new views::Label()), | 430 title_(new views::Label()), |
426 tab_activated_with_last_tap_down_(false), | 431 tab_activated_with_last_tap_down_(false), |
427 hover_controller_(this), | 432 hover_controller_(this), |
428 showing_icon_(false), | 433 showing_icon_(false), |
429 showing_media_indicator_(false), | 434 showing_media_indicator_(false), |
430 showing_close_button_(false), | 435 showing_close_button_(false), |
431 close_button_color_(0) { | 436 close_button_color_(SK_ColorTRANSPARENT) { |
432 DCHECK(controller); | 437 DCHECK(controller); |
433 InitTabResources(); | 438 InitTabResources(); |
434 | 439 |
435 // So we get don't get enter/exit on children and don't prematurely stop the | 440 // So we get don't get enter/exit on children and don't prematurely stop the |
436 // hover. | 441 // hover. |
437 set_notify_enter_exit_on_child(true); | 442 set_notify_enter_exit_on_child(true); |
438 | 443 |
439 set_id(VIEW_ID_TAB); | 444 set_id(VIEW_ID_TAB); |
440 | 445 |
441 title_->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); | 446 title_->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); |
442 title_->SetElideBehavior(gfx::FADE_TAIL); | 447 title_->SetElideBehavior(gfx::FADE_TAIL); |
443 title_->SetHandlesTooltips(false); | 448 title_->SetHandlesTooltips(false); |
444 title_->SetAutoColorReadabilityEnabled(false); | 449 title_->SetAutoColorReadabilityEnabled(false); |
445 title_->SetText(CoreTabHelper::GetDefaultTitle()); | 450 title_->SetText(CoreTabHelper::GetDefaultTitle()); |
446 AddChildView(title_); | 451 AddChildView(title_); |
447 | 452 |
448 SetEventTargeter( | 453 SetEventTargeter( |
449 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 454 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
450 | 455 |
451 // Add the Close Button. | |
452 close_button_ = new TabCloseButton(this); | 456 close_button_ = new TabCloseButton(this); |
453 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
454 close_button_->SetImage(views::CustomButton::STATE_NORMAL, | |
455 rb.GetImageSkiaNamed(IDR_CLOSE_1)); | |
456 close_button_->SetImage(views::CustomButton::STATE_HOVERED, | |
457 rb.GetImageSkiaNamed(IDR_CLOSE_1_H)); | |
458 close_button_->SetImage(views::CustomButton::STATE_PRESSED, | |
459 rb.GetImageSkiaNamed(IDR_CLOSE_1_P)); | |
460 close_button_->SetAccessibleName( | 457 close_button_->SetAccessibleName( |
461 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 458 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
459 // The normal image is set in various other places because it depends on the | |
460 // current theme and active state. The hovered and pressed images don't | |
461 // depend on the these, so we can set them here. | |
462 const gfx::ImageSkia& hovered = gfx::CreateVectorIcon( | |
463 gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED, kTabCloseButtonSize, | |
464 SkColorSetARGB(0xFF, 0xDB, 0x44, 0x37)); | |
465 const gfx::ImageSkia& pressed = gfx::CreateVectorIcon( | |
466 gfx::VectorIconId::TAB_CLOSE_HOVERED_PRESSED, kTabCloseButtonSize, | |
467 SkColorSetARGB(0xFF, 0xA8, 0x35, 0x2A)); | |
468 close_button_->SetImage(views::CustomButton::STATE_HOVERED, &hovered); | |
469 close_button_->SetImage(views::CustomButton::STATE_PRESSED, &pressed); | |
470 | |
462 // Disable animation so that the red danger sign shows up immediately | 471 // Disable animation so that the red danger sign shows up immediately |
463 // to help avoid mis-clicks. | 472 // to help avoid mis-clicks. |
464 close_button_->SetAnimationDuration(0); | 473 close_button_->SetAnimationDuration(0); |
474 | |
465 AddChildView(close_button_); | 475 AddChildView(close_button_); |
466 | 476 |
467 set_context_menu_controller(this); | 477 set_context_menu_controller(this); |
468 } | 478 } |
469 | 479 |
470 Tab::~Tab() { | 480 Tab::~Tab() { |
471 } | 481 } |
472 | 482 |
473 void Tab::set_animation_container(gfx::AnimationContainer* container) { | 483 void Tab::set_animation_container(gfx::AnimationContainer* container) { |
474 animation_container_ = container; | 484 animation_container_ = container; |
475 hover_controller_.SetAnimationContainer(container); | 485 hover_controller_.SetAnimationContainer(container); |
476 } | 486 } |
477 | 487 |
478 bool Tab::IsActive() const { | 488 bool Tab::IsActive() const { |
479 return controller_->IsActiveTab(this); | 489 return controller_->IsActiveTab(this); |
480 } | 490 } |
481 | 491 |
482 void Tab::ActiveStateChanged() { | 492 void Tab::ActiveStateChanged() { |
483 GetMediaIndicatorButton()->UpdateEnabledForMuteToggle(); | 493 GetMediaIndicatorButton()->UpdateEnabledForMuteToggle(); |
494 SetCloseButtonNormalStateImage(); | |
484 } | 495 } |
485 | 496 |
486 bool Tab::IsSelected() const { | 497 bool Tab::IsSelected() const { |
487 return controller_->IsTabSelected(this); | 498 return controller_->IsTabSelected(this); |
488 } | 499 } |
489 | 500 |
490 void Tab::SetData(const TabRendererData& data) { | 501 void Tab::SetData(const TabRendererData& data) { |
491 DCHECK(GetWidget()); | 502 DCHECK(GetWidget()); |
492 | 503 |
493 if (data_.Equals(data)) | 504 if (data_.Equals(data)) |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
728 if (!intersection.intersect(RectToSkRect(clip))) | 739 if (!intersection.intersect(RectToSkRect(clip))) |
729 return false; | 740 return false; |
730 mask->addRect(intersection); | 741 mask->addRect(intersection); |
731 } | 742 } |
732 return true; | 743 return true; |
733 } | 744 } |
734 | 745 |
735 //////////////////////////////////////////////////////////////////////////////// | 746 //////////////////////////////////////////////////////////////////////////////// |
736 // Tab, views::View overrides: | 747 // Tab, views::View overrides: |
737 | 748 |
749 void Tab::ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) { | |
750 SetCloseButtonNormalStateImage(); | |
Evan Stade
2015/09/18 21:51:18
maybe guard with:
if (details.is_add && details.c
Peter Kasting
2015/09/19 01:20:56
I intentionally didn't do that. Let's say a paren
Evan Stade
2015/09/21 18:49:10
OK, although it seems like if this is a problem it
Peter Kasting
2015/09/23 00:12:34
Most places we guard with this we're not so much w
| |
751 } | |
752 | |
738 void Tab::OnPaint(gfx::Canvas* canvas) { | 753 void Tab::OnPaint(gfx::Canvas* canvas) { |
739 // Don't paint if we're narrower than we can render correctly. (This should | 754 // Don't paint if we're narrower than we can render correctly. (This should |
740 // only happen during animations). | 755 // only happen during animations). |
741 if (width() < GetMinimumUnselectedSize().width() && !data().pinned) | 756 if (width() < GetMinimumUnselectedSize().width() && !data().pinned) |
742 return; | 757 return; |
743 | 758 |
744 gfx::Rect clip; | 759 gfx::Rect clip; |
745 if (!controller_->ShouldPaintTab(this, &clip)) | 760 if (!controller_->ShouldPaintTab(this, &clip)) |
746 return; | 761 return; |
762 | |
763 // If we haven't set the correct close button normal image, we can do so now. | |
764 if (close_button_color_ == SK_ColorTRANSPARENT) | |
765 OnThemeChanged(); | |
766 | |
747 if (!clip.IsEmpty()) { | 767 if (!clip.IsEmpty()) { |
748 canvas->Save(); | 768 canvas->Save(); |
749 canvas->ClipRect(clip); | 769 canvas->ClipRect(clip); |
750 } | 770 } |
751 | 771 |
752 if (controller_->IsImmersiveStyle()) | 772 if (controller_->IsImmersiveStyle()) |
753 PaintImmersiveTab(canvas); | 773 PaintImmersiveTab(canvas); |
754 else | 774 else |
755 PaintTab(canvas); | 775 PaintTab(canvas); |
756 | 776 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
840 rect.set_y(lb.y() - (title_height - rect.height()) / 2); | 860 rect.set_y(lb.y() - (title_height - rect.height()) / 2); |
841 rect.set_height(title_height); | 861 rect.set_height(title_height); |
842 } | 862 } |
843 title_->SetBoundsRect(rect); | 863 title_->SetBoundsRect(rect); |
844 } | 864 } |
845 title_->SetVisible(show_title); | 865 title_->SetVisible(show_title); |
846 } | 866 } |
847 | 867 |
848 void Tab::OnThemeChanged() { | 868 void Tab::OnThemeChanged() { |
849 LoadTabImages(); | 869 LoadTabImages(); |
870 SetCloseButtonNormalStateImage(); | |
850 } | 871 } |
851 | 872 |
852 const char* Tab::GetClassName() const { | 873 const char* Tab::GetClassName() const { |
853 return kViewClassName; | 874 return kViewClassName; |
854 } | 875 } |
855 | 876 |
856 bool Tab::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { | 877 bool Tab::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { |
857 // Note: Anything that affects the tooltip text should be accounted for when | 878 // Note: Anything that affects the tooltip text should be accounted for when |
858 // calling TooltipTextChanged() from Tab::DataChanged(). | 879 // calling TooltipTextChanged() from Tab::DataChanged(). |
859 *tooltip = chrome::AssembleTabTooltipText(data_.title, data_.media_state); | 880 *tooltip = chrome::AssembleTabTooltipText(data_.title, data_.media_state); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1041 StopPulse(); | 1062 StopPulse(); |
1042 } | 1063 } |
1043 | 1064 |
1044 void Tab::PaintTab(gfx::Canvas* canvas) { | 1065 void Tab::PaintTab(gfx::Canvas* canvas) { |
1045 // See if the model changes whether the icons should be painted. | 1066 // See if the model changes whether the icons should be painted. |
1046 const bool show_icon = ShouldShowIcon(); | 1067 const bool show_icon = ShouldShowIcon(); |
1047 const bool show_media_indicator = ShouldShowMediaIndicator(); | 1068 const bool show_media_indicator = ShouldShowMediaIndicator(); |
1048 const bool show_close_button = ShouldShowCloseBox(); | 1069 const bool show_close_button = ShouldShowCloseBox(); |
1049 if (show_icon != showing_icon_ || | 1070 if (show_icon != showing_icon_ || |
1050 show_media_indicator != showing_media_indicator_ || | 1071 show_media_indicator != showing_media_indicator_ || |
1051 show_close_button != showing_close_button_) { | 1072 show_close_button != showing_close_button_) |
1052 Layout(); | 1073 Layout(); |
1053 } | |
1054 | 1074 |
1055 PaintTabBackground(canvas); | 1075 PaintTabBackground(canvas); |
1056 | 1076 |
1057 const SkColor title_color = GetThemeProvider()->GetColor(IsSelected() ? | 1077 const SkColor title_color = GetThemeProvider()->GetColor(IsSelected() ? |
1058 ThemeProperties::COLOR_TAB_TEXT : | 1078 ThemeProperties::COLOR_TAB_TEXT : |
1059 ThemeProperties::COLOR_BACKGROUND_TAB_TEXT); | 1079 ThemeProperties::COLOR_BACKGROUND_TAB_TEXT); |
1060 title_->SetVisible(ShouldRenderAsNormalTab()); | |
1061 title_->SetEnabledColor(title_color); | 1080 title_->SetEnabledColor(title_color); |
1062 | 1081 |
1063 if (show_icon) | 1082 if (show_icon) |
1064 PaintIcon(canvas); | 1083 PaintIcon(canvas); |
1065 | |
1066 // If the close button color has changed, generate a new one. | |
1067 if (!close_button_color_ || title_color != close_button_color_) { | |
1068 close_button_color_ = title_color; | |
1069 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
1070 close_button_->SetBackground(close_button_color_, | |
1071 rb.GetImageSkiaNamed(IDR_CLOSE_1), | |
1072 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK)); | |
1073 } | |
1074 } | 1084 } |
1075 | 1085 |
1076 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) { | 1086 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) { |
1077 // Use transparency for the draw-attention animation. | 1087 // Use transparency for the draw-attention animation. |
1078 int alpha = 255; | 1088 int alpha = 255; |
1079 if (pulse_animation_ && pulse_animation_->is_animating() && !data().pinned) { | 1089 if (pulse_animation_ && pulse_animation_->is_animating() && !data().pinned) { |
1080 alpha = pulse_animation_->CurrentValueBetween( | 1090 alpha = pulse_animation_->CurrentValueBetween( |
1081 255, static_cast<int>(255 * kImmersiveTabMinThrobOpacity)); | 1091 255, static_cast<int>(255 * kImmersiveTabMinThrobOpacity)); |
1082 } | 1092 } |
1083 | 1093 |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1506 | 1516 |
1507 void Tab::StartCrashAnimation() { | 1517 void Tab::StartCrashAnimation() { |
1508 crash_icon_animation_.reset(new FaviconCrashAnimation(this)); | 1518 crash_icon_animation_.reset(new FaviconCrashAnimation(this)); |
1509 crash_icon_animation_->Start(); | 1519 crash_icon_animation_->Start(); |
1510 } | 1520 } |
1511 | 1521 |
1512 bool Tab::IsPerformingCrashAnimation() const { | 1522 bool Tab::IsPerformingCrashAnimation() const { |
1513 return crash_icon_animation_.get() && data_.IsCrashed(); | 1523 return crash_icon_animation_.get() && data_.IsCrashed(); |
1514 } | 1524 } |
1515 | 1525 |
1526 void Tab::SetCloseButtonNormalStateImage() { | |
1527 // The theme provider may be null if we're not currently in a widget | |
1528 // hierarchy. | |
1529 ui::ThemeProvider* theme_provider = GetThemeProvider(); | |
1530 if (!theme_provider) | |
1531 return; | |
1532 | |
1533 const SkColor new_close_button_color = SkColorSetA(theme_provider->GetColor( | |
Evan Stade
2015/09/18 21:51:18
why not use COLOR_TAB_ICON?
Peter Kasting
2015/09/19 01:20:56
Thanks for pointing me at that. Looks like only t
Evan Stade
2015/09/21 18:49:10
sure.
Peter Kasting
2015/09/23 00:12:33
I was worrying about cases like we had in the omni
Evan Stade
2015/09/23 18:16:35
fair enough
| |
1534 IsActive() ? ThemeProperties::COLOR_TAB_TEXT | |
1535 : ThemeProperties::COLOR_BACKGROUND_TAB_TEXT), 0x70); | |
1536 if (close_button_color_ != new_close_button_color) { | |
1537 close_button_color_ = new_close_button_color; | |
1538 const gfx::ImageSkia& normal = gfx::CreateVectorIcon( | |
1539 gfx::VectorIconId::TAB_CLOSE_NORMAL, kTabCloseButtonSize, | |
1540 close_button_color_); | |
1541 close_button_->SetImage(views::CustomButton::STATE_NORMAL, &normal); | |
1542 } | |
1543 } | |
1544 | |
1516 void Tab::ScheduleIconPaint() { | 1545 void Tab::ScheduleIconPaint() { |
1517 gfx::Rect bounds = favicon_bounds_; | 1546 gfx::Rect bounds = favicon_bounds_; |
1518 if (bounds.IsEmpty()) | 1547 if (bounds.IsEmpty()) |
1519 return; | 1548 return; |
1520 | 1549 |
1521 // Extends the area to the bottom when sad_favicon is animating. | 1550 // Extends the area to the bottom when sad_favicon is animating. |
1522 if (IsPerformingCrashAnimation()) | 1551 if (IsPerformingCrashAnimation()) |
1523 bounds.set_height(height() - bounds.y()); | 1552 bounds.set_height(height() - bounds.y()); |
1524 bounds.set_x(GetMirroredXForRect(bounds)); | 1553 bounds.set_x(GetMirroredXForRect(bounds)); |
1525 SchedulePaintInRect(bounds); | 1554 SchedulePaintInRect(bounds); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1669 const gfx::ImageSkia& image) { | 1698 const gfx::ImageSkia& image) { |
1670 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1699 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
1671 ImageCacheEntry entry; | 1700 ImageCacheEntry entry; |
1672 entry.resource_id = resource_id; | 1701 entry.resource_id = resource_id; |
1673 entry.scale_factor = scale_factor; | 1702 entry.scale_factor = scale_factor; |
1674 entry.image = image; | 1703 entry.image = image; |
1675 image_cache_->push_front(entry); | 1704 image_cache_->push_front(entry); |
1676 if (image_cache_->size() > kMaxImageCacheSize) | 1705 if (image_cache_->size() > kMaxImageCacheSize) |
1677 image_cache_->pop_back(); | 1706 image_cache_->pop_back(); |
1678 } | 1707 } |
OLD | NEW |