| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 } | 535 } |
| 536 | 536 |
| 537 TabRendererData::NetworkState old_state = data_.network_state; | 537 TabRendererData::NetworkState old_state = data_.network_state; |
| 538 data_.network_state = state; | 538 data_.network_state = state; |
| 539 AdvanceLoadingAnimation(old_state, state); | 539 AdvanceLoadingAnimation(old_state, state); |
| 540 } | 540 } |
| 541 | 541 |
| 542 void Tab::StartPulse() { | 542 void Tab::StartPulse() { |
| 543 pulse_animation_.reset(new gfx::ThrobAnimation(this)); | 543 pulse_animation_.reset(new gfx::ThrobAnimation(this)); |
| 544 pulse_animation_->SetSlideDuration(kPulseDurationMs); | 544 pulse_animation_->SetSlideDuration(kPulseDurationMs); |
| 545 if (animation_container_) | 545 if (animation_container_.get()) |
| 546 pulse_animation_->SetContainer(animation_container_.get()); | 546 pulse_animation_->SetContainer(animation_container_.get()); |
| 547 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); | 547 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); |
| 548 } | 548 } |
| 549 | 549 |
| 550 void Tab::StopPulse() { | 550 void Tab::StopPulse() { |
| 551 StopAndDeleteAnimation(pulse_animation_.PassAs<gfx::Animation>()); | 551 StopAndDeleteAnimation(pulse_animation_.PassAs<gfx::Animation>()); |
| 552 } | 552 } |
| 553 | 553 |
| 554 void Tab::StartMiniTabTitleAnimation() { | 554 void Tab::StartMiniTabTitleAnimation() { |
| 555 if (!data().mini) | 555 if (!data().mini) |
| 556 return; | 556 return; |
| 557 if (!mini_title_change_animation_) { | 557 if (!mini_title_change_animation_) { |
| 558 gfx::MultiAnimation::Parts parts; | 558 gfx::MultiAnimation::Parts parts; |
| 559 parts.push_back( | 559 parts.push_back( |
| 560 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, | 560 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, |
| 561 gfx::Tween::EASE_OUT)); | 561 gfx::Tween::EASE_OUT)); |
| 562 parts.push_back( | 562 parts.push_back( |
| 563 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, | 563 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, |
| 564 gfx::Tween::ZERO)); | 564 gfx::Tween::ZERO)); |
| 565 parts.push_back( | 565 parts.push_back( |
| 566 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, | 566 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, |
| 567 gfx::Tween::EASE_IN)); | 567 gfx::Tween::EASE_IN)); |
| 568 parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; | 568 parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; |
| 569 parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; | 569 parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; |
| 570 parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; | 570 parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; |
| 571 parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; | 571 parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; |
| 572 base::TimeDelta timeout = | 572 base::TimeDelta timeout = |
| 573 base::TimeDelta::FromMilliseconds(kMiniTitleChangeAnimationIntervalMS); | 573 base::TimeDelta::FromMilliseconds(kMiniTitleChangeAnimationIntervalMS); |
| 574 mini_title_change_animation_.reset(new gfx::MultiAnimation(parts, timeout)); | 574 mini_title_change_animation_.reset(new gfx::MultiAnimation(parts, timeout)); |
| 575 if (animation_container_) | 575 if (animation_container_.get()) |
| 576 mini_title_change_animation_->SetContainer(animation_container_.get()); | 576 mini_title_change_animation_->SetContainer(animation_container_.get()); |
| 577 mini_title_change_animation_->set_delegate(this); | 577 mini_title_change_animation_->set_delegate(this); |
| 578 } | 578 } |
| 579 mini_title_change_animation_->Start(); | 579 mini_title_change_animation_->Start(); |
| 580 } | 580 } |
| 581 | 581 |
| 582 void Tab::StopMiniTabTitleAnimation() { | 582 void Tab::StopMiniTabTitleAnimation() { |
| 583 StopAndDeleteAnimation(mini_title_change_animation_.PassAs<gfx::Animation>()); | 583 StopAndDeleteAnimation(mini_title_change_animation_.PassAs<gfx::Animation>()); |
| 584 } | 584 } |
| 585 | 585 |
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 const gfx::ImageSkia& image) { | 1603 const gfx::ImageSkia& image) { |
| 1604 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1604 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1605 ImageCacheEntry entry; | 1605 ImageCacheEntry entry; |
| 1606 entry.resource_id = resource_id; | 1606 entry.resource_id = resource_id; |
| 1607 entry.scale_factor = scale_factor; | 1607 entry.scale_factor = scale_factor; |
| 1608 entry.image = image; | 1608 entry.image = image; |
| 1609 image_cache_->push_front(entry); | 1609 image_cache_->push_front(entry); |
| 1610 if (image_cache_->size() > kMaxImageCacheSize) | 1610 if (image_cache_->size() > kMaxImageCacheSize) |
| 1611 image_cache_->pop_back(); | 1611 image_cache_->pop_back(); |
| 1612 } | 1612 } |
| OLD | NEW |