| 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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 const int kPaddingBetweenIcons = 2; | 1424 const int kPaddingBetweenIcons = 2; |
| 1425 if (available_width >= width_per_icon && | 1425 if (available_width >= width_per_icon && |
| 1426 available_width < (width_per_icon + kPaddingBetweenIcons)) { | 1426 available_width < (width_per_icon + kPaddingBetweenIcons)) { |
| 1427 return 1; | 1427 return 1; |
| 1428 } | 1428 } |
| 1429 return available_width / (width_per_icon + kPaddingBetweenIcons); | 1429 return available_width / (width_per_icon + kPaddingBetweenIcons); |
| 1430 } | 1430 } |
| 1431 | 1431 |
| 1432 bool Tab::ShouldShowIcon() const { | 1432 bool Tab::ShouldShowIcon() const { |
| 1433 return chrome::ShouldTabShowFavicon( | 1433 return chrome::ShouldTabShowFavicon( |
| 1434 IconCapacity(), data().mini, IsActive(), data().show_icon, | 1434 IconCapacity(), width(), controller_->TouchWasUsedAsLastInput(), |
| 1435 data().mini, IsActive(), data().show_icon, |
| 1435 media_indicator_button_ ? media_indicator_button_->showing_media_state() : | 1436 media_indicator_button_ ? media_indicator_button_->showing_media_state() : |
| 1436 data_.media_state); | 1437 data_.media_state); |
| 1437 } | 1438 } |
| 1438 | 1439 |
| 1439 bool Tab::ShouldShowMediaIndicator() const { | 1440 bool Tab::ShouldShowMediaIndicator() const { |
| 1440 return chrome::ShouldTabShowMediaIndicator( | 1441 return chrome::ShouldTabShowMediaIndicator( |
| 1441 IconCapacity(), data().mini, IsActive(), data().show_icon, | 1442 IconCapacity(), width(), controller_->TouchWasUsedAsLastInput(), |
| 1443 data().mini, IsActive(), data().show_icon, |
| 1442 media_indicator_button_ ? media_indicator_button_->showing_media_state() : | 1444 media_indicator_button_ ? media_indicator_button_->showing_media_state() : |
| 1443 data_.media_state); | 1445 data_.media_state); |
| 1444 } | 1446 } |
| 1445 | 1447 |
| 1446 bool Tab::ShouldShowCloseBox() const { | 1448 bool Tab::ShouldShowCloseBox() const { |
| 1447 return chrome::ShouldTabShowCloseButton( | 1449 return chrome::ShouldTabShowCloseButton( |
| 1448 IconCapacity(), data().mini, IsActive()); | 1450 IconCapacity(), width(), controller_->TouchWasUsedAsLastInput(), |
| 1451 data().mini, IsActive()); |
| 1449 } | 1452 } |
| 1450 | 1453 |
| 1451 double Tab::GetThrobValue() { | 1454 double Tab::GetThrobValue() { |
| 1452 const bool is_selected = IsSelected(); | 1455 const bool is_selected = IsSelected(); |
| 1453 const double min = is_selected ? kSelectedTabOpacity : 0; | 1456 const double min = is_selected ? kSelectedTabOpacity : 0; |
| 1454 const double scale = is_selected ? kSelectedTabThrobScale : 1; | 1457 const double scale = is_selected ? kSelectedTabThrobScale : 1; |
| 1455 | 1458 |
| 1456 // Showing both the pulse and title change animation at the same time is too | 1459 // Showing both the pulse and title change animation at the same time is too |
| 1457 // much. | 1460 // much. |
| 1458 if (pulse_animation_ && pulse_animation_->is_animating() && | 1461 if (pulse_animation_ && pulse_animation_->is_animating() && |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 const gfx::ImageSkia& image) { | 1602 const gfx::ImageSkia& image) { |
| 1600 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1603 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1601 ImageCacheEntry entry; | 1604 ImageCacheEntry entry; |
| 1602 entry.resource_id = resource_id; | 1605 entry.resource_id = resource_id; |
| 1603 entry.scale_factor = scale_factor; | 1606 entry.scale_factor = scale_factor; |
| 1604 entry.image = image; | 1607 entry.image = image; |
| 1605 image_cache_->push_front(entry); | 1608 image_cache_->push_front(entry); |
| 1606 if (image_cache_->size() > kMaxImageCacheSize) | 1609 if (image_cache_->size() > kMaxImageCacheSize) |
| 1607 image_cache_->pop_back(); | 1610 image_cache_->pop_back(); |
| 1608 } | 1611 } |
| OLD | NEW |