| 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 (event.type() == ui::ET_MOUSE_RELEASED && | 709 (event.type() == ui::ET_MOUSE_RELEASED && |
| 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( |
| 720 const gfx::Point& point) { | 720 views::View* source, |
| 721 const gfx::Point& point, |
| 722 ui::ContextMenuSourceType source_type) { |
| 723 // TODO(varunjain): pass along source_type to controller. |
| 721 if (controller() && !closing()) | 724 if (controller() && !closing()) |
| 722 controller()->ShowContextMenuForTab(this, point); | 725 controller()->ShowContextMenuForTab(this, point); |
| 723 } | 726 } |
| 724 | 727 |
| 725 //////////////////////////////////////////////////////////////////////////////// | 728 //////////////////////////////////////////////////////////////////////////////// |
| 726 // Tab, views::View overrides: | 729 // Tab, views::View overrides: |
| 727 | 730 |
| 728 void Tab::OnPaint(gfx::Canvas* canvas) { | 731 void Tab::OnPaint(gfx::Canvas* canvas) { |
| 729 // Don't paint if we're narrower than we can render correctly. (This should | 732 // Don't paint if we're narrower than we can render correctly. (This should |
| 730 // only happen during animations). | 733 // only happen during animations). |
| (...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 const gfx::ImageSkia& image) { | 1823 const gfx::ImageSkia& image) { |
| 1821 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1824 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1822 ImageCacheEntry entry; | 1825 ImageCacheEntry entry; |
| 1823 entry.resource_id = resource_id; | 1826 entry.resource_id = resource_id; |
| 1824 entry.scale_factor = scale_factor; | 1827 entry.scale_factor = scale_factor; |
| 1825 entry.image = image; | 1828 entry.image = image; |
| 1826 image_cache_->push_front(entry); | 1829 image_cache_->push_front(entry); |
| 1827 if (image_cache_->size() > kMaxImageCacheSize) | 1830 if (image_cache_->size() > kMaxImageCacheSize) |
| 1828 image_cache_->pop_back(); | 1831 image_cache_->pop_back(); |
| 1829 } | 1832 } |
| OLD | NEW |