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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // switches to them. Don't display animations for these unless they're | 481 // switches to them. Don't display animations for these unless they're |
482 // selected (i.e. in the foreground) -- we won't reload these | 482 // selected (i.e. in the foreground) -- we won't reload these |
483 // automatically since we don't want to get into a crash loop. | 483 // automatically since we don't want to get into a crash loop. |
484 if (IsSelected() || | 484 if (IsSelected() || |
485 data_.crashed_status != base::TERMINATION_STATUS_PROCESS_WAS_KILLED) | 485 data_.crashed_status != base::TERMINATION_STATUS_PROCESS_WAS_KILLED) |
486 StartCrashAnimation(); | 486 StartCrashAnimation(); |
487 #else | 487 #else |
488 StartCrashAnimation(); | 488 StartCrashAnimation(); |
489 #endif | 489 #endif |
490 } | 490 } |
| 491 |
| 492 } else if ((data_.capture_state == TabRendererData::CAPTURE_STATE_NONE) && |
| 493 (old.capture_state != TabRendererData::CAPTURE_STATE_NONE)) { |
| 494 StopRecordingAnimation(); |
| 495 |
| 496 } else if ((data_.capture_state != TabRendererData::CAPTURE_STATE_NONE) && |
| 497 (old.capture_state == TabRendererData::CAPTURE_STATE_NONE)) { |
| 498 StartRecordingAnimation(); |
491 } else { | 499 } else { |
492 if (IsPerformingCrashAnimation()) | 500 if (IsPerformingCrashAnimation()) |
493 StopCrashAnimation(); | 501 StopCrashAnimation(); |
494 ResetCrashedFavicon(); | 502 ResetCrashedFavicon(); |
495 } | 503 } |
496 | 504 |
497 // If the favicon changed, re-compute its dominant color. | 505 // If the favicon changed, re-compute its dominant color. |
498 if (controller() && | 506 if (controller() && |
499 controller()->IsImmersiveStyle() && | 507 controller()->IsImmersiveStyle() && |
500 !data_.favicon.isNull() && | 508 !data_.favicon.isNull() && |
(...skipping 21 matching lines...) Expand all Loading... |
522 // need to advance the animation frame. | 530 // need to advance the animation frame. |
523 return; | 531 return; |
524 } | 532 } |
525 | 533 |
526 TabRendererData::NetworkState old_state = data_.network_state; | 534 TabRendererData::NetworkState old_state = data_.network_state; |
527 data_.network_state = state; | 535 data_.network_state = state; |
528 AdvanceLoadingAnimation(old_state, state); | 536 AdvanceLoadingAnimation(old_state, state); |
529 } | 537 } |
530 | 538 |
531 void Tab::StartPulse() { | 539 void Tab::StartPulse() { |
532 if (!pulse_animation_.get()) { | 540 if (!tab_animation_.get()) { |
533 pulse_animation_.reset(new ui::ThrobAnimation(this)); | 541 tab_animation_.reset(new ui::ThrobAnimation(this)); |
534 pulse_animation_->SetSlideDuration(kPulseDurationMs); | 542 tab_animation_->SetSlideDuration(kPulseDurationMs); |
535 if (animation_container_.get()) | 543 if (animation_container_.get()) |
536 pulse_animation_->SetContainer(animation_container_.get()); | 544 tab_animation_->SetContainer(animation_container_.get()); |
537 } | 545 } |
538 pulse_animation_->Reset(); | 546 tab_animation_->Reset(); |
539 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); | 547 tab_animation_->StartThrobbing(std::numeric_limits<int>::max()); |
540 } | 548 } |
541 | 549 |
542 void Tab::StopPulse() { | 550 void Tab::StopPulse() { |
543 if (!pulse_animation_.get()) | 551 if (!tab_animation_.get()) |
544 return; | 552 return; |
545 | 553 |
546 pulse_animation_->Stop(); // Do stop so we get notified. | 554 tab_animation_->Stop(); // Do stop so we get notified. |
547 pulse_animation_.reset(NULL); | 555 tab_animation_.reset(NULL); |
548 } | 556 } |
549 | 557 |
550 void Tab::StartMiniTabTitleAnimation() { | 558 void Tab::StartMiniTabTitleAnimation() { |
551 if (!mini_title_animation_.get()) { | 559 if (!mini_title_animation_.get()) { |
552 ui::MultiAnimation::Parts parts; | 560 ui::MultiAnimation::Parts parts; |
553 parts.push_back( | 561 parts.push_back( |
554 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, | 562 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, |
555 ui::Tween::EASE_OUT)); | 563 ui::Tween::EASE_OUT)); |
556 parts.push_back( | 564 parts.push_back( |
557 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, | 565 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 int Tab::GetImmersiveHeight() { | 637 int Tab::GetImmersiveHeight() { |
630 return kImmersiveTabHeight; | 638 return kImmersiveTabHeight; |
631 } | 639 } |
632 | 640 |
633 //////////////////////////////////////////////////////////////////////////////// | 641 //////////////////////////////////////////////////////////////////////////////// |
634 // Tab, AnimationDelegate overrides: | 642 // Tab, AnimationDelegate overrides: |
635 | 643 |
636 void Tab::AnimationProgressed(const ui::Animation* animation) { | 644 void Tab::AnimationProgressed(const ui::Animation* animation) { |
637 // Ignore if the pulse animation is being performed on active tab because | 645 // Ignore if the pulse animation is being performed on active tab because |
638 // it repaints the same image. See |Tab::PaintTabBackground()|. | 646 // it repaints the same image. See |Tab::PaintTabBackground()|. |
639 if (animation == pulse_animation_.get() && IsActive()) | 647 if (animation == tab_animation_.get() && IsActive()) |
640 return; | 648 return; |
641 SchedulePaint(); | 649 SchedulePaint(); |
642 } | 650 } |
643 | 651 |
644 void Tab::AnimationCanceled(const ui::Animation* animation) { | 652 void Tab::AnimationCanceled(const ui::Animation* animation) { |
645 SchedulePaint(); | 653 SchedulePaint(); |
646 } | 654 } |
647 | 655 |
648 void Tab::AnimationEnded(const ui::Animation* animation) { | 656 void Tab::AnimationEnded(const ui::Animation* animation) { |
649 SchedulePaint(); | 657 SchedulePaint(); |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 canvas->DrawImageInt(*tab_image->image_r, width() - tab_image->r_width, 0); | 1281 canvas->DrawImageInt(*tab_image->image_r, width() - tab_image->r_width, 0); |
1274 } | 1282 } |
1275 | 1283 |
1276 void Tab::PaintIcon(gfx::Canvas* canvas) { | 1284 void Tab::PaintIcon(gfx::Canvas* canvas) { |
1277 gfx::Rect bounds = GetIconBounds(); | 1285 gfx::Rect bounds = GetIconBounds(); |
1278 if (bounds.IsEmpty()) | 1286 if (bounds.IsEmpty()) |
1279 return; | 1287 return; |
1280 | 1288 |
1281 bounds.set_x(GetMirroredXForRect(bounds)); | 1289 bounds.set_x(GetMirroredXForRect(bounds)); |
1282 | 1290 |
| 1291 // Paint network activity (aka throbber) animation frame. |
1283 if (data().network_state != TabRendererData::NETWORK_STATE_NONE) { | 1292 if (data().network_state != TabRendererData::NETWORK_STATE_NONE) { |
1284 ui::ThemeProvider* tp = GetThemeProvider(); | 1293 ui::ThemeProvider* tp = GetThemeProvider(); |
1285 gfx::ImageSkia frames(*tp->GetImageSkiaNamed( | 1294 gfx::ImageSkia frames(*tp->GetImageSkiaNamed( |
1286 (data().network_state == TabRendererData::NETWORK_STATE_WAITING) ? | 1295 (data().network_state == TabRendererData::NETWORK_STATE_WAITING) ? |
1287 IDR_THROBBER_WAITING : IDR_THROBBER)); | 1296 IDR_THROBBER_WAITING : IDR_THROBBER)); |
1288 | 1297 |
1289 int icon_size = frames.height(); | 1298 int icon_size = frames.height(); |
1290 int image_offset = loading_animation_frame_ * icon_size; | 1299 int image_offset = loading_animation_frame_ * icon_size; |
1291 DrawIconCenter(canvas, frames, image_offset, | 1300 DrawIconCenter(canvas, frames, image_offset, |
1292 icon_size, icon_size, bounds, false, SkPaint()); | 1301 icon_size, icon_size, bounds, false, SkPaint()); |
| 1302 return; |
| 1303 } |
| 1304 |
| 1305 // Paint regular icon and potentially overlays. |
| 1306 canvas->Save(); |
| 1307 canvas->ClipRect(GetLocalBounds()); |
| 1308 if (should_display_crashed_favicon_) { |
| 1309 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 1310 gfx::ImageSkia crashed_favicon(*rb.GetImageSkiaNamed(IDR_SAD_FAVICON)); |
| 1311 bounds.set_y(bounds.y() + favicon_hiding_offset_); |
| 1312 DrawIconCenter(canvas, crashed_favicon, 0, |
| 1313 crashed_favicon.width(), |
| 1314 crashed_favicon.height(), bounds, true, SkPaint()); |
1293 } else { | 1315 } else { |
1294 canvas->Save(); | 1316 if (!data().favicon.isNull()) { |
1295 canvas->ClipRect(GetLocalBounds()); | 1317 if (data().capture_state == TabRendererData::CAPTURE_STATE_PROJECTING) { |
1296 if (should_display_crashed_favicon_) { | 1318 // If projecting, shrink favicon and add projection screen instead. |
1297 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1319 gfx::ImageSkia resized_icon = |
1298 gfx::ImageSkia crashed_favicon(*rb.GetImageSkiaNamed(IDR_SAD_FAVICON)); | 1320 gfx::ImageSkiaOperations::CreateResizedImage( |
1299 bounds.set_y(bounds.y() + favicon_hiding_offset_); | 1321 data().favicon, |
1300 DrawIconCenter(canvas, crashed_favicon, 0, | 1322 skia::ImageOperations::RESIZE_BEST, |
1301 crashed_favicon.width(), | 1323 gfx::Size(data().favicon.width() * |
1302 crashed_favicon.height(), bounds, true, SkPaint()); | 1324 kProjectingFaviconResizeScale, |
1303 } else { | 1325 data().favicon.height() * |
1304 if (!data().favicon.isNull()) { | 1326 kProjectingFaviconResizeScale)); |
1305 if (data().capture_state == TabRendererData::CAPTURE_STATE_PROJECTING) { | |
1306 // If projecting, shrink favicon and add projection screen instead. | |
1307 gfx::ImageSkia resized_icon = | |
1308 gfx::ImageSkiaOperations::CreateResizedImage( | |
1309 data().favicon, | |
1310 skia::ImageOperations::RESIZE_BEST, | |
1311 gfx::Size(data().favicon.width() * | |
1312 kProjectingFaviconResizeScale, | |
1313 data().favicon.height() * | |
1314 kProjectingFaviconResizeScale)); | |
1315 | 1327 |
1316 gfx::Rect resized_bounds(bounds); | 1328 gfx::Rect resized_bounds(bounds); |
1317 // Need to shift it up a bit vertically because the projection screen | 1329 // Need to shift it up a bit vertically because the projection screen |
1318 // is thinner on the top and bottom. | 1330 // is thinner on the top and bottom. |
1319 resized_bounds.set_y(resized_bounds.y() - 1); | 1331 resized_bounds.set_y(resized_bounds.y() - 1); |
1320 | 1332 |
1321 DrawIconCenter(canvas, resized_icon, 0, | 1333 DrawIconCenter(canvas, resized_icon, 0, |
1322 resized_icon.width(), | 1334 resized_icon.width(), |
1323 resized_icon.height(), | 1335 resized_icon.height(), |
1324 resized_bounds, true, SkPaint()); | 1336 resized_bounds, true, SkPaint()); |
1325 | 1337 |
1326 ui::ThemeProvider* tp = GetThemeProvider(); | 1338 ui::ThemeProvider* tp = GetThemeProvider(); |
1327 gfx::ImageSkia projection_screen( | 1339 gfx::ImageSkia projection_screen( |
1328 *tp->GetImageSkiaNamed(IDR_TAB_CAPTURE)); | 1340 *tp->GetImageSkiaNamed(IDR_TAB_CAPTURE)); |
1329 | 1341 |
1330 DrawIconCenter(canvas, projection_screen, 0, | 1342 DrawIconCenter(canvas, projection_screen, 0, |
1331 data().favicon.width(), | 1343 data().favicon.width(), |
1332 data().favicon.height(), | 1344 data().favicon.height(), |
1333 bounds, true, SkPaint()); | 1345 bounds, true, SkPaint()); |
1334 } else { | 1346 } else { |
1335 // TODO(pkasting): Use code in tab_icon_view.cc:PaintIcon() (or switch | 1347 // TODO(pkasting): Use code in tab_icon_view.cc:PaintIcon() (or switch |
1336 // to using that class to render the favicon). | 1348 // to using that class to render the favicon). |
1337 DrawIconCenter(canvas, data().favicon, 0, | 1349 DrawIconCenter(canvas, data().favicon, 0, |
1338 data().favicon.width(), | 1350 data().favicon.width(), |
1339 data().favicon.height(), | 1351 data().favicon.height(), |
1340 bounds, true, SkPaint()); | 1352 bounds, true, SkPaint()); |
1341 } | |
1342 } | 1353 } |
1343 } | 1354 } |
1344 canvas->Restore(); | 1355 } |
| 1356 canvas->Restore(); |
1345 | 1357 |
1346 if (data().capture_state != TabRendererData::CAPTURE_STATE_NONE) { | 1358 // Paint recording or projecting animation overlay. |
1347 if (!recording_animation_.get()) { | 1359 if (data().capture_state != TabRendererData::CAPTURE_STATE_NONE) { |
1348 recording_animation_.reset(new ui::ThrobAnimation(this)); | 1360 SkPaint paint; |
1349 recording_animation_->SetTweenType(ui::Tween::EASE_IN_OUT); | 1361 paint.setAntiAlias(true); |
1350 recording_animation_->SetThrobDuration(kRecordingDurationMs); | 1362 U8CPU alpha = icon_animation_->GetCurrentValue() * 0xff; |
1351 recording_animation_->StartThrobbing(-1); | 1363 paint.setAlpha(alpha); |
1352 } | 1364 ui::ThemeProvider* tp = GetThemeProvider(); |
1353 | 1365 |
1354 SkPaint paint; | 1366 if (data().capture_state == TabRendererData::CAPTURE_STATE_PROJECTING) { |
1355 paint.setAntiAlias(true); | 1367 // If projecting, add projection glow animation. |
1356 U8CPU alpha = recording_animation_->GetCurrentValue() * 0xff; | 1368 gfx::Rect glow_bounds(bounds); |
1357 paint.setAlpha(alpha); | 1369 glow_bounds.set_x(glow_bounds.x() - (32 - 24)); |
1358 ui::ThemeProvider* tp = GetThemeProvider(); | 1370 glow_bounds.set_y(0); |
| 1371 glow_bounds.set_width(glow_bounds.width() * |
| 1372 kProjectingGlowResizeScale); |
| 1373 glow_bounds.set_height(glow_bounds.height() * |
| 1374 kProjectingGlowResizeScale); |
1359 | 1375 |
1360 if (data().capture_state == TabRendererData::CAPTURE_STATE_PROJECTING) { | 1376 gfx::ImageSkia projection_glow( |
1361 // If projecting, add projection glow animation. | 1377 *tp->GetImageSkiaNamed(IDR_TAB_CAPTURE_GLOW)); |
1362 gfx::Rect glow_bounds(bounds); | 1378 DrawIconCenter(canvas, projection_glow, 0, |
1363 glow_bounds.set_x(glow_bounds.x() - (32 - 24)); | 1379 projection_glow.width(), projection_glow.height(), |
1364 glow_bounds.set_y(0); | 1380 glow_bounds, false, paint); |
1365 glow_bounds.set_width(glow_bounds.width() * | 1381 } else if (data().capture_state == |
1366 kProjectingGlowResizeScale); | 1382 TabRendererData::CAPTURE_STATE_RECORDING) { |
1367 glow_bounds.set_height(glow_bounds.height() * | 1383 // If recording, fade the recording icon on top of the favicon. |
1368 kProjectingGlowResizeScale); | 1384 gfx::ImageSkia recording_dot(*tp->GetImageSkiaNamed(IDR_TAB_RECORDING)); |
1369 | 1385 DrawIconCenter(canvas, recording_dot, 0, |
1370 gfx::ImageSkia projection_glow( | 1386 recording_dot.width(), recording_dot.height(), |
1371 *tp->GetImageSkiaNamed(IDR_TAB_CAPTURE_GLOW)); | 1387 bounds, false, paint); |
1372 DrawIconCenter(canvas, projection_glow, 0, | |
1373 projection_glow.width(), projection_glow.height(), | |
1374 glow_bounds, false, paint); | |
1375 } else if (data().capture_state == | |
1376 TabRendererData::CAPTURE_STATE_RECORDING) { | |
1377 // If recording, fade the recording icon on top of the favicon. | |
1378 gfx::ImageSkia recording_dot(*tp->GetImageSkiaNamed(IDR_TAB_RECORDING)); | |
1379 DrawIconCenter(canvas, recording_dot, 0, | |
1380 recording_dot.width(), recording_dot.height(), | |
1381 bounds, false, paint); | |
1382 } else { | |
1383 NOTREACHED(); | |
1384 } | |
1385 } else { | 1388 } else { |
1386 recording_animation_.reset(); | 1389 NOTREACHED(); |
1387 } | 1390 } |
1388 } | 1391 } |
1389 } | 1392 } |
1390 | 1393 |
1391 void Tab::PaintTitle(gfx::Canvas* canvas, SkColor title_color) { | 1394 void Tab::PaintTitle(gfx::Canvas* canvas, SkColor title_color) { |
1392 // Paint the Title. | 1395 // Paint the Title. |
1393 const gfx::Rect& title_bounds = GetTitleBounds(); | 1396 const gfx::Rect& title_bounds = GetTitleBounds(); |
1394 string16 title = data().title; | 1397 string16 title = data().title; |
1395 | 1398 |
1396 if (title.empty()) { | 1399 if (title.empty()) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 bool Tab::ShouldShowCloseBox() const { | 1477 bool Tab::ShouldShowCloseBox() const { |
1475 // The active tab never clips close button. | 1478 // The active tab never clips close button. |
1476 return !data().mini && (IsActive() || IconCapacity() >= 3); | 1479 return !data().mini && (IsActive() || IconCapacity() >= 3); |
1477 } | 1480 } |
1478 | 1481 |
1479 double Tab::GetThrobValue() { | 1482 double Tab::GetThrobValue() { |
1480 bool is_selected = IsSelected(); | 1483 bool is_selected = IsSelected(); |
1481 double min = is_selected ? kSelectedTabOpacity : 0; | 1484 double min = is_selected ? kSelectedTabOpacity : 0; |
1482 double scale = is_selected ? kSelectedTabThrobScale : 1; | 1485 double scale = is_selected ? kSelectedTabThrobScale : 1; |
1483 | 1486 |
1484 if (pulse_animation_.get() && pulse_animation_->is_animating()) | 1487 if (tab_animation_.get() && tab_animation_->is_animating()) |
1485 return pulse_animation_->GetCurrentValue() * kHoverOpacity * scale + min; | 1488 return tab_animation_->GetCurrentValue() * kHoverOpacity * scale + min; |
1486 | 1489 |
1487 if (hover_controller_.ShouldDraw()) { | 1490 if (hover_controller_.ShouldDraw()) { |
1488 return kHoverOpacity * hover_controller_.GetAnimationValue() * scale + | 1491 return kHoverOpacity * hover_controller_.GetAnimationValue() * scale + |
1489 min; | 1492 min; |
1490 } | 1493 } |
1491 | 1494 |
1492 return is_selected ? kSelectedTabOpacity : 0; | 1495 return is_selected ? kSelectedTabOpacity : 0; |
1493 } | 1496 } |
1494 | 1497 |
1495 void Tab::SetFaviconHidingOffset(int offset) { | 1498 void Tab::SetFaviconHidingOffset(int offset) { |
1496 favicon_hiding_offset_ = offset; | 1499 favicon_hiding_offset_ = offset; |
1497 ScheduleIconPaint(); | 1500 ScheduleIconPaint(); |
1498 } | 1501 } |
1499 | 1502 |
1500 void Tab::DisplayCrashedFavicon() { | 1503 void Tab::DisplayCrashedFavicon() { |
1501 should_display_crashed_favicon_ = true; | 1504 should_display_crashed_favicon_ = true; |
1502 } | 1505 } |
1503 | 1506 |
1504 void Tab::ResetCrashedFavicon() { | 1507 void Tab::ResetCrashedFavicon() { |
1505 should_display_crashed_favicon_ = false; | 1508 should_display_crashed_favicon_ = false; |
1506 } | 1509 } |
1507 | 1510 |
1508 void Tab::StartCrashAnimation() { | 1511 void Tab::StartCrashAnimation() { |
1509 if (!crash_animation_.get()) | 1512 icon_animation_.reset(new FaviconCrashAnimation(this)); |
1510 crash_animation_.reset(new FaviconCrashAnimation(this)); | 1513 icon_animation_->Start(); |
1511 crash_animation_->Stop(); | |
1512 crash_animation_->Start(); | |
1513 } | 1514 } |
1514 | 1515 |
1515 void Tab::StopCrashAnimation() { | 1516 void Tab::StopCrashAnimation() { |
1516 if (!crash_animation_.get()) | 1517 if (!icon_animation_.get()) |
1517 return; | 1518 return; |
1518 crash_animation_->Stop(); | 1519 icon_animation_.reset(); |
| 1520 } |
| 1521 |
| 1522 void Tab::StartRecordingAnimation() { |
| 1523 ui::ThrobAnimation* animation = new ui::ThrobAnimation(this); |
| 1524 animation->SetTweenType(ui::Tween::EASE_IN_OUT); |
| 1525 animation->SetThrobDuration(kRecordingDurationMs); |
| 1526 animation->StartThrobbing(-1); |
| 1527 icon_animation_.reset(animation); |
| 1528 } |
| 1529 |
| 1530 void Tab::StopRecordingAnimation() { |
| 1531 if (!icon_animation_.get()) |
| 1532 return; |
| 1533 icon_animation_->Stop(); |
| 1534 icon_animation_.reset(); |
1519 } | 1535 } |
1520 | 1536 |
1521 bool Tab::IsPerformingCrashAnimation() const { | 1537 bool Tab::IsPerformingCrashAnimation() const { |
1522 return crash_animation_.get() && crash_animation_->is_animating(); | 1538 return icon_animation_.get() && data_.IsCrashed(); |
1523 } | 1539 } |
1524 | 1540 |
1525 void Tab::ScheduleIconPaint() { | 1541 void Tab::ScheduleIconPaint() { |
1526 gfx::Rect bounds = GetIconBounds(); | 1542 gfx::Rect bounds = GetIconBounds(); |
1527 if (bounds.IsEmpty()) | 1543 if (bounds.IsEmpty()) |
1528 return; | 1544 return; |
1529 | 1545 |
1530 // Extends the area to the bottom when sad_favicon is | 1546 // Extends the area to the bottom when sad_favicon is |
1531 // animating. | 1547 // animating. |
1532 if (IsPerformingCrashAnimation()) | 1548 if (IsPerformingCrashAnimation()) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 const gfx::ImageSkia& image) { | 1613 const gfx::ImageSkia& image) { |
1598 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1614 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
1599 ImageCacheEntry entry; | 1615 ImageCacheEntry entry; |
1600 entry.resource_id = resource_id; | 1616 entry.resource_id = resource_id; |
1601 entry.scale_factor = scale_factor; | 1617 entry.scale_factor = scale_factor; |
1602 entry.image = image; | 1618 entry.image = image; |
1603 image_cache_->push_front(entry); | 1619 image_cache_->push_front(entry); |
1604 if (image_cache_->size() > kMaxImageCacheSize) | 1620 if (image_cache_->size() > kMaxImageCacheSize) |
1605 image_cache_->pop_back(); | 1621 image_cache_->pop_back(); |
1606 } | 1622 } |
OLD | NEW |