| 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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 (event.flags() & ui::EF_FROM_TOUCH) == 0) ? CLOSE_TAB_FROM_MOUSE : | 710 (event.flags() & ui::EF_FROM_TOUCH) == 0) ? CLOSE_TAB_FROM_MOUSE : |
| 711 CLOSE_TAB_FROM_TOUCH; | 711 CLOSE_TAB_FROM_TOUCH; |
| 712 DCHECK_EQ(close_button_, sender); | 712 DCHECK_EQ(close_button_, sender); |
| 713 controller()->CloseTab(this, source); | 713 controller()->CloseTab(this, source); |
| 714 } | 714 } |
| 715 | 715 |
| 716 //////////////////////////////////////////////////////////////////////////////// | 716 //////////////////////////////////////////////////////////////////////////////// |
| 717 // Tab, views::ContextMenuController overrides: | 717 // Tab, views::ContextMenuController overrides: |
| 718 | 718 |
| 719 void Tab::ShowContextMenuForView(views::View* source, | 719 void Tab::ShowContextMenuForView(views::View* source, |
| 720 const gfx::Point& point) { | 720 const gfx::Point& point, |
| 721 ui::MenuSourceType source_type) { |
| 721 if (controller() && !closing()) | 722 if (controller() && !closing()) |
| 722 controller()->ShowContextMenuForTab(this, point); | 723 controller()->ShowContextMenuForTab(this, point, source_type); |
| 723 } | 724 } |
| 724 | 725 |
| 725 //////////////////////////////////////////////////////////////////////////////// | 726 //////////////////////////////////////////////////////////////////////////////// |
| 726 // Tab, views::View overrides: | 727 // Tab, views::View overrides: |
| 727 | 728 |
| 728 void Tab::OnPaint(gfx::Canvas* canvas) { | 729 void Tab::OnPaint(gfx::Canvas* canvas) { |
| 729 // Don't paint if we're narrower than we can render correctly. (This should | 730 // Don't paint if we're narrower than we can render correctly. (This should |
| 730 // only happen during animations). | 731 // only happen during animations). |
| 731 if (width() < GetMinimumUnselectedSize().width() && !data().mini) | 732 if (width() < GetMinimumUnselectedSize().width() && !data().mini) |
| 732 return; | 733 return; |
| (...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 const gfx::ImageSkia& image) { | 1821 const gfx::ImageSkia& image) { |
| 1821 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1822 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1822 ImageCacheEntry entry; | 1823 ImageCacheEntry entry; |
| 1823 entry.resource_id = resource_id; | 1824 entry.resource_id = resource_id; |
| 1824 entry.scale_factor = scale_factor; | 1825 entry.scale_factor = scale_factor; |
| 1825 entry.image = image; | 1826 entry.image = image; |
| 1826 image_cache_->push_front(entry); | 1827 image_cache_->push_front(entry); |
| 1827 if (image_cache_->size() > kMaxImageCacheSize) | 1828 if (image_cache_->size() > kMaxImageCacheSize) |
| 1828 image_cache_->pop_back(); | 1829 image_cache_->pop_back(); |
| 1829 } | 1830 } |
| OLD | NEW |