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 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/debug/alias.h" | 12 #include "base/debug/alias.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/themes/theme_properties.h" | 16 #include "chrome/browser/themes/theme_properties.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/layout_constants.h" | 18 #include "chrome/browser/ui/layout_constants.h" |
| 19 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 19 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 20 #include "chrome/browser/ui/tabs/tab_utils.h" | 20 #include "chrome/browser/ui/tabs/tab_utils.h" |
| 21 #include "chrome/browser/ui/view_ids.h" | 21 #include "chrome/browser/ui/view_ids.h" |
| 22 #include "chrome/browser/ui/views/tabs/alert_indicator_button.h" | 22 #include "chrome/browser/ui/views/tabs/alert_indicator_button.h" |
| 23 #include "chrome/browser/ui/views/tabs/tab_controller.h" | 23 #include "chrome/browser/ui/views/tabs/tab_controller.h" |
| 24 #include "chrome/browser/ui/views/touch_uma/touch_uma.h" | 24 #include "chrome/browser/ui/views/touch_uma/touch_uma.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/url_constants.h" | |
| 26 #include "chrome/grit/generated_resources.h" | 27 #include "chrome/grit/generated_resources.h" |
| 27 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
| 29 #include "content/public/common/url_constants.h" | |
| 28 #include "grit/components_scaled_resources.h" | 30 #include "grit/components_scaled_resources.h" |
| 29 #include "grit/components_strings.h" | 31 #include "grit/components_strings.h" |
| 30 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
| 31 #include "third_party/skia/include/effects/SkGradientShader.h" | 33 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 32 #include "third_party/skia/include/pathops/SkPathOps.h" | 34 #include "third_party/skia/include/pathops/SkPathOps.h" |
| 33 #include "ui/accessibility/ax_view_state.h" | 35 #include "ui/accessibility/ax_view_state.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/base/material_design/material_design_controller.h" | 37 #include "ui/base/material_design/material_design_controller.h" |
| 36 #include "ui/base/models/list_selection_model.h" | 38 #include "ui/base/models/list_selection_model.h" |
| 37 #include "ui/base/resource/resource_bundle.h" | 39 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 const SkColor colors[2] = { color, SkColorSetA(color, 0) }; | 132 const SkColor colors[2] = { color, SkColorSetA(color, 0) }; |
| 131 SkPaint paint; | 133 SkPaint paint; |
| 132 paint.setAntiAlias(true); | 134 paint.setAntiAlias(true); |
| 133 paint.setShader(SkGradientShader::MakeRadial(p, radius, colors, nullptr, 2, | 135 paint.setShader(SkGradientShader::MakeRadial(p, radius, colors, nullptr, 2, |
| 134 SkShader::kClamp_TileMode)); | 136 SkShader::kClamp_TileMode)); |
| 135 canvas->sk_canvas()->drawRect( | 137 canvas->sk_canvas()->drawRect( |
| 136 SkRect::MakeXYWH(p.x() - radius, p.y() - radius, radius * 2, radius * 2), | 138 SkRect::MakeXYWH(p.x() - radius, p.y() - radius, radius * 2, radius * 2), |
| 137 paint); | 139 paint); |
| 138 } | 140 } |
| 139 | 141 |
| 142 // Returns whether the favicon for the given URL should be colored according to | |
| 143 // the browser theme. | |
| 144 bool ShouldThemifyFaviconForUrl(const GURL& url) { | |
| 145 return url.SchemeIs(content::kChromeUIScheme) && | |
| 146 url.host() != chrome::kChromeUIHelpHost && | |
| 147 url.host() != chrome::kChromeUIUberHost; | |
|
Evan Stade
2016/06/30 15:39:45
note this slight inconvenience --- two chrome:// p
Evan Stade
2016/06/30 15:40:44
Also, you may wonder why this isn't necessary for
| |
| 148 } | |
| 149 | |
| 140 } // namespace | 150 } // namespace |
| 141 | 151 |
| 142 //////////////////////////////////////////////////////////////////////////////// | 152 //////////////////////////////////////////////////////////////////////////////// |
| 143 // FaviconCrashAnimation | 153 // FaviconCrashAnimation |
| 144 // | 154 // |
| 145 // A custom animation subclass to manage the favicon crash animation. | 155 // A custom animation subclass to manage the favicon crash animation. |
| 146 class Tab::FaviconCrashAnimation : public gfx::LinearAnimation, | 156 class Tab::FaviconCrashAnimation : public gfx::LinearAnimation, |
| 147 public gfx::AnimationDelegate { | 157 public gfx::AnimationDelegate { |
| 148 public: | 158 public: |
| 149 explicit FaviconCrashAnimation(Tab* target) | 159 explicit FaviconCrashAnimation(Tab* target) |
| 150 : gfx::LinearAnimation(1000, 25, this), | 160 : gfx::LinearAnimation(1000, 25, this), |
| 151 target_(target) { | 161 target_(target) { |
| 152 } | 162 } |
| 153 ~FaviconCrashAnimation() override {} | 163 ~FaviconCrashAnimation() override {} |
| 154 | 164 |
| 155 // gfx::Animation overrides: | 165 // gfx::Animation overrides: |
| 156 void AnimateToState(double state) override { | 166 void AnimateToState(double state) override { |
| 157 const double kHidingOffset = | 167 const double kHidingOffset = |
| 158 Tab::GetMinimumInactiveSize().height() - GetLayoutInsets(TAB).height(); | 168 Tab::GetMinimumInactiveSize().height() - GetLayoutInsets(TAB).height(); |
| 159 | 169 |
| 160 if (state < .5) { | 170 if (state < .5) { |
| 161 // Animate the normal icon down. | 171 // Animate the normal icon down. |
| 162 target_->SetFaviconHidingOffset( | 172 target_->SetFaviconHidingOffset( |
| 163 static_cast<int>(floor(kHidingOffset * 2.0 * state))); | 173 static_cast<int>(floor(kHidingOffset * 2.0 * state))); |
| 164 } else { | 174 } else { |
| 165 // Animate the crashed icon up. | 175 // Animate the crashed icon up. |
| 166 target_->set_should_display_crashed_favicon(); | 176 target_->SetShouldDisplayCrashedFavicon(true); |
| 167 target_->SetFaviconHidingOffset( | 177 target_->SetFaviconHidingOffset( |
| 168 static_cast<int>( | 178 static_cast<int>( |
| 169 floor(kHidingOffset - ((state - .5) * 2.0 * kHidingOffset)))); | 179 floor(kHidingOffset - ((state - .5) * 2.0 * kHidingOffset)))); |
| 170 } | 180 } |
| 171 } | 181 } |
| 172 | 182 |
| 173 private: | 183 private: |
| 174 Tab* target_; | 184 Tab* target_; |
| 175 | 185 |
| 176 DISALLOW_COPY_AND_ASSIGN(FaviconCrashAnimation); | 186 DISALLOW_COPY_AND_ASSIGN(FaviconCrashAnimation); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 599 title = data_.loading ? | 609 title = data_.loading ? |
| 600 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : | 610 l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : |
| 601 CoreTabHelper::GetDefaultTitle(); | 611 CoreTabHelper::GetDefaultTitle(); |
| 602 } else { | 612 } else { |
| 603 Browser::FormatTitleForDisplay(&title); | 613 Browser::FormatTitleForDisplay(&title); |
| 604 } | 614 } |
| 605 title_->SetText(title); | 615 title_->SetText(title); |
| 606 | 616 |
| 607 if (!data_.IsCrashed()) { | 617 if (!data_.IsCrashed()) { |
| 608 crash_icon_animation_->Stop(); | 618 crash_icon_animation_->Stop(); |
| 609 should_display_crashed_favicon_ = false; | 619 SetShouldDisplayCrashedFavicon(false); |
| 610 favicon_hiding_offset_ = 0; | 620 favicon_hiding_offset_ = 0; |
| 611 } else if (!should_display_crashed_favicon_ && | 621 } else if (!should_display_crashed_favicon_ && |
| 612 !crash_icon_animation_->is_animating()) { | 622 !crash_icon_animation_->is_animating()) { |
| 613 data_.alert_state = TabAlertState::NONE; | 623 data_.alert_state = TabAlertState::NONE; |
| 614 crash_icon_animation_->Start(); | 624 crash_icon_animation_->Start(); |
| 615 } | 625 } |
| 616 | 626 |
| 617 if (data_.alert_state != old.alert_state) | 627 if (data_.alert_state != old.alert_state) |
| 618 alert_indicator_button_->TransitionToAlertState(data_.alert_state); | 628 alert_indicator_button_->TransitionToAlertState(data_.alert_state); |
| 619 | 629 |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 971 // provided vertical space. | 981 // provided vertical space. |
| 972 title_->SetBoundsRect( | 982 title_->SetBoundsRect( |
| 973 gfx::Rect(title_left, lb.y(), std::max(title_width, 0), lb.height())); | 983 gfx::Rect(title_left, lb.y(), std::max(title_width, 0), lb.height())); |
| 974 } | 984 } |
| 975 title_->SetVisible(show_title); | 985 title_->SetVisible(show_title); |
| 976 } | 986 } |
| 977 | 987 |
| 978 void Tab::OnThemeChanged() { | 988 void Tab::OnThemeChanged() { |
| 979 LoadTabImages(); | 989 LoadTabImages(); |
| 980 OnButtonColorMaybeChanged(); | 990 OnButtonColorMaybeChanged(); |
| 991 favicon_ = gfx::ImageSkia(); | |
| 981 } | 992 } |
| 982 | 993 |
| 983 const char* Tab::GetClassName() const { | 994 const char* Tab::GetClassName() const { |
| 984 return kViewClassName; | 995 return kViewClassName; |
| 985 } | 996 } |
| 986 | 997 |
| 987 bool Tab::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { | 998 bool Tab::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { |
| 988 // Note: Anything that affects the tooltip text should be accounted for when | 999 // Note: Anything that affects the tooltip text should be accounted for when |
| 989 // calling TooltipTextChanged() from Tab::DataChanged(). | 1000 // calling TooltipTextChanged() from Tab::DataChanged(). |
| 990 *tooltip = chrome::AssembleTabTooltipText(data_.title, data_.alert_state); | 1001 *tooltip = chrome::AssembleTabTooltipText(data_.title, data_.alert_state); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1153 const int ideal_delta = width() - GetPinnedWidth(); | 1164 const int ideal_delta = width() - GetPinnedWidth(); |
| 1154 const int ideal_x = (GetPinnedWidth() - bounds->width()) / 2; | 1165 const int ideal_x = (GetPinnedWidth() - bounds->width()) / 2; |
| 1155 bounds->set_x( | 1166 bounds->set_x( |
| 1156 bounds->x() + static_cast<int>( | 1167 bounds->x() + static_cast<int>( |
| 1157 (1 - static_cast<float>(ideal_delta) / | 1168 (1 - static_cast<float>(ideal_delta) / |
| 1158 static_cast<float>(kPinnedTabExtraWidthToRenderAsNormal)) * | 1169 static_cast<float>(kPinnedTabExtraWidthToRenderAsNormal)) * |
| 1159 (ideal_x - bounds->x()))); | 1170 (ideal_x - bounds->x()))); |
| 1160 } | 1171 } |
| 1161 | 1172 |
| 1162 void Tab::DataChanged(const TabRendererData& old) { | 1173 void Tab::DataChanged(const TabRendererData& old) { |
| 1174 // We may overzealously reset the favicon cache here but this check eliminates | |
| 1175 // at least some unnecessary re-computations and fixes the behavior of | |
| 1176 // about:crash. | |
| 1177 if (!old.favicon.BackedBySameObjectAs(data().favicon)) | |
| 1178 favicon_ = gfx::ImageSkia(); | |
| 1179 | |
| 1163 if (data().alert_state != old.alert_state || data().title != old.title) | 1180 if (data().alert_state != old.alert_state || data().title != old.title) |
| 1164 TooltipTextChanged(); | 1181 TooltipTextChanged(); |
| 1165 | 1182 |
| 1166 if (data().blocked == old.blocked) | 1183 if (data().blocked == old.blocked) |
| 1167 return; | 1184 return; |
| 1168 | 1185 |
| 1169 if (data().blocked) | 1186 if (data().blocked) |
| 1170 StartPulse(); | 1187 StartPulse(); |
| 1171 else | 1188 else |
| 1172 StopPulse(); | 1189 StopPulse(); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1412 // by incrementing by the top padding, since it's a simple rectangle. | 1429 // by incrementing by the top padding, since it's a simple rectangle. |
| 1413 canvas->TileImageInt(*fill_image, x_offset + mask_images_.l_width, | 1430 canvas->TileImageInt(*fill_image, x_offset + mask_images_.l_width, |
| 1414 y_offset + tab_insets.top(), mask_images_.l_width, | 1431 y_offset + tab_insets.top(), mask_images_.l_width, |
| 1415 tab_insets.top(), | 1432 tab_insets.top(), |
| 1416 width() - mask_images_.l_width - mask_images_.r_width, | 1433 width() - mask_images_.l_width - mask_images_.r_width, |
| 1417 height() - tab_insets.top() - toolbar_overlap); | 1434 height() - tab_insets.top() - toolbar_overlap); |
| 1418 } | 1435 } |
| 1419 | 1436 |
| 1420 void Tab::PaintPinnedTabTitleChangedIndicatorAndIcon( | 1437 void Tab::PaintPinnedTabTitleChangedIndicatorAndIcon( |
| 1421 gfx::Canvas* canvas, | 1438 gfx::Canvas* canvas, |
| 1422 const gfx::ImageSkia& favicon, | |
| 1423 const gfx::Rect& favicon_draw_bounds) { | 1439 const gfx::Rect& favicon_draw_bounds) { |
| 1424 // The pinned tab title changed indicator consists of two parts: | 1440 // The pinned tab title changed indicator consists of two parts: |
| 1425 // . a clear (totally transparent) part over the bottom right (or left in rtl) | 1441 // . a clear (totally transparent) part over the bottom right (or left in rtl) |
| 1426 // of the favicon. This is done by drawing the favicon to a canvas, then | 1442 // of the favicon. This is done by drawing the favicon to a canvas, then |
| 1427 // drawing the clear part on top of the favicon. | 1443 // drawing the clear part on top of the favicon. |
| 1428 // . a circle in the bottom right (or left in rtl) of the favicon. | 1444 // . a circle in the bottom right (or left in rtl) of the favicon. |
| 1429 if (!favicon.isNull()) { | 1445 if (!favicon_.isNull()) { |
| 1430 const float kIndicatorCropRadius = 4.5; | 1446 const float kIndicatorCropRadius = 4.5; |
| 1431 gfx::Canvas icon_canvas(gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize), | 1447 gfx::Canvas icon_canvas(gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize), |
| 1432 canvas->image_scale(), false); | 1448 canvas->image_scale(), false); |
| 1433 icon_canvas.DrawImageInt(favicon, 0, 0); | 1449 icon_canvas.DrawImageInt(favicon_, 0, 0); |
| 1434 SkPaint clear_paint; | 1450 SkPaint clear_paint; |
| 1435 clear_paint.setAntiAlias(true); | 1451 clear_paint.setAntiAlias(true); |
| 1436 clear_paint.setXfermodeMode(SkXfermode::kClear_Mode); | 1452 clear_paint.setXfermodeMode(SkXfermode::kClear_Mode); |
| 1437 const int circle_x = base::i18n::IsRTL() ? 0 : gfx::kFaviconSize; | 1453 const int circle_x = base::i18n::IsRTL() ? 0 : gfx::kFaviconSize; |
| 1438 icon_canvas.DrawCircle(gfx::PointF(circle_x, gfx::kFaviconSize), | 1454 icon_canvas.DrawCircle(gfx::PointF(circle_x, gfx::kFaviconSize), |
| 1439 kIndicatorCropRadius, clear_paint); | 1455 kIndicatorCropRadius, clear_paint); |
| 1440 canvas->DrawImageInt(gfx::ImageSkia(icon_canvas.ExtractImageRep()), 0, 0, | 1456 canvas->DrawImageInt(gfx::ImageSkia(icon_canvas.ExtractImageRep()), 0, 0, |
| 1441 favicon_draw_bounds.width(), | 1457 favicon_draw_bounds.width(), |
| 1442 favicon_draw_bounds.height(), favicon_draw_bounds.x(), | 1458 favicon_draw_bounds.height(), favicon_draw_bounds.x(), |
| 1443 favicon_draw_bounds.y(), favicon_draw_bounds.width(), | 1459 favicon_draw_bounds.y(), favicon_draw_bounds.width(), |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1459 } | 1475 } |
| 1460 | 1476 |
| 1461 void Tab::PaintIcon(gfx::Canvas* canvas) { | 1477 void Tab::PaintIcon(gfx::Canvas* canvas) { |
| 1462 gfx::Rect bounds = favicon_bounds_; | 1478 gfx::Rect bounds = favicon_bounds_; |
| 1463 bounds.set_x(GetMirroredXForRect(bounds)); | 1479 bounds.set_x(GetMirroredXForRect(bounds)); |
| 1464 bounds.Offset(0, favicon_hiding_offset_); | 1480 bounds.Offset(0, favicon_hiding_offset_); |
| 1465 bounds.Intersect(GetContentsBounds()); | 1481 bounds.Intersect(GetContentsBounds()); |
| 1466 if (bounds.IsEmpty()) | 1482 if (bounds.IsEmpty()) |
| 1467 return; | 1483 return; |
| 1468 | 1484 |
| 1469 if (data().network_state != TabRendererData::NETWORK_STATE_NONE) { | 1485 // Throbber will do its own painting. |
| 1470 // Throbber will do its own painting. | 1486 if (data().network_state != TabRendererData::NETWORK_STATE_NONE) |
| 1471 return; | 1487 return; |
| 1488 | |
| 1489 // Ensure that |favicon_| is created. | |
| 1490 if (favicon_.isNull()) { | |
| 1491 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | |
| 1492 favicon_ = should_display_crashed_favicon_ | |
| 1493 ? *rb->GetImageSkiaNamed(IDR_CRASH_SAD_FAVICON) | |
| 1494 : data().favicon; | |
| 1495 // Themify the icon if it's a chrome:// page or if it's the sadtab favicon. | |
| 1496 // This ensures chrome:// pages are visible over the tab background. This is | |
| 1497 // similar to code in the bookmarks bar. | |
| 1498 if (!favicon_.isNull() && | |
| 1499 (should_display_crashed_favicon_ || | |
| 1500 favicon_.BackedBySameObjectAs( | |
| 1501 *rb->GetImageSkiaNamed(IDR_DEFAULT_FAVICON)) || | |
| 1502 ShouldThemifyFaviconForUrl(data().url))) { | |
| 1503 favicon_ = gfx::ImageSkiaOperations::CreateHSLShiftedImage( | |
| 1504 favicon_, GetThemeProvider()->GetTint(ThemeProperties::TINT_BUTTONS)); | |
| 1505 } | |
| 1472 } | 1506 } |
| 1473 const gfx::ImageSkia& favicon = | |
| 1474 should_display_crashed_favicon_ | |
| 1475 ? *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | |
| 1476 IDR_CRASH_SAD_FAVICON) | |
| 1477 : data().favicon; | |
| 1478 | 1507 |
| 1479 if (showing_pinned_tab_title_changed_indicator_ && | 1508 if (showing_pinned_tab_title_changed_indicator_ && |
| 1480 !should_display_crashed_favicon_) { | 1509 !should_display_crashed_favicon_) { |
| 1481 PaintPinnedTabTitleChangedIndicatorAndIcon(canvas, favicon, bounds); | 1510 PaintPinnedTabTitleChangedIndicatorAndIcon(canvas, bounds); |
| 1482 } else if (!favicon.isNull()) { | 1511 } else if (!favicon_.isNull()) { |
| 1483 canvas->DrawImageInt(favicon, 0, 0, bounds.width(), bounds.height(), | 1512 canvas->DrawImageInt(favicon_, 0, 0, bounds.width(), bounds.height(), |
| 1484 bounds.x(), bounds.y(), bounds.width(), | 1513 bounds.x(), bounds.y(), bounds.width(), |
| 1485 bounds.height(), false); | 1514 bounds.height(), false); |
| 1486 } | 1515 } |
| 1487 } | 1516 } |
| 1488 | 1517 |
| 1489 void Tab::AdvanceLoadingAnimation() { | 1518 void Tab::AdvanceLoadingAnimation() { |
| 1490 const TabRendererData::NetworkState state = data().network_state; | 1519 const TabRendererData::NetworkState state = data().network_state; |
| 1491 if (controller_->IsImmersiveStyle()) { | 1520 if (controller_->IsImmersiveStyle()) { |
| 1492 throbber_->SetVisible(false); | 1521 throbber_->SetVisible(false); |
| 1493 if (state == TabRendererData::NETWORK_STATE_WAITING) { | 1522 if (state == TabRendererData::NETWORK_STATE_WAITING) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1587 const double offset = | 1616 const double offset = |
| 1588 is_selected ? (kSelectedTabThrobScale * kHoverOpacity) : kHoverOpacity; | 1617 is_selected ? (kSelectedTabThrobScale * kHoverOpacity) : kHoverOpacity; |
| 1589 | 1618 |
| 1590 if (pulse_animation_->is_animating()) | 1619 if (pulse_animation_->is_animating()) |
| 1591 val += pulse_animation_->GetCurrentValue() * offset; | 1620 val += pulse_animation_->GetCurrentValue() * offset; |
| 1592 else if (hover_controller_.ShouldDraw()) | 1621 else if (hover_controller_.ShouldDraw()) |
| 1593 val += hover_controller_.GetAnimationValue() * offset; | 1622 val += hover_controller_.GetAnimationValue() * offset; |
| 1594 return val; | 1623 return val; |
| 1595 } | 1624 } |
| 1596 | 1625 |
| 1626 void Tab::SetShouldDisplayCrashedFavicon(bool value) { | |
| 1627 if (value == should_display_crashed_favicon_) | |
| 1628 return; | |
| 1629 | |
| 1630 should_display_crashed_favicon_ = value; | |
| 1631 favicon_ = gfx::ImageSkia(); | |
| 1632 } | |
| 1633 | |
| 1597 void Tab::SetFaviconHidingOffset(int offset) { | 1634 void Tab::SetFaviconHidingOffset(int offset) { |
| 1598 favicon_hiding_offset_ = offset; | 1635 favicon_hiding_offset_ = offset; |
| 1599 ScheduleIconPaint(); | 1636 ScheduleIconPaint(); |
| 1600 } | 1637 } |
| 1601 | 1638 |
| 1602 void Tab::OnButtonColorMaybeChanged() { | 1639 void Tab::OnButtonColorMaybeChanged() { |
| 1603 // The theme provider may be null if we're not currently in a widget | 1640 // The theme provider may be null if we're not currently in a widget |
| 1604 // hierarchy. | 1641 // hierarchy. |
| 1605 const ui::ThemeProvider* theme_provider = GetThemeProvider(); | 1642 const ui::ThemeProvider* theme_provider = GetThemeProvider(); |
| 1606 if (!theme_provider) | 1643 if (!theme_provider) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1741 inactive_images_.image_c = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_CENTER); | 1778 inactive_images_.image_c = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_CENTER); |
| 1742 inactive_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_RIGHT); | 1779 inactive_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_RIGHT); |
| 1743 inactive_images_.l_width = inactive_images_.image_l->width(); | 1780 inactive_images_.l_width = inactive_images_.image_l->width(); |
| 1744 inactive_images_.r_width = inactive_images_.image_r->width(); | 1781 inactive_images_.r_width = inactive_images_.image_r->width(); |
| 1745 | 1782 |
| 1746 mask_images_.image_l = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_LEFT); | 1783 mask_images_.image_l = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_LEFT); |
| 1747 mask_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_RIGHT); | 1784 mask_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_RIGHT); |
| 1748 mask_images_.l_width = mask_images_.image_l->width(); | 1785 mask_images_.l_width = mask_images_.image_l->width(); |
| 1749 mask_images_.r_width = mask_images_.image_r->width(); | 1786 mask_images_.r_width = mask_images_.image_r->width(); |
| 1750 } | 1787 } |
| OLD | NEW |