| 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 | |
| 9 #include <limits> | 8 #include <limits> |
| 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/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/themes/theme_properties.h" | 17 #include "chrome/browser/themes/theme_properties.h" |
| 18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/layout_constants.h" | 19 #include "chrome/browser/ui/layout_constants.h" |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 | 601 |
| 602 void Tab::StartPulse() { | 602 void Tab::StartPulse() { |
| 603 pulse_animation_.reset(new gfx::ThrobAnimation(this)); | 603 pulse_animation_.reset(new gfx::ThrobAnimation(this)); |
| 604 pulse_animation_->SetSlideDuration(kPulseDurationMs); | 604 pulse_animation_->SetSlideDuration(kPulseDurationMs); |
| 605 if (animation_container_.get()) | 605 if (animation_container_.get()) |
| 606 pulse_animation_->SetContainer(animation_container_.get()); | 606 pulse_animation_->SetContainer(animation_container_.get()); |
| 607 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); | 607 pulse_animation_->StartThrobbing(std::numeric_limits<int>::max()); |
| 608 } | 608 } |
| 609 | 609 |
| 610 void Tab::StopPulse() { | 610 void Tab::StopPulse() { |
| 611 StopAndDeleteAnimation(pulse_animation_.Pass()); | 611 StopAndDeleteAnimation(std::move(pulse_animation_)); |
| 612 } | 612 } |
| 613 | 613 |
| 614 void Tab::StartPinnedTabTitleAnimation() { | 614 void Tab::StartPinnedTabTitleAnimation() { |
| 615 if (!data().pinned) | 615 if (!data().pinned) |
| 616 return; | 616 return; |
| 617 if (!pinned_title_change_animation_) { | 617 if (!pinned_title_change_animation_) { |
| 618 gfx::MultiAnimation::Parts parts; | 618 gfx::MultiAnimation::Parts parts; |
| 619 parts.push_back( | 619 parts.push_back( |
| 620 gfx::MultiAnimation::Part(kPinnedTitleChangeAnimationDuration1MS, | 620 gfx::MultiAnimation::Part(kPinnedTitleChangeAnimationDuration1MS, |
| 621 gfx::Tween::EASE_OUT)); | 621 gfx::Tween::EASE_OUT)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 634 pinned_title_change_animation_.reset( | 634 pinned_title_change_animation_.reset( |
| 635 new gfx::MultiAnimation(parts, timeout)); | 635 new gfx::MultiAnimation(parts, timeout)); |
| 636 if (animation_container_.get()) | 636 if (animation_container_.get()) |
| 637 pinned_title_change_animation_->SetContainer(animation_container_.get()); | 637 pinned_title_change_animation_->SetContainer(animation_container_.get()); |
| 638 pinned_title_change_animation_->set_delegate(this); | 638 pinned_title_change_animation_->set_delegate(this); |
| 639 } | 639 } |
| 640 pinned_title_change_animation_->Start(); | 640 pinned_title_change_animation_->Start(); |
| 641 } | 641 } |
| 642 | 642 |
| 643 void Tab::StopPinnedTabTitleAnimation() { | 643 void Tab::StopPinnedTabTitleAnimation() { |
| 644 StopAndDeleteAnimation(pinned_title_change_animation_.Pass()); | 644 StopAndDeleteAnimation(std::move(pinned_title_change_animation_)); |
| 645 } | 645 } |
| 646 | 646 |
| 647 int Tab::GetWidthOfLargestSelectableRegion() const { | 647 int Tab::GetWidthOfLargestSelectableRegion() const { |
| 648 // Assume the entire region to the left of the media indicator and/or close | 648 // Assume the entire region to the left of the media indicator and/or close |
| 649 // buttons is available for click-to-select. If neither are visible, the | 649 // buttons is available for click-to-select. If neither are visible, the |
| 650 // entire tab region is available. | 650 // entire tab region is available. |
| 651 const int indicator_left = showing_media_indicator_ ? | 651 const int indicator_left = showing_media_indicator_ ? |
| 652 media_indicator_button_->x() : width(); | 652 media_indicator_button_->x() : width(); |
| 653 const int close_button_left = showing_close_button_ ? | 653 const int close_button_left = showing_close_button_ ? |
| 654 close_button_->x() : width(); | 654 close_button_->x() : width(); |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 const gfx::ImageSkia& image) { | 1750 const gfx::ImageSkia& image) { |
| 1751 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1751 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1752 ImageCacheEntry entry; | 1752 ImageCacheEntry entry; |
| 1753 entry.resource_id = resource_id; | 1753 entry.resource_id = resource_id; |
| 1754 entry.scale_factor = scale_factor; | 1754 entry.scale_factor = scale_factor; |
| 1755 entry.image = image; | 1755 entry.image = image; |
| 1756 image_cache_->push_front(entry); | 1756 image_cache_->push_front(entry); |
| 1757 if (image_cache_->size() > kMaxImageCacheSize) | 1757 if (image_cache_->size() > kMaxImageCacheSize) |
| 1758 image_cache_->pop_back(); | 1758 image_cache_->pop_back(); |
| 1759 } | 1759 } |
| OLD | NEW |