| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 } else { | 511 } else { |
| 512 if (IsPerformingCrashAnimation()) | 512 if (IsPerformingCrashAnimation()) |
| 513 StopCrashAnimation(); | 513 StopCrashAnimation(); |
| 514 ResetCrashedFavicon(); | 514 ResetCrashedFavicon(); |
| 515 } | 515 } |
| 516 | 516 |
| 517 if (data_.media_state != old.media_state) | 517 if (data_.media_state != old.media_state) |
| 518 GetMediaIndicatorButton()->TransitionToMediaState(data_.media_state); | 518 GetMediaIndicatorButton()->TransitionToMediaState(data_.media_state); |
| 519 | 519 |
| 520 if (old.mini != data_.mini) { | 520 if (old.mini != data_.mini) { |
| 521 StopAndDeleteAnimation( | 521 StopAndDeleteAnimation(mini_title_change_animation_.Pass()); |
| 522 mini_title_change_animation_.PassAs<gfx::Animation>()); | |
| 523 } | 522 } |
| 524 | 523 |
| 525 DataChanged(old); | 524 DataChanged(old); |
| 526 | 525 |
| 527 Layout(); | 526 Layout(); |
| 528 SchedulePaint(); | 527 SchedulePaint(); |
| 529 } | 528 } |
| 530 | 529 |
| 531 void Tab::UpdateLoadingAnimation(TabRendererData::NetworkState state) { | 530 void Tab::UpdateLoadingAnimation(TabRendererData::NetworkState state) { |
| 532 if (state == data_.network_state && | 531 if (state == data_.network_state && |
| (...skipping 10 matching lines...) Expand all Loading... |
| 543 | 542 |
| 544 void Tab::StartPulse() { | 543 void Tab::StartPulse() { |
| 545 pulse_animation_.reset(new gfx::ThrobAnimation(this)); | 544 pulse_animation_.reset(new gfx::ThrobAnimation(this)); |
| 546 pulse_animation_->SetSlideDuration(kPulseDurationMs); | 545 pulse_animation_->SetSlideDuration(kPulseDurationMs); |
| 547 if (animation_container_.get()) | 546 if (animation_container_.get()) |
| 548 pulse_animation_->SetContainer(animation_container_.get()); | 547 pulse_animation_->SetContainer(animation_container_.get()); |
| 549 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); | 548 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); |
| 550 } | 549 } |
| 551 | 550 |
| 552 void Tab::StopPulse() { | 551 void Tab::StopPulse() { |
| 553 StopAndDeleteAnimation(pulse_animation_.PassAs<gfx::Animation>()); | 552 StopAndDeleteAnimation(pulse_animation_.Pass()); |
| 554 } | 553 } |
| 555 | 554 |
| 556 void Tab::StartMiniTabTitleAnimation() { | 555 void Tab::StartMiniTabTitleAnimation() { |
| 557 if (!data().mini) | 556 if (!data().mini) |
| 558 return; | 557 return; |
| 559 if (!mini_title_change_animation_) { | 558 if (!mini_title_change_animation_) { |
| 560 gfx::MultiAnimation::Parts parts; | 559 gfx::MultiAnimation::Parts parts; |
| 561 parts.push_back( | 560 parts.push_back( |
| 562 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, | 561 gfx::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, |
| 563 gfx::Tween::EASE_OUT)); | 562 gfx::Tween::EASE_OUT)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 575 base::TimeDelta::FromMilliseconds(kMiniTitleChangeAnimationIntervalMS); | 574 base::TimeDelta::FromMilliseconds(kMiniTitleChangeAnimationIntervalMS); |
| 576 mini_title_change_animation_.reset(new gfx::MultiAnimation(parts, timeout)); | 575 mini_title_change_animation_.reset(new gfx::MultiAnimation(parts, timeout)); |
| 577 if (animation_container_.get()) | 576 if (animation_container_.get()) |
| 578 mini_title_change_animation_->SetContainer(animation_container_.get()); | 577 mini_title_change_animation_->SetContainer(animation_container_.get()); |
| 579 mini_title_change_animation_->set_delegate(this); | 578 mini_title_change_animation_->set_delegate(this); |
| 580 } | 579 } |
| 581 mini_title_change_animation_->Start(); | 580 mini_title_change_animation_->Start(); |
| 582 } | 581 } |
| 583 | 582 |
| 584 void Tab::StopMiniTabTitleAnimation() { | 583 void Tab::StopMiniTabTitleAnimation() { |
| 585 StopAndDeleteAnimation(mini_title_change_animation_.PassAs<gfx::Animation>()); | 584 StopAndDeleteAnimation(mini_title_change_animation_.Pass()); |
| 586 } | 585 } |
| 587 | 586 |
| 588 // static | 587 // static |
| 589 gfx::Size Tab::GetBasicMinimumUnselectedSize() { | 588 gfx::Size Tab::GetBasicMinimumUnselectedSize() { |
| 590 InitTabResources(); | 589 InitTabResources(); |
| 591 | 590 |
| 592 gfx::Size minimum_size; | 591 gfx::Size minimum_size; |
| 593 minimum_size.set_width(kLeftPadding + kRightPadding); | 592 minimum_size.set_width(kLeftPadding + kRightPadding); |
| 594 // Since we use image images, the real minimum height of the image is | 593 // Since we use image images, the real minimum height of the image is |
| 595 // defined most accurately by the height of the end cap images. | 594 // defined most accurately by the height of the end cap images. |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 const gfx::ImageSkia& image) { | 1595 const gfx::ImageSkia& image) { |
| 1597 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1596 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1598 ImageCacheEntry entry; | 1597 ImageCacheEntry entry; |
| 1599 entry.resource_id = resource_id; | 1598 entry.resource_id = resource_id; |
| 1600 entry.scale_factor = scale_factor; | 1599 entry.scale_factor = scale_factor; |
| 1601 entry.image = image; | 1600 entry.image = image; |
| 1602 image_cache_->push_front(entry); | 1601 image_cache_->push_front(entry); |
| 1603 if (image_cache_->size() > kMaxImageCacheSize) | 1602 if (image_cache_->size() > kMaxImageCacheSize) |
| 1604 image_cache_->pop_back(); | 1603 image_cache_->pop_back(); |
| 1605 } | 1604 } |
| OLD | NEW |